From 12f2565f91a82ec3c99ee7a422f69efaf284353d Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Mon, 8 Apr 2024 12:43:35 -0700 Subject: 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 --- tests/unit/libstore-support/tests/test-data.hh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/unit/libstore-support/tests/test-data.hh (limited to 'tests/unit/libstore-support') 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); +} + +} -- cgit v1.2.3