Skip to content

Commit

Permalink
Merge pull request #1376 from bynect/fix-test-dir
Browse files Browse the repository at this point in the history
Use TESTDIR env var
  • Loading branch information
bynect authored Sep 16, 2024
2 parents b6fa8ce + 9655f2c commit e7ddf50
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,17 @@ 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 ./test | ./test/greenest.awk '
TESTDIR=./test ./test/test -v | ./test/greenest.awk '

test-valgrind: test/test
${VALGRIND} \
TESTDIR=./test ${VALGRIND} \
--suppressions=.valgrind.suppressions \
--leak-check=full \
--show-leak-kinds=definite \
--errors-for-leak-kinds=definite \
--num-callers=40 \
--error-exitcode=123 \
./test/test ./test
./test/test -v

test-coverage: CFLAGS += -fprofile-arcs -ftest-coverage -O0
test-coverage: test
Expand Down
12 changes: 2 additions & 10 deletions test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,8 @@ SUITE_EXTERN(suite_input);
GREATEST_MAIN_DEFS();

int main(int argc, char *argv[]) {
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 = getenv("TESTDIR");
base = realpath(base ? base : "./test", NULL);

/* By default do not print out warning messages, when executing tests.
* But allow, if DUNST_TEST_LOG=1 is set in environment. */
Expand Down

0 comments on commit e7ddf50

Please sign in to comment.