Skip to content

Commit 6a6af2c

Browse files
committed
.
1 parent 882bfca commit 6a6af2c

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

cpp/src/parquet/encryption/external/test_utils.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,21 @@ std::string TestUtils::GetExecutableDirectory() {
5858
}
5959

6060
std::string TestUtils::GetTestLibraryPath() {
61+
// Strong override: reuse the same env var as the Python tooling
62+
// (`python/scripts/base_app.py`): DBPA_LIBRARY_PATH.
63+
//
64+
// This allows CI/build systems to provide the exact path to the DBPA agent shared
65+
// library, avoiding reliance on executable-path heuristics or current working directory.
66+
const char* explicit_path = std::getenv("DBPA_LIBRARY_PATH");
67+
if (explicit_path && explicit_path[0]) {
68+
std::string p(explicit_path);
69+
if (std::filesystem::exists(p)) {
70+
return p;
71+
}
72+
throw std::runtime_error("DBPA_LIBRARY_PATH is set but the file does not exist: " +
73+
p);
74+
}
75+
6176
// Check for environment variable to override the executable directory
6277
const char* cwd_override = std::getenv("PARQUET_TEST_LIBRARY_CWD");
6378
std::string base_path;

cpp/src/parquet/meson.build

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ parquet_deps = [arrow_dep, rapidjson_dep, thrift_dep]
9393

9494
# Default to no DBPA test-agent library (only built when encryption+testing are enabled).
9595
dbpa_test_agent_lib = disabler()
96+
dbpa_test_agent_path = ''
9697

9798
if needs_parquet_encryption or get_option('parquet_require_encryption').auto()
9899
openssl_dep = dependency('openssl', required: needs_parquet_encryption)
@@ -175,6 +176,7 @@ if openssl_dep.found()
175176
install: false,
176177
gnu_symbol_visibility: 'default',
177178
)
179+
dbpa_test_agent_path = dbpa_test_agent_lib.full_path()
178180
endif
179181
endif
180182
else
@@ -397,6 +399,9 @@ foreach key, val : parquet_tests
397399
# Make DBPATestAgent lookup deterministic under Meson. Some CI setups may
398400
# not allow /proc/self/exe resolution or run tests with unexpected cwd.
399401
'PARQUET_TEST_LIBRARY_CWD': meson.current_build_dir(),
402+
# Reuse the standard env var used by Python tooling (`base_app.py`).
403+
# Prefer this in C++ as well.
404+
'DBPA_LIBRARY_PATH': dbpa_test_agent_path,
400405
},
401406
)
402407
endforeach

0 commit comments

Comments
 (0)