[PATCH stalld 09/36] tests/helpers: Fix relative path in backend detection functions

Wander Lairson Costa <[email protected]>
Newsgroups org.kernel.vger.linux-rt-users
Message-ID <[email protected]>
detect_default_backend() and is_backend_available() use a
hardcoded relative path "../stalld" to locate the binary for
backend detection via nm. This breaks when tests are invoked from
a different working directory, such as when run_tests.sh executes
them from the project root.

Use ${TEST_ROOT}/../stalld instead, consistent with the path
resolution used in start_stalld_with_log() and
start_starvation_gen().

Signed-off-by: Wander Lairson Costa <[email protected]>
---
 tests/helpers/test_helpers.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/helpers/test_helpers.sh b/tests/helpers/test_helpers.sh
index 1750423..8ff1b80 100755
--- a/tests/helpers/test_helpers.sh
+++ b/tests/helpers/test_helpers.sh
@@ -816,7 +816,7 @@ pick_test_cpu() {
 
 # Detect which backend stalld was compiled with (default)
 detect_default_backend() {
-	local stalld_bin="../stalld"
+	local stalld_bin="${TEST_ROOT}/../stalld"
 	if [ ! -x "${stalld_bin}" ]; then
 		echo "unknown"
 		return 1
@@ -839,7 +839,7 @@ detect_default_backend() {
 # Check if a specific backend is available
 is_backend_available() {
 	local backend=$1
-	local stalld_bin="../stalld"
+	local stalld_bin="${TEST_ROOT}/../stalld"
 
 	if [ ! -x "${stalld_bin}" ]; then
 		return 1
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.