]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: add trivial test for systemd-measure
authorLennart Poettering <lennart@poettering.net>
Fri, 29 Jul 2022 16:45:53 +0000 (18:45 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 2 Aug 2022 08:28:49 +0000 (10:28 +0200)
test/units/testsuite-70.sh

index 09f78a0226b274543746a6771339063687db01f1..f0bbee9436c1d2ccc5ff0328bfbd87e5f769e823 100755 (executable)
@@ -43,6 +43,18 @@ env PASSWORD=passphrase systemd-cryptenroll --tpm2-device=auto --tpm2-pcrs=0+7 $
 tpm2_pcrextend 0:sha256=0000000000000000000000000000000000000000000000000000000000000000
 /usr/lib/systemd/systemd-cryptsetup attach test-volume $img - tpm2-device=auto,headless=1 && exit 1
 
+echo HALLO > /tmp/tpmdata1
+echo foobar > /tmp/tpmdata2
+
+cat > /tmp/result <<EOF
+11:sha1=5177e4ad69db92192c10e5f80402bf81bfec8a81
+11:sha256=37b48bd0b222394dbe3cceff2fca4660c4b0a90ae9369ec90b42f14489989c13
+11:sha384=5573f9b2caf55b1d0a6a701f890662d682af961899f0419cf1e2d5ea4a6a68c1f25bd4f5b8a0865eeee82af90f5cb087
+11:sha512=961305d7e9981d6606d1ce97b3a9a1f92610cac033e9c39064895f0e306abc1680463d55767bd98e751eae115bdef3675a9ee1d29ed37da7885b1db45bb2555b
+EOF
+
+/usr/lib/systemd/systemd-measure calculate --linux=/tmp/tpmdata1 --initrd=/tmp/tpmdata2 | cmp - /tmp/result
+
 echo OK >/testok
 
 exit 0