aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjeffro256 <jeffro256@tutanota.com>2023-10-28 03:14:05 -0500
committerjeffro256 <jeffro256@tutanota.com>2023-10-28 03:14:05 -0500
commit504269e6cf25a00f729b413cefcac58a15c92925 (patch)
tree2973faa0c68117580c5a45777facc0f6a02a9320
parentMerge pull request #9026 (diff)
downloadmonero-504269e6cf25a00f729b413cefcac58a15c92925.tar.xz
unit tests: fix running from pwd and auto test selected location
-rw-r--r--tests/CMakeLists.txt2
-rw-r--r--tests/unit_tests/main.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 00896818c..736872b04 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -32,7 +32,7 @@ set(MONERO_WALLET_CRYPTO_BENCH "auto" CACHE STRING "Select wallet crypto librari
# The docs say this only affects grouping in IDEs
set(folder "tests")
-set(TEST_DATA_DIR "${CMAKE_CURRENT_LIST_DIR}/data")
+set(TEST_DATA_DIR "${CMAKE_CURRENT_BINARY_DIR}/data")
if (WIN32 AND STATIC)
add_definitions(-DSTATICLIB)
diff --git a/tests/unit_tests/main.cpp b/tests/unit_tests/main.cpp
index 586cb7c60..4094d79b7 100644
--- a/tests/unit_tests/main.cpp
+++ b/tests/unit_tests/main.cpp
@@ -63,7 +63,7 @@ int main(int argc, char** argv)
::testing::InitGoogleTest(&argc, argv);
// the default test data directory is ../data (relative to the executable's directory)
- const auto default_test_data_dir = boost::filesystem::path(argv[0]).parent_path().parent_path() / "data";
+ const auto default_test_data_dir = boost::filesystem::canonical(argv[0]).parent_path().parent_path() / "data";
po::options_description desc_options("Command line options");
const command_line::arg_descriptor<std::string> arg_data_dir = { "data-dir", "Data files directory", default_test_data_dir.string() };