diff --git a/Makefile b/Makefile index 4070263d8..f0d4a6f8d 100644 --- a/Makefile +++ b/Makefile @@ -94,7 +94,7 @@ endif test: test/test clean-coverage-run # Make sure an error code is returned when the test fails /usr/bin/env bash -c 'set -euo pipefail;\ - ./test/test -v | ./test/greenest.awk ' + ./test/test ./test | ./test/greenest.awk ' test-valgrind: test/test ${VALGRIND} \ @@ -104,7 +104,7 @@ test-valgrind: test/test --errors-for-leak-kinds=definite \ --num-callers=40 \ --error-exitcode=123 \ - ./test/test -v + ./test/test ./test test-coverage: CFLAGS += -fprofile-arcs -ftest-coverage -O0 test-coverage: test diff --git a/test/test.c b/test/test.c index 5d4e42907..ab3927e27 100644 --- a/test/test.c +++ b/test/test.c @@ -33,12 +33,16 @@ SUITE_EXTERN(suite_input); GREATEST_MAIN_DEFS(); int main(int argc, char *argv[]) { - char *prog = realpath(argv[0], NULL); - if (!prog) { + if (argc != 2) { + fprintf(stderr, "Usage: %s testdatadir", argv[0]); + exit(1); + } + + base = realpath(argv[1], NULL); + if (!base) { fprintf(stderr, "Cannot determine actual path of test executable: %s\n", strerror(errno)); exit(1); } - base = dirname(prog); /* By default do not print out warning messages, when executing tests. * But allow, if DUNST_TEST_LOG=1 is set in environment. */ @@ -71,9 +75,7 @@ int main(int argc, char *argv[]) { RUN_SUITE(suite_rules); RUN_SUITE(suite_input); - base = NULL; g_strfreev(configs); - free(prog); // this returns the error code GREATEST_MAIN_END();