Skip to content

Commit 102a91b

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 72b093a commit 102a91b

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
@@ -181,9 +181,25 @@ check_dependencies() {
181181
# --- Test case directory lookup ---
182182
find_test_case_by_name() {
183183
test_name=$1
184-
base_dir="${__RUNNER_SUITES_DIR:-$ROOT_DIR/suites}"
185-
# Only search under the SUITES directory!
186-
testpath=$(find "$base_dir" -type d -iname "$test_name" -print -quit 2>/dev/null)
184+
# Use __RUNNER_SUITES_DIR if set, otherwise default to $ROOT_DIR/suites
185+
# This allows both host-tools (where __RUNNER_SUITES_DIR=$ROOT_DIR)
186+
# and Runner (where it defaults to $ROOT_DIR/suites) to work correctly
187+
if [ -n "${__RUNNER_SUITES_DIR:-}" ]; then
188+
base_dir="$__RUNNER_SUITES_DIR"
189+
else
190+
base_dir="${ROOT_DIR:-$(pwd)}/suites"
191+
fi
192+
193+
# Use explicit path to Unix find command to avoid conflicts with other find utilities
194+
find_cmd="find"
195+
if [ -x "/usr/bin/find" ]; then
196+
find_cmd="/usr/bin/find"
197+
elif [ -x "/bin/find" ]; then
198+
find_cmd="/bin/find"
199+
fi
200+
201+
# Search under the base directory
202+
testpath=$("$find_cmd" "$base_dir" -type d -iname "$test_name" -print -quit 2>/dev/null)
187203
echo "$testpath"
188204
}
189205

0 commit comments

Comments
 (0)