Skip to content

Commit

Permalink
test eventlog: fix check evntlog.sh if efivar.h exists
Browse files Browse the repository at this point in the history
If efivar.h exist a pretty print function for the DevicePath
is executed. Therefore two yaml test files are needed for
the bin test file uefiservices.
Fixes #3302.

Signed-off-by: Juergen Repp <[email protected]>
  • Loading branch information
JuergenReppSIT committed Nov 20, 2023
1 parent a36f8e2 commit a08f85e
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,13 @@ if HAVE_FAPI
endif

if UNIT
if HAVE_EFIVAR_H
$(LN_S) -f test/integration/fixtures/event-uefiservices.bin.yaml.pretty \
test/integration/fixtures/event-uefiservices.bin.yaml
else
$(LN_S) -f test/integration/fixtures/event-uefiservices.bin.yaml.raw \
test/integration/fixtures/event-uefiservices.bin.yaml
endif
check_SCRIPTS =
TESTS += $(check_PROGRAMS)
check_PROGRAMS = \
Expand Down Expand Up @@ -352,6 +359,7 @@ TEST_EXTENSIONS = .sh

check-hook:
rm -rf .lock_file
rm -f test/integration/fixtures/event-uefiservices.bin.yaml

EXTRA_DIST_IGNORE = \
.gitignore \
Expand Down Expand Up @@ -632,6 +640,7 @@ dist_bashcomp_DATA+= \
endif

install-data-hook:

cd $(DESTDIR)$(bashcompdir) && \
for tool in $(bin_PROGRAMS); do \
[ "$${tool}" = "$${tool#tools/fapi/*}" ] && $(LN_S) -f tpm2_completion.bash $${tool##*/}; \
Expand All @@ -647,6 +656,18 @@ dist-hook:
for f in $(EXTRA_DIST_IGNORE); do \
rm -rf `find $(distdir) -name $$f`; \
done;

prepare-check:
if HAVE_EFIVAR_H
cp test/integration/fixtures/event-uefiservices.bin.yaml.pretty \
test/integration/fixtures/event-uefiservices.bin.yaml
else
cp test/integration/fixtures/event-uefiservices.bin.yaml.raw \
test/integration/fixtures/event-uefiservices.bin.yaml
endif

check: prepare-check

if !HAVE_PANDOC
# If pandoc is not enabled, we want to complain that you need pandoc for make dist,
# so hook the target and complain.
Expand Down
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ AS_IF([test "x$with_efivar" == "xauto"],
[PKG_CHECK_MODULES([EFIVAR], [efivar], [AC_CHECK_HEADERS([efivar/efivar.h])])],
)

AC_CHECK_HEADERS([efivar/efivar.h],[efivar_h=yes ], [efivar = no ])
AM_CONDITIONAL([HAVE_EFIVAR_H], [test "$efivar_h" = yes])

# backwards compat with older pkg-config
# - pull in AC_DEFUN from pkg.m4
m4_ifndef([PKG_CHECK_VAR], [
Expand Down
45 changes: 45 additions & 0 deletions test/integration/fixtures/event-uefiservices.bin.yaml.pretty
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
version: 1
events:
- EventNum: 0
PCRIndex: 0
EventType: EV_NO_ACTION
Digest: "0000000000000000000000000000000000000000"
EventSize: 37
SpecID:
- Signature: Spec ID Event03
platformClass: 0
specVersionMinor: 0
specVersionMajor: 2
specErrata: 0
uintnSize: 2
numberOfAlgorithms: 2
Algorithms:
- Algorithm[0]:
algorithmId: sha1
digestSize: 20
- Algorithm[1]:
algorithmId: sha256
digestSize: 32
vendorInfoSize: 0
- EventNum: 1
PCRIndex: 2
EventType: EV_EFI_BOOT_SERVICES_DRIVER
DigestCount: 2
Digests:
- AlgorithmId: sha1
Digest: "855685b4dbd4b67d50e0594571055054cfe2b1e9"
- AlgorithmId: sha256
Digest: "dd8576b4ff346c19c56c3e4f97ce55c5afa646f9c669be0a7cdd05057a0ecdf3"
EventSize: 84
Event:
ImageLocationInMemory: 0x7dcf6018
ImageLengthInMemory: 171464
ImageLinkTimeAddress: 0x0
LengthOfDevicePath: 52
DevicePath1: 'PciRoot(0x0)/Pci(0x2,0x0)/Pci(0x0,0x0)/Offset(0x12600,0x3c3ff)'
pcrs:
sha1:
2 : 0x5b5f4d5c31664f01670a98a5796a36473671befc
sha256:
2 : 0x35fcf9d737c52c971f7c74058d36937dbd7824177fa0f1de3eba3934fcb83b9d

0 comments on commit a08f85e

Please sign in to comment.