From 33930281fd6a7b8e40d4e43bf889d20a2593f88b Mon Sep 17 00:00:00 2001 From: Cedric Hombourger Date: Mon, 14 Aug 2023 12:32:10 +0200 Subject: [PATCH] tests: storage: add storage write test for bmap images Signed-off-by: Cedric Hombourger --- .github/workflows/main.yml | 1 + scripts/test-using-docker | 4 +++- tests/test_storage.py | 10 ++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 46c0c048..773aebe1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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: diff --git a/scripts/test-using-docker b/scripts/test-using-docker index fe88bc46..1ec8a69e 100644 --- a/scripts/test-using-docker +++ b/scripts/test-using-docker @@ -54,11 +54,12 @@ cd ${tmp_dir} 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:9 do docker pull ${image} >/dev/null || exit ${?} docker rm mtda-docker >/dev/null 2>&1 || true docker create --name=mtda-docker ${image} sh >/dev/null + image=$(echo ${image} | cut -d: -f1) docker export mtda-docker > ${image}.tar || exit ${?} done @@ -68,6 +69,7 @@ zstd --rm -f ubuntu.tar || exit ${?} bzip2 -f archlinux.tar || exit ${?} xz -f almalinux.tar || exit ${?} du -sh *.tar* +bmaptool create rockylinux.tar > rockylinux.tar.bmap || exit ${?} echo "# starting mtda in the background" ${source_dir}/mtda-service -n 2>debug.log & diff --git a/tests/test_storage.py b/tests/test_storage.py index 4cc9675a..3b643453 100644 --- a/tests/test_storage.py +++ b/tests/test_storage.py @@ -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")