Skip to content

Commit 9333b0b

Browse files
committed
Remove dependency on send-to-lava.sh; emit test results directly from run.sh
- All test scripts now use emit_result_and_signal() from functestlib.sh to report results inline using <LAVA_SIGNAL_TESTCASE ...> format. - Eliminated the need to call Runner/utils/send-to-lava.sh at the end of test jobs. - This enables LAVA to capture and display test results immediately as each test completes, improving granularity and reducing parser dependency. - Verified that both standalone and suite-level runs continue to write .res files. Note: YAML job files must no longer include send-to-lava.sh in the test step. Signed-off-by: Srikanth Muppandam <smuppand@qti.qualcomm.com>
1 parent 25a36b1 commit 9333b0b

File tree

4 files changed

+75
-80
lines changed

4 files changed

+75
-80
lines changed

Runner/plans/qcom-next-ci-premerge.yaml

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -15,41 +15,5 @@ run:
1515
steps:
1616
- cd Runner
1717
- $PWD/suites/Kernel/FunctionalArea/baseport/adsp_remoteproc/run.sh || true
18-
- $PWD/utils/send-to-lava.sh $PWD/suites/Kernel/FunctionalArea/baseport/adsp_remoteproc/adsp_remoteproc.res || true
1918
- $PWD/suites/Kernel/FunctionalArea/baseport/cdsp_remoteproc/run.sh || true
20-
- $PWD/utils/send-to-lava.sh $PWD/suites/Kernel/FunctionalArea/baseport/cdsp_remoteproc/cdsp_remoteproc.res || true
21-
- $PWD/suites/Kernel/FunctionalArea/baseport/CPUFreq_Validation/run.sh || true
22-
- $PWD/utils/send-to-lava.sh $PWD/suites/Kernel/FunctionalArea/baseport/CPUFreq_Validation/CPUFreq_Validation.res || true
23-
- $PWD/suites/Kernel/FunctionalArea/baseport/GIC/run.sh || true
24-
- $PWD/utils/send-to-lava.sh $PWD/suites/Kernel/FunctionalArea/baseport/GIC/GIC.res || true
25-
- $PWD/suites/Kernel/FunctionalArea/baseport/hotplug/run.sh || true
26-
- $PWD/utils/send-to-lava.sh $PWD/suites/Kernel/FunctionalArea/baseport/hotplug/hotplug.res || true
27-
- $PWD/suites/Kernel/FunctionalArea/baseport/Interrupts/run.sh || true
28-
- $PWD/utils/send-to-lava.sh $PWD/suites/Kernel/FunctionalArea/baseport/Interrupts/Interrupts.res || true
29-
- $PWD/suites/Kernel/FunctionalArea/baseport/irq/run.sh || true
30-
- $PWD/utils/send-to-lava.sh $PWD/suites/Kernel/FunctionalArea/baseport/irq/irq.res || true
31-
- $PWD/suites/Kernel/FunctionalArea/baseport/kaslr/run.sh || true
32-
- $PWD/utils/send-to-lava.sh $PWD/suites/Kernel/FunctionalArea/baseport/kaslr/kaslr.res || true
33-
- $PWD/suites/Kernel/FunctionalArea/baseport/MEMLAT/run.sh || true
34-
- $PWD/utils/send-to-lava.sh $PWD/suites/Kernel/FunctionalArea/baseport/MEMLAT/MEMLAT.res || true
35-
- $PWD/suites/Kernel/FunctionalArea/baseport/pinctrl/run.sh || true
36-
- $PWD/utils/send-to-lava.sh $PWD/suites/Kernel/FunctionalArea/baseport/pinctrl/pinctrl.res || true
37-
- $PWD/suites/Kernel/FunctionalArea/baseport/Reboot_health_check/run.sh || true
38-
- $PWD/utils/send-to-lava.sh $PWD/suites/Kernel/FunctionalArea/baseport/Reboot_health_check/Reboot_health_check.res || true
39-
- $PWD/suites/Kernel/FunctionalArea/baseport/remoteproc/run.sh || true
40-
- $PWD/utils/send-to-lava.sh $PWD/suites/Kernel/FunctionalArea/baseport/remoteproc/remoteproc.res || true
41-
- $PWD/suites/Kernel/FunctionalArea/baseport/RMNET/run.sh || true
42-
- $PWD/utils/send-to-lava.sh $PWD/suites/Kernel/FunctionalArea/baseport/RMNET/RMNET.res || true
43-
- $PWD/suites/Kernel/FunctionalArea/baseport/IPA/run.sh || true
44-
- $PWD/utils/send-to-lava.sh $PWD/suites/Kernel/FunctionalArea/baseport/IPA/IPA.res || true
45-
- $PWD/suites/Kernel/FunctionalArea/baseport/Probe_Failure_Check/run.sh || true
46-
- $PWD/utils/send-to-lava.sh $PWD/suites/Kernel/FunctionalArea/baseport/Probe_Failure_Check/Probe_Failure_Check.res || true
47-
- $PWD/suites/Kernel/FunctionalArea/baseport/rngtest/run.sh || true
48-
- $PWD/utils/send-to-lava.sh $PWD/suites/Kernel/FunctionalArea/baseport/rngtest/rngtest.res || true
49-
- $PWD/suites/Kernel/FunctionalArea/baseport/smmu/run.sh || true
50-
- $PWD/utils/send-to-lava.sh $PWD/suites/Kernel/FunctionalArea/baseport/smmu/smmu.res || true
51-
- $PWD/suites/Kernel/FunctionalArea/baseport/storage/run.sh || true
52-
- $PWD/utils/send-to-lava.sh $PWD/suites/Kernel/FunctionalArea/baseport/storage/storage.res || true
53-
- $PWD/suites/Kernel/FunctionalArea/baseport/wpss_remoteproc/run.sh || true
54-
- $PWD/utils/send-to-lava.sh $PWD/suites/Kernel/FunctionalArea/baseport/wpss_remoteproc/wpss_remoteproc.res || true
5519
- $PWD/utils/result_parse.sh

Runner/suites/Kernel/FunctionalArea/baseport/adsp_remoteproc/run.sh

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ fi
3232
TESTNAME="adsp_remoteproc"
3333
test_path=$(find_test_case_by_name "$TESTNAME")
3434
cd "$test_path" || exit 1
35-
# shellcheck disable=SC2034
36-
res_file="./$TESTNAME.res"
3735

3836
log_info "-----------------------------------------------------------------------------------------"
3937
log_info "-------------------Starting $TESTNAME Testcase----------------------------"
@@ -46,47 +44,45 @@ adsp_position=$(echo "$firmware_output" | grep -n "adsp" | cut -d: -f1)
4644

4745
# Adjust the position to match the remoteproc numbering (starting from 0)
4846
remoteproc_number=$((adsp_position - 1))
49-
50-
# Construct the remoteproc path based on the adsp position
5147
remoteproc_path="/sys/class/remoteproc/remoteproc${remoteproc_number}"
5248
log_info "Remoteproc node is $remoteproc_path"
53-
# Execute command 1 and check if the output is "running"
54-
state1=$(cat ${remoteproc_path}/state)
5549

50+
# Command 1: Check initial state
51+
state1=$(cat "${remoteproc_path}/state")
5652
if [ "$state1" != "running" ]; then
57-
log_fail "$TESTNAME : Test Failed"
58-
echo "$TESTNAME FAIL" > "$test_path/$TESTNAME.res"
53+
log_fail "adsp not in running state initially"
54+
emit_result_and_signal "$TESTNAME" "FAIL"
5955
exit 1
6056
fi
6157

62-
# Execute command 2 (no output expected)
58+
# Command 2: Stop
6359
log_info "Stopping remoteproc"
64-
echo stop > ${remoteproc_path}/state
60+
echo stop > "${remoteproc_path}/state"
6561

66-
# Execute command 3 and check if the output is "offline"
67-
state3=$(cat ${remoteproc_path}/state)
62+
# Command 3: Check state after stop
63+
state3=$(cat "${remoteproc_path}/state")
6864
if [ "$state3" != "offline" ]; then
6965
log_fail "adsp stop failed"
70-
echo "$TESTNAME FAIL" > "$test_path/$TESTNAME.res"
66+
emit_result_and_signal "$TESTNAME" "FAIL"
7167
exit 1
7268
else
7369
log_pass "adsp stop successful"
7470
fi
71+
72+
# Command 4: Start
7573
log_info "Restarting remoteproc"
76-
# Execute command 4 (no output expected)
77-
echo start > ${remoteproc_path}/state
74+
echo start > "${remoteproc_path}/state"
7875

79-
# Execute command 5 and check if the output is "running"
80-
state5=$(cat ${remoteproc_path}/state)
76+
# Command 5: Check state after start
77+
state5=$(cat "${remoteproc_path}/state")
8178
if [ "$state5" != "running" ]; then
8279
log_fail "adsp start failed"
83-
echo "$TESTNAME FAIL" > "$res_file"
80+
emit_result_and_signal "$TESTNAME" "FAIL"
8481
exit 1
8582
fi
8683

87-
# If all checks pass, print "PASS"
88-
echo "adsp PASS"
84+
# All checks passed
8985
log_pass "adsp PASS"
90-
echo "$TESTNAME PASS" > "$res_file"
86+
emit_result_and_signal "$TESTNAME" "PASS"
9187
log_info "-------------------Completed $TESTNAME Testcase----------------------------"
9288
exit 0

Runner/suites/Kernel/FunctionalArea/baseport/cdsp_remoteproc/run.sh

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,59 +32,53 @@ fi
3232
TESTNAME="cdsp_remoteproc"
3333
test_path=$(find_test_case_by_name "$TESTNAME")
3434
cd "$test_path" || exit 1
35-
# shellcheck disable=SC2034
36-
res_file="./$TESTNAME.res"
3735

3836
log_info "-----------------------------------------------------------------------------------------"
3937
log_info "-------------------Starting $TESTNAME Testcase----------------------------"
4038
log_info "=== Test Initialization ==="
4139

42-
# Get the firmware output and find the position of cdsp
4340
log_info "Get the firmware output and find the position of cdsp"
4441
firmware_output=$(cat /sys/class/remoteproc/remoteproc*/firmware)
4542
cdsp_position=$(echo "$firmware_output" | grep -n "cdsp" | cut -d: -f1)
4643

47-
# Adjust the position to match the remoteproc numbering (starting from 0)
4844
remoteproc_number=$((cdsp_position - 1))
49-
50-
# Construct the remoteproc path based on the cdsp position
5145
remoteproc_path="/sys/class/remoteproc/remoteproc${remoteproc_number}"
46+
log_info "Remoteproc node is $remoteproc_path"
5247

53-
# Execute command 1 and check if the output is "running"
54-
state1=$(cat ${remoteproc_path}/state)
48+
# Check initial state
49+
state1=$(cat "${remoteproc_path}/state")
5550
if [ "$state1" != "running" ]; then
56-
log_fail "$TESTNAME : Test Failed"
57-
echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res
51+
log_fail "$TESTNAME : not in running state initially"
52+
emit_result_and_signal "$TESTNAME" "FAIL"
5853
exit 1
5954
fi
6055

61-
# Execute command 2 (no output expected)
62-
echo stop > ${remoteproc_path}/state
56+
# Stop remoteproc
57+
log_info "Stopping remoteproc"
58+
echo stop > "${remoteproc_path}/state"
6359

64-
# Execute command 3 and check if the output is "offline"
65-
state3=$(cat ${remoteproc_path}/state)
60+
# Verify stop
61+
state3=$(cat "${remoteproc_path}/state")
6662
if [ "$state3" != "offline" ]; then
6763
log_fail "cdsp stop failed"
68-
echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res
64+
emit_result_and_signal "$TESTNAME" "FAIL"
6965
exit 1
7066
else
7167
log_pass "cdsp stop successful"
7268
fi
69+
7370
log_info "Restarting remoteproc"
74-
# Execute command 4 (no output expected)
75-
echo start > ${remoteproc_path}/state
71+
echo start > "${remoteproc_path}/state"
7672

77-
# Execute command 5 and check if the output is "running"
78-
state5=$(cat ${remoteproc_path}/state)
73+
# Verify restart
74+
state5=$(cat "${remoteproc_path}/state")
7975
if [ "$state5" != "running" ]; then
8076
log_fail "cdsp start failed"
81-
echo "$TESTNAME FAIL" > "$res_file"
77+
emit_result_and_signal "$TESTNAME" "FAIL"
8278
exit 1
8379
fi
8480

85-
# If all checks pass, print "PASS"
86-
echo "cdsp PASS"
8781
log_pass "cdsp PASS"
88-
echo "$TESTNAME PASS" > "$res_file"
82+
emit_result_and_signal "$TESTNAME" "PASS"
8983
log_info "-------------------Completed $TESTNAME Testcase----------------------------"
9084
exit 0

Runner/utils/functestlib.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,3 +391,44 @@ weston_start() {
391391
fi
392392
}
393393

394+
# Determine if the test is being run as part of a suite (i.e., run-test.sh is the parent)
395+
is_suite_run() {
396+
grep -q "run-test.sh" "/proc/$PPID/cmdline" 2>/dev/null
397+
}
398+
399+
# emit_result_and_signal TESTCASE RESULT
400+
#
401+
# Logs the test result to the .res file and emits a LAVA-compatible signal.
402+
# This function ensures that:
403+
# - The result is appended to the per-test .res file (PASS, FAIL, SKIP).
404+
# - A LAVA_SIGNAL_TESTCASE is sent to stderr in atomic format.
405+
# - If the test is run standalone (not via run-test.sh), the file is created.
406+
#
407+
# Arguments:
408+
# TESTCASE : The name of the test case (e.g., "rngtest")
409+
# RESULT : One of PASS, FAIL, or SKIP
410+
#
411+
# This allows both suite-level and individual test executions to remain compatible
412+
# with LAVA's result parsing, without losing debug logs to stdout.
413+
# One-time FD setup
414+
if [ -z "$LAVA_FD_INITIALIZED" ]; then
415+
exec 3>&2 # Use FD 3 for LAVA signals (stderr clone)
416+
LAVA_FD_INITIALIZED=1
417+
fi
418+
419+
emit_result_and_signal() {
420+
TESTCASE="$1"
421+
RESULT="$2"
422+
res_file="./${TESTCASE}.res"
423+
424+
if ! is_suite_run && [ ! -f "$res_file" ]; then
425+
: > "$res_file"
426+
fi
427+
echo "$TESTCASE $RESULT" >> "$res_file"
428+
429+
# Emit signal cleanly to FD 3 with newline padding
430+
echo "" >&3
431+
printf "<<<LAVA_SIGNAL_TESTCASE TEST_CASE_ID=%s RESULT=%s>>>\n" "$TESTCASE" "$RESULT" >&3
432+
echo "" >&3
433+
sleep 0.1
434+
}

0 commit comments

Comments
 (0)