When trying to directly run a test executable in the build tree without
setting $TEST_DIR, some tests fail with a non-obvious error message.
Print an useful one instead.
assert_se(readlink_and_make_absolute("/proc/self/exe", &exedir) >= 0);
assert_se(snprintf(testdir, sizeof(testdir), "%s/testdata", dirname(exedir)) > 0);
+ if (access(testdir, F_OK) < 0) {
+ fprintf(stderr, "Test data directory '%s' does not exist, set $TEST_DIR\n", testdir);
+ exit(1);
+ }
return testdir;
}