Skip to content

Commit

Permalink
test eventlog.sh Fix accidental deletions.
Browse files Browse the repository at this point in the history
* Accidental deletions made in commit 196e3d4
  are undone.
* python3 is used as default instead of python.

Signed-off-by: Juergen Repp <juergen_repp@web.de>
  • Loading branch information
JuergenReppSIT committed Apr 8, 2024
1 parent d5d8e2e commit 4dec529
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions test/integration/tests/eventlog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -E
shopt -s expand_aliases

alias python=${PYTHON-python}
alias python=${PYTHON-python3}

yaml_validate() {
cmd=$1
Expand Down Expand Up @@ -88,7 +88,36 @@ expect_pass() {
expect_fail
expect_fail foo
expect_fail foo bar
expect_fail ${srcdir}/test/integration/fix
expect_fail ${srcdir}/test/integration/fixtures/event-bad.bin

expect_pass ${srcdir}/test/integration/fixtures/specid-vendordata.bin
expect_pass ${srcdir}/test/integration/fixtures/event.bin
expect_pass ${srcdir}/test/integration/fixtures/event-uefivar.bin
expect_pass ${srcdir}/test/integration/fixtures/event-uefiaction.bin
expect_pass ${srcdir}/test/integration/fixtures/event-uefiservices.bin
expect_pass ${srcdir}/test/integration/fixtures/event-uefi-sha1-log.bin
expect_pass ${srcdir}/test/integration/fixtures/event-bootorder.bin
expect_pass ${srcdir}/test/integration/fixtures/event-postcode.bin

# Make sure that --eventlog-version=2 works on complete TPM2 logs
expect_pass ${srcdir}/test/integration/fixtures/event-arch-linux.bin --eventlog-version=2
expect_pass ${srcdir}/test/integration/fixtures/event-gce-ubuntu-2104-log.bin --eventlog-version=2
expect_pass ${srcdir}/test/integration/fixtures/event-sd-boot-fedora37.bin --eventlog-version=2
expect_pass ${srcdir}/test/integration/fixtures/event-moklisttrusted.bin --eventlog-version=2

# Pick an event with leading whitespace and validate we have
# preserved it correctly after parsing the YAML
event=$(yaml_validate "print(y['events'][80]['Event']['String'])" < ${srcdir}/test/integration/fixtures/event-moklisttrusted.bin.yaml | tr -d '\0')
expect=$(echo -e "grub_cmd: menuentry UEFI Firmware Settings --id uefi-firmware {\n\t\tfwsetup\n\t}")
if test "$event" != "$expect"
then
echo "Got $event"
echo "Want $expect"
exit 1
fi

# Compare strings generated by tpm2_eventlog with binary data of the corresponding
# events.
hex_file="${srcdir}/test/integration/fixtures/event-moklisttrusted-hex.yaml"
tool_file="${srcdir}/test/integration/fixtures/event-moklisttrusted.bin.yaml"

Expand Down

0 comments on commit 4dec529

Please sign in to comment.