summaryrefslogtreecommitdiffstats
path: root/test/misc.test
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2022-06-17 09:23:12 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2022-06-17 10:39:29 +0200
commitfbb9f30b34f0a4fcb44fdf50a503e40b70eb2602 (patch)
tree03061f7bc0c18ac3051798289b839bc8e308c369 /test/misc.test
parentac5a6a0d95b6799d22edf19cb80b33139c30f967 (diff)
downloadgenimage-fbb9f30b34f0a4fcb44fdf50a503e40b70eb2602.tar.gz
genimage-fbb9f30b34f0a4fcb44fdf50a503e40b70eb2602.tar.xz
test: split test definitions into multiple files
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'test/misc.test')
-rwxr-xr-xtest/misc.test93
1 files changed, 93 insertions, 0 deletions
diff --git a/test/misc.test b/test/misc.test
new file mode 100755
index 0000000..a5c8938
--- /dev/null
+++ b/test/misc.test
@@ -0,0 +1,93 @@
+#!/bin/bash
+set -x
+test_description="Misc Image Tests"
+
+. "$(dirname "${0}")/test-setup.sh"
+
+exec_test_set_prereq dd
+exec_test_set_prereq diff
+exec_test_set_prereq qemu-img
+test_expect_success dd,diff,qemu-img "qemu" "
+ setup_test_images &&
+ run_genimage qemu.config test.qcow &&
+ qemu-img check images/test.qcow &&
+ zcat '${testdir}/qemu.qcow.gz' > qemu.qcow &&
+ qemu-img compare images/test.qcow qemu.qcow
+"
+
+setup_fit_its() {
+ setup_test_images &&
+ cp ${testdir}/fit.its input/
+}
+
+exec_test_set_prereq mkimage
+exec_test_set_prereq dtc
+test_expect_success mkimage,dtc "fit" "
+ setup_fit_its &&
+ run_genimage fit.config test.fit
+"
+
+setup_rauc() {
+ rm -rf input &&
+ mkdir input &&
+ cp -r "${testdir}"/rauc-openssl-ca input/ &&
+ echo "test" > input/rauc.content &&
+ echo "test2" > input/rauc2.content
+}
+
+exec_test_set_prereq rauc
+test_expect_success rauc "rauc" "
+ setup_rauc &&
+ run_genimage rauc.config test.raucb &&
+ rauc info \
+ --keyring input/rauc-openssl-ca/ca.cert.pem \
+ --cert input/rauc-openssl-ca/ca.cert.pem \
+ images/test.raucb | grep -v cms_get_enveloped_type \
+ | sed -e 's;O = Test Org, CN = ;/O=Test Org/CN=;' \
+ -e '/Bundle Format:[ \t]*plain$/d' \
+ > test.raucb.info &&
+ if ! grep -r 'Filename:' test.raucb.info; then
+ test_cmp '${testdir}/test.raucb.info' test.raucb.info
+ else
+ test_cmp '${testdir}/test.raucb.info.new' test.raucb.info
+ fi
+ rauc info \
+ --keyring input/rauc-openssl-ca/ca.cert.pem \
+ --cert input/rauc-openssl-ca/ca.cert.pem \
+ images/test2.raucb | grep -v cms_get_enveloped_type \
+ | sed -e 's;O = Test Org, CN = ;/O=Test Org/CN=;' \
+ -e '/Bundle Format:[ \t]*plain$/d' \
+ > test2.raucb.info &&
+ if ! grep -r 'Filename:' test2.raucb.info; then
+ test_cmp '${testdir}/test2.raucb.info' test2.raucb.info
+ else
+ test_cmp '${testdir}/test2.raucb.info.new' test2.raucb.info
+ fi
+"
+
+exec_test_set_prereq simg2img
+test_expect_success simg2img "android-sparse" "
+ setup_test_images &&
+ for i in \`seq 16\`; do
+ dd if=/dev/urandom of=input/interleaved conv=notrunc seek=\$[i*i] count=\$[i] bs=\$[i*i*512] || break
+ done &&
+ run_genimage sparse.config &&
+ md5sum images/test.hdimage input/interleaved > md5sum &&
+ rm images/test.hdimage input/interleaved &&
+ check_size_range images/interleaved.sparse 9732464 9732608 &&
+ simg2img images/test.sparse images/test.hdimage &&
+ simg2img images/interleaved.sparse input/interleaved &&
+ md5sum -c md5sum
+"
+
+exec_test_set_prereq fiptool
+test_expect_success fiptool "fip" "
+ setup_test_images &&
+ run_genimage fip.config test.fip &&
+ check_size_range images/test.fip 12804 13056 &&
+ fiptool info images/test.fip
+"
+
+test_done
+
+# vim: syntax=sh