diff options
author | Rebecca Turner <rbt@sent.as> | 2024-04-08 12:43:35 -0700 |
---|---|---|
committer | Rebecca Turner <rbt@sent.as> | 2024-04-08 12:43:35 -0700 |
commit | 12f2565f91a82ec3c99ee7a422f69efaf284353d (patch) | |
tree | f004ba2c4b3adf4648ae5eb1f04f67eac35f604f /tests/unit/libstore-support | |
parent | b3233405381b50c7f7eb87d7962b25a06d16be44 (diff) |
Don't run libstore unit tests in project root
This keeps the libstore unit tests from writing
`libstore-unit-tests.xml` to the project root.
Change-Id: I0d9909aabf9f3574cc1e72a5ae81daefba9a394b
Diffstat (limited to 'tests/unit/libstore-support')
-rw-r--r-- | tests/unit/libstore-support/tests/test-data.hh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/unit/libstore-support/tests/test-data.hh b/tests/unit/libstore-support/tests/test-data.hh new file mode 100644 index 000000000..7aa1dd90d --- /dev/null +++ b/tests/unit/libstore-support/tests/test-data.hh @@ -0,0 +1,25 @@ +#pragma once + +#include "util.hh" +#include "types.hh" + +namespace nix { + +// TODO: These helpers should be available in all unit tests. + +/** + * The path to the unit test data directory. See the contributing guide + * in the manual for further details. + */ +static Path getUnitTestData() { + return getEnv("_NIX_TEST_UNIT_DATA").value(); +} + +/** + * Resolve a path under the unit test data directory to an absolute path. + */ +static Path getUnitTestDataPath(std::string_view path) { + return absPath(getUnitTestData() + "/" + path); +} + +} |