Skip to content

Commit 5ab3bb2

Browse files
authored
Merge pull request qualcomm-linux#193 from vnarapar/timer_fix
Added minor timer script fix
2 parents 59365c8 + 57b662b commit 5ab3bb2

File tree

1 file changed

+48
-4
lines changed
  • Runner/suites/Kernel/Baseport/Timer

1 file changed

+48
-4
lines changed

Runner/suites/Kernel/Baseport/Timer/run.sh

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,39 @@ fi
2929
# shellcheck disable=SC1090,SC1091
3030
. "$TOOLS/functestlib.sh"
3131

32+
# --- Parse CLI argument for custom binary path ---
33+
show_help() {
34+
cat <<EOF
35+
Usage: $0 [OPTIONS]
36+
37+
Options:
38+
--binary-path=PATH Specify a custom path to the posix_timers binary else run by default from /usr/bin.
39+
-h, --help Show this help message and exit.
40+
41+
Example:
42+
$0 --binary-path=/custom/path/posix_timers
43+
$0
44+
45+
EOF
46+
}
47+
48+
49+
BINARY_PATH=""
50+
while [ $# -gt 0 ]; do
51+
case "$1" in
52+
--binary-path=*)
53+
BINARY_PATH="${1#*=}"
54+
;;
55+
-h|--help)
56+
show_help
57+
exit 0
58+
;;
59+
*)
60+
;;
61+
esac
62+
shift
63+
done
64+
3265
TESTNAME="Timer"
3366
test_path=$(find_test_case_by_name "$TESTNAME")
3467
cd "$test_path" || exit 1
@@ -39,13 +72,24 @@ log_info "----------------------------------------------------------------------
3972
log_info "-------------------Starting $TESTNAME Testcase----------------------------"
4073
log_info "=== Test Initialization ==="
4174

42-
chmod -R 777 /APT/timers
75+
# --- Determine binary to use ---
76+
if [ -n "$BINARY_PATH" ]; then
77+
BINARY="$BINARY_PATH"
78+
else
79+
BINARY="posix_timers"
80+
fi
4381

44-
# Path to the binary
45-
BINARY_PATH="/var/common/bins/timers/posix_timers"
82+
# --- Check if binary exists in PATH or at custom path ---
83+
check_dependencies "$BINARY"
84+
if [ $? -ne 0 ]; then
85+
log_skip "$TESTNAME : Binary '$BINARY' not found"
86+
echo "$TESTNAME SKIP" > "$res_file"
87+
exit 0
88+
fi
4689

4790
# Run the binary and capture the output
48-
OUTPUT=$($BINARY_PATH)
91+
OUTPUT=$($BINARY)
92+
echo $OUTPUT
4993

5094
# Check if "pass:7" is in the output
5195
if echo "${OUTPUT}" | grep "pass:7"; then

0 commit comments

Comments
 (0)