diff options
author | Martin Pitt <martin@piware.de> | 2017-02-12 23:14:43 +0100 |
---|---|---|
committer | Martin Pitt <martin@piware.de> | 2017-02-13 22:31:13 +0100 |
commit | f853c6efb509589c8e3a82caa3af2ac5a370ae97 (patch) | |
tree | 4b5e46c4dfc6a9dfd701db8c29975d546b0b9ece /src/test/test-cgroup-mask.c | |
parent | ee3c7ff7c303cdbc8fea18d3a6f3c4c6e7c450d8 (diff) | |
download | systemd-f853c6efb509589c8e3a82caa3af2ac5a370ae97.tar.gz |
test: make unit tests relocatable
It is useful to package test-* binaries and run them as root under
autopkgtest or manually on particular machines. They currently have a
built-in hardcoded absolute path to their test data, which does not work
when running the test programs from any other path than the original
build directory.
By default, make the tests look for their data in
<test_exe_directory>/testdata/ so that they can be called from any
directory (provided that the corresponding test data is installed
correctly). As we don't have a fixed static path in the build tree (as
build and source tree are independent), set $TEST_DIR with "make check"
to point to <srcdir>/test/, as we previously did with an automake
variable.
Diffstat (limited to 'src/test/test-cgroup-mask.c')
-rw-r--r-- | src/test/test-cgroup-mask.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test/test-cgroup-mask.c b/src/test/test-cgroup-mask.c index a027eb0fd2..630587aaf1 100644 --- a/src/test/test-cgroup-mask.c +++ b/src/test/test-cgroup-mask.c @@ -34,7 +34,7 @@ static int test_cgroup_mask(void) { int r; /* Prepare the manager. */ - assert_se(set_unit_path(TEST_DIR) >= 0); + assert_se(set_unit_path(TEST_DATA_DIR("")) >= 0); r = manager_new(UNIT_FILE_USER, true, &m); if (r == -EPERM || r == -EACCES) { puts("manager_new: Permission denied. Skipping test."); |