Browse Source

Re-organize and enhance autopkgtest. Closes: #979248

* Adjust for changes upstream
* Run more tests
* Show the run time of each test, possibly use that later to implement
  a timeout.
* Disable the unbind-unbound-slot-luks2 test, it waits endlessly for
  something from stdin.

Note, total execution time is several minutes, even on powerful
hardware.

This needs a re-visit after next upstream release.
Christoph Biedl 9 months ago
parent
commit
a9064ace88
2 changed files with 43 additions and 9 deletions
  1. 6 4
      debian/tests/control
  2. 37 5
      debian/tests/run-testsuite

+ 6 - 4
debian/tests/control

@@ -1,13 +1,15 @@
 Tests: run-testsuite
 Depends:
-    clevis-dracut,
-    clevis-initramfs,
-    clevis-tpm2,
-    clevis-udisks2,
+    clevis,
+    clevis-luks,
     cryptsetup,
     jose,
     jq,
     moreutils,
     openssl,
+    socat,
+    systemd,
+    tang (>= 7-3~),
 Restrictions:
     needs-root,
+Architecture: linux-any

+ 37 - 5
debian/tests/run-testsuite

@@ -1,15 +1,47 @@
 #!/bin/sh
 
-set -e
+set -eu
 
-cd src/luks/tests
+# emulate substitution
+sed -e '
+s:@SOCAT@:/usr/bin/socat: ;
+s:@TANGD_KEYGEN@:/usr/libexec/tangd-keygen: ;
+s:@TANGD_UPDATE@:: ;
+s:@TANGD@:/usr/libexec/tangd:
+' \
+    <src/pins/tang/tests/tang-common-test-functions.in \
+    >src/pins/tang/tests/tang-common-test-functions
 
-# patch out lukv2 detection switch - we're on the bright side already
+# patch out luksv2 detection switch - we're on the bright side already
 sed -e 's/@OLD_CRYPTSETUP@/0/' \
-    <tests-common-functions.in >tests-common-functions
+    <src/luks/tests/tests-common-functions.in \
+    >src/luks/tests/tests-common-functions
+
+SRC="$PWD"
+
+export PATH="$SRC/src/pins/tang/tests:$PATH"
+
+EXIT=0
+
+cd "$SRC/src/luks/tests"
 
 for f in $(find . -type f -not -name 'tests-common-functions*' -executable | sort) ; do
+    if [ "$f" = './unbind-unbound-slot-luks2' ] ; then
+        echo "W: Skipping test $f"
+        continue
+    fi
     echo "I: Running test $f"
     # test are very noisy, keep them silent as long as they pass
-    chronic "$f" || :
+    T0="$(date +%s)"
+    chronic "$f" || EXIT=$?
+    DELTA="$(( $(date +%s) - $T0 ))"
+    echo "I: ... run time: $DELTA"
 done
+
+
+cd "$SRC/src/pins/tang/tests"
+
+echo "I: Running test pin-tang"
+chronic bash pin-tang || EXIT=$?
+
+exit $EXIT