Skip to content

Commit

Permalink
tests: storage: add storage write test for bmap images
Browse files Browse the repository at this point in the history
Signed-off-by: Cedric Hombourger <[email protected]>
  • Loading branch information
chombourger committed Aug 14, 2023
1 parent 01d7ef9 commit 192540d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
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
11 changes: 10 additions & 1 deletion scripts/test-using-docker
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,17 @@ sed -i -e 's,command=bash,command=sh,g' ${tmp_dir}/docker.ini

cd ${tmp_dir}

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

echo "# getting various docker images"
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 ${?}
docker rm mtda-docker >/dev/null 2>&1 || true
Expand All @@ -67,6 +75,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

0 comments on commit 192540d

Please sign in to comment.