From 5163cdc3e8c1b472b54898c03f232611bdd86dbb Mon Sep 17 00:00:00 2001 From: Krystian Hebel Date: Fri, 12 Apr 2024 16:50:13 +0200 Subject: [PATCH] .github/workflows/build.yml: run 'make tests' This enables SHA tests to check if different compilers produce the same results. Signed-off-by: Krystian Hebel --- .github/workflows/build.yml | 4 ++++ Makefile | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ec84603..b2fd8e7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,3 +25,7 @@ jobs: run: | make CC=${{matrix.compiler}} BITS=${{matrix.bits}} ${{matrix.lto}} ./extend_skl_only.sh + + - name: make tests + run: | + make CC=${{matrix.compiler}} BITS=64 ${{matrix.lto}} tests diff --git a/Makefile b/Makefile index 3564332..6fb5fa8 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,10 @@ CFLAGS_TPMLIB := -include boot.h -include errno-base.h -include byteswap.h -DEBA # Derive AFLAGS from CFLAGS AFLAGS := -D__ASSEMBLY__ $(filter-out -std=%,$(CFLAGS)) +TEST_CFLAGS := $(filter-out -ffreestanding -march% -Werror,$(CFLAGS)) +TEST_CFLAGS += -Wno-implicit-function-declaration +TEST_CFLAGS += $(if $(COV),-fprofile-arcs -ftest-coverage) + ALL_SRC := $(wildcard *.c) $(wildcard tpmlib/*.c) TESTS := $(filter test-%,$(ALL_SRC:.c=)) @@ -75,9 +79,9 @@ tpmlib/%.o: tpmlib/%.c Makefile %.S: %.c Makefile $(CC) $(CFLAGS) -S $< -o $@ -# Helpers for building and running tests on the current host +# Helpers for building and running tests on the current host. test-%: test-%.c Makefile - $(CC) $(filter-out -ffreestanding -march%,$(CFLAGS)) $(if $(COV),-fprofile-arcs -ftest-coverage) $< -o $@ + $(CC) $(TEST_CFLAGS) $< -o $@ .PHONY: run-test-% .SECONDARY: