Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test bmap #322

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
uses: actions/checkout@v3
- name: tox
run: |
sudo apt-get install -y bmap-tools
pip3 install --user tox
tox -s
mtda-nanopi-images:
Expand Down
19 changes: 16 additions & 3 deletions scripts/test-using-docker
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,23 @@ sed -i -e 's,command=bash,command=sh,g' ${tmp_dir}/docker.ini

cd ${tmp_dir}

echo "# getting various docker images"
# Create a docker image with a file filled with zeroes in order to
# get holes in the resulting .tar image
cat << EOF > Dockerfile
FROM rockylinux:9
RUN dd if=/dev/zero of=/EMPTY bs=1M count=8
EOF

docker build -t rockylinux .
rm -f Dockerfile

docker stop mtda-docker >/dev/null 2>&1 || true
for image in alpine debian ubuntu archlinux almalinux
for image in alpine debian ubuntu archlinux almalinux rockylinux
do
docker pull ${image} >/dev/null || exit ${?}
if [ "${image}" != "rockylinux" ]; then
echo "# getting docker image '${image}' ..."
docker pull ${image} >/dev/null || exit ${?}
fi
docker rm mtda-docker >/dev/null 2>&1 || true
docker create --name=mtda-docker ${image} sh >/dev/null
docker export mtda-docker > ${image}.tar || exit ${?}
Expand All @@ -67,6 +79,7 @@ gzip -f debian.tar || exit ${?}
zstd --rm -f ubuntu.tar || exit ${?}
bzip2 -f archlinux.tar || exit ${?}
xz -f almalinux.tar || exit ${?}
bmaptool create rockylinux.tar > rockylinux.tar.bmap || exit ${?}
du -sh *.tar*

echo "# starting mtda in the background"
Expand Down
10 changes: 10 additions & 0 deletions tests/test_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ def test_write_raw(powered_off):
assert Console.wait_for("Alpine") is not None


def test_write_bmap(powered_off):
assert Storage.to_host() is True
Storage.write("rockylinux.tar")
assert Storage.to_target() is True

assert Target.on() is True
Console.send("cat /etc/os-release\r")
assert Console.wait_for("Rocky Linux") is not None


def test_write_bz2(powered_off):
assert Storage.to_host() is True
Storage.write("archlinux.tar.bz2")
Expand Down