Skip to content

Commit ba6812f

Browse files
committed
Added changes in functestlib.sh to make host-tools run-test.sh works and Ensures test discovery works across different environments
Signed-off-by: Nitin Nakka <nitinn@qti.qualcomm.com>
1 parent 9a60ba3 commit ba6812f

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

Runner/utils/functestlib.sh

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,25 @@ check_dependencies() {
176176
# --- Test case directory lookup ---
177177
find_test_case_by_name() {
178178
test_name=$1
179-
base_dir="${__RUNNER_SUITES_DIR:-$ROOT_DIR/suites}"
180-
# Only search under the SUITES directory!
181-
testpath=$(find "$base_dir" -type d -iname "$test_name" -print -quit 2>/dev/null)
179+
# Use __RUNNER_SUITES_DIR if set, otherwise default to $ROOT_DIR/suites
180+
# This allows both host-tools (where __RUNNER_SUITES_DIR=$ROOT_DIR)
181+
# and Runner (where it defaults to $ROOT_DIR/suites) to work correctly
182+
if [ -n "${__RUNNER_SUITES_DIR:-}" ]; then
183+
base_dir="$__RUNNER_SUITES_DIR"
184+
else
185+
base_dir="${ROOT_DIR:-$(pwd)}/suites"
186+
fi
187+
188+
# Use explicit path to Unix find command to avoid conflicts with other find utilities
189+
find_cmd="find"
190+
if [ -x "/usr/bin/find" ]; then
191+
find_cmd="/usr/bin/find"
192+
elif [ -x "/bin/find" ]; then
193+
find_cmd="/bin/find"
194+
fi
195+
196+
# Search under the base directory
197+
testpath=$("$find_cmd" "$base_dir" -type d -iname "$test_name" -print -quit 2>/dev/null)
182198
echo "$testpath"
183199
}
184200

0 commit comments

Comments
 (0)