From de9173a71f8c36a74ee4667c6f3f64b6f0087a65 Mon Sep 17 00:00:00 2001 From: matteo Date: Fri, 23 Jan 2026 23:20:32 +0100 Subject: [PATCH] fix: testsuite --- src/Makefile.am | 18 ++++++++---------- tests/functional/run-tests.sh | 5 ++++- tests/wrap.sh | 6 ++++++ 3 files changed, 18 insertions(+), 11 deletions(-) create mode 100755 tests/wrap.sh diff --git a/src/Makefile.am b/src/Makefile.am index 8cee132..2971e09 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -24,10 +24,8 @@ bin_PROGRAMS = 42sh # ================ TESTS ================ -check-local: $(bin_PROGRAMS) # $(check_PROGRAMS) - ./../tests/functional/run-tests.sh - -#./testsuite +check: + ../tests/wrap.sh # "$(COVERAGE)" "$(OUTPUT_FILE)" # ------------- Unit tests -------------- @@ -45,13 +43,13 @@ testsuite_LDADD = $(42sh_LDADD) -lcriterion # ------------- asan debug -------------- -check_PROGRAMS += debug +# check_PROGRAMS += debug #debug_CFLAGS = $(42sh_CFLAGS) #debug_CFLAGS += -fsanitize=address -g -debug_SOURCES = $(42sh_SOURCES) - -debug_CPPFLAGS = $(42sh_CPPFLAGS) - -debug_LDADD = $(42sh_LDADD) +# debug_SOURCES = $(42sh_SOURCES) +# +# debug_CPPFLAGS = $(42sh_CPPFLAGS) +# +# debug_LDADD = $(42sh_LDADD) diff --git a/tests/functional/run-tests.sh b/tests/functional/run-tests.sh index ef5030f..0da9f15 100755 --- a/tests/functional/run-tests.sh +++ b/tests/functional/run-tests.sh @@ -5,7 +5,7 @@ # Variables # ################### -executable="../../src/42sh" +executable="$BIN_PATH" ref_executable="dash" tmp_script="/tmp/test_script.sh" @@ -242,6 +242,9 @@ summarize() { echo -e $BWhite "\n\n""===========" $UWhite"Summary"$Color_Off "\n" echo -e " Passed $coverage_color$passed_tests/$total_tests$Color_Off tests ($coverage_color$tests_percentage$Color_Off%)" echo -e " Got $BRed$timeouts_count timeout(s)$Color_Off" + if [ "$OUTPUT_FILE" != "" ]; + then echo $tests_percentage > "$OUTPUT_FILE"; + fi echo } diff --git a/tests/wrap.sh b/tests/wrap.sh new file mode 100755 index 0000000..5cd6f53 --- /dev/null +++ b/tests/wrap.sh @@ -0,0 +1,6 @@ +if [ "$COVERAGE" = "yes" ]; #coverage +then ./testsuite && ../tests/functional/run-tests.sh +else ../tests/functional/run-tests.sh +fi +echo bin path: "$BIN_PATH" +echo output file: "$OUTPUT_FILE"