1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
From: Christian Kastner <ckk@debian.org>
Date: Mon, 7 Jul 2025 20:03:17 +0200
Subject: Enable changing directory for test data
On Debian, we install to a versioned directory based on the library
name.
Forwarded: not-needed
---
clients/common/utility.cpp | 9 +++++++++
clients/tests/CMakeLists.txt | 5 +++++
2 files changed, 14 insertions(+)
diff --git a/clients/common/utility.cpp b/clients/common/utility.cpp
index e1a61de..ecdecca 100644
--- a/clients/common/utility.cpp
+++ b/clients/common/utility.cpp
@@ -113,7 +113,16 @@ std::string rocsparse_datapath()
}
#else
std::string pathstr;
+// Debian
+#ifdef INSTALL_TEST_DATA_DIR
+ std::string share_path = INSTALL_TEST_DATA_DIR;
+ if (share_path.back() != '/') {
+ share_path += '/';
+ }
+ return share_path;
+#else
std::string share_path = rocsparse_exepath() + "../share/rocsparse/test";
+#endif
char* path = realpath(share_path.c_str(), 0);
if(path != NULL)
{
diff --git a/clients/tests/CMakeLists.txt b/clients/tests/CMakeLists.txt
index 2f66406..ef19a4b 100644
--- a/clients/tests/CMakeLists.txt
+++ b/clients/tests/CMakeLists.txt
@@ -378,6 +378,11 @@ add_executable(rocsparse-test rocsparse_test_main.cpp ${ROCSPARSE_TEST_SOURCES}
# Set GOOGLE_TEST definition
target_compile_definitions(rocsparse-test PRIVATE GOOGLE_TEST)
+# Debian
+if (DEFINED INSTALL_TEST_DATA_DIR)
+ target_compile_definitions(rocsparse-test PRIVATE INSTALL_TEST_DATA_DIR="${INSTALL_TEST_DATA_DIR}")
+endif()
+
# Target compile options
target_compile_options(rocsparse-test PRIVATE -ffp-contract=on -mfma -Wno-deprecated -Wno-unused-command-line-argument -Wall)
|