mirror of
https://github.com/systemd/systemd.git
synced 2025-03-31 14:50:15 +03:00
test: clarify error message if test data directory does not exist
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.
This commit is contained in:
parent
916b500286
commit
31f8b331c7
@ -42,5 +42,9 @@ const char* get_exe_relative_testdata_dir(void) {
|
||||
|
||||
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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user