From 24180accf5d9e9780eff997600fd986c97ede264 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Mon, 20 Sep 2021 18:57:55 +0200 Subject: [PATCH] 'make test': show failing test cases when cmake does When building with make, `make test` runs `run-test-suites.pl` which has a verbose mode that reports the failing test cases, but it didn't provide a way to enable this verbose mode. With the present commit, you can run `make test TEST_FLAGS=-v` to use verbose mode. Base the default for verbose mode on the same environment variable that `make test` uses when building with CMake: default off, but enabled if `CTEST_OUTPUT_ON_FAILURE` is true. In particular, verbose mode will now be on when building from `all.sh`. Signed-off-by: Gilles Peskine --- tests/Makefile | 5 ++++- tests/scripts/all.sh | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/Makefile b/tests/Makefile index 99c89a3efb..0da3748f18 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -6,6 +6,9 @@ CFLAGS ?= -O2 WARNING_CFLAGS ?= -Wall -W -Wdeclaration-after-statement -Wunused LDFLAGS ?= +# Set this to -v to see the details of failing test cases +TEST_FLAGS ?= $(if $(filter-out 0 OFF Off off NO No no FALSE False false N n,$(CTEST_OUTPUT_ON_FAILURE)),-v,) + LOCAL_CFLAGS = $(WARNING_CFLAGS) -I../include -D_FILE_OFFSET_BITS=64 LOCAL_LDFLAGS = -L../library \ -lmbedtls$(SHARED_SUFFIX) \ @@ -119,7 +122,7 @@ endif # Test suites caught by SKIP_TEST_SUITES are built but not executed. check: $(BINARIES) - perl scripts/run-test-suites.pl --skip=$(SKIP_TEST_SUITES) + perl scripts/run-test-suites.pl $(TEST_FLAGS) --skip=$(SKIP_TEST_SUITES) test: check diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh index f7e5a7338f..4005e16bee 100755 --- a/tests/scripts/all.sh +++ b/tests/scripts/all.sh @@ -186,7 +186,7 @@ pre_initialize_variables () { export MAKEFLAGS="-j" fi - # Include more verbose output for failing tests run by CMake + # Include more verbose output for failing tests run by CMake or make export CTEST_OUTPUT_ON_FAILURE=1 # CFLAGS and LDFLAGS for Asan builds that don't use CMake