Skip to content

Commit bb5f1b1

Browse files
committed
fix(core_auth): restore Weston runtime after test execution
core_auth stops Weston before running but does not bring it back after the test finishes. This leaves subsequent Wayland-based tests without a running compositor or usable Wayland socket. Update core_auth to stop Weston only when it is actually running, track whether this test stopped it, and restore the Weston runtime before exit. Also preserve the testcase result while failing the test if Weston recovery does not succeed. Signed-off-by: Srikanth Muppandam <smuppand@qti.qualcomm.com>
1 parent 06991e2 commit bb5f1b1

1 file changed

Lines changed: 66 additions & 21 deletions

File tree

  • Runner/suites/Multimedia/Display/igt-gpu-tools/core_auth

Runner/suites/Multimedia/Display/igt-gpu-tools/core_auth/run.sh

Lines changed: 66 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ if [ -z "$INIT_ENV" ]; then
1616
fi
1717

1818
# Only source if not already loaded (idempotent)
19-
if [ -z "$__INIT_ENV_LOADED" ]; then
19+
if [ -z "${__INIT_ENV_LOADED:-}" ]; then
2020
# shellcheck disable=SC1090
2121
. "$INIT_ENV"
2222
fi
2323
# Always source functestlib.sh, using $TOOLS exported by init_env
2424
# shellcheck disable=SC1090,SC1091
2525
. "$TOOLS/functestlib.sh"
26+
# shellcheck disable=SC1090,SC1091
27+
. "$TOOLS/lib_display.sh"
2628

2729
TESTNAME="core_auth"
2830
result_file="./${TESTNAME}.res"
@@ -91,10 +93,21 @@ fi
9193

9294
log_info "Using core_auth binary at: $CORE_AUTH_CMD"
9395

94-
if ! weston_stop; then
95-
log_error "Failed to stop Weston"
96-
echo "$TESTNAME FAIL" > "$result_file"
97-
exit 1
96+
weston_stopped_by_test=0
97+
if command -v weston_is_running >/dev/null 2>&1; then
98+
if weston_is_running; then
99+
log_info "Weston is running, stopping it before $TESTNAME"
100+
if ! weston_stop; then
101+
log_error "Failed to stop Weston"
102+
echo "$TESTNAME FAIL" > "$result_file"
103+
exit 1
104+
fi
105+
weston_stopped_by_test=1
106+
else
107+
log_info "Weston is not running, no need to stop it"
108+
fi
109+
else
110+
log_info "weston_is_running helper not found, attempting to continue"
98111
fi
99112

100113
log_file="$test_path/core_auth_log.txt"
@@ -120,30 +133,62 @@ total_subtests=$((success_count + fail_count + skip_count))
120133

121134
log_info "Subtest Results: SUCCESS=$success_count, FAIL=$fail_count, SKIP=$skip_count, TOTAL=$total_subtests"
122135
log_info "results will be written to \"$result_file\""
123-
log_info "-------------------Completed $TESTNAME Testcase----------------------------"
124136

125-
if [ "$RC" -ne 0 ]; then
126-
log_fail "$TESTNAME : Test Failed (exit code: $RC)"
127-
echo "$TESTNAME FAIL" > "$result_file"
128-
exit 1
137+
final_result="PASS"
138+
final_exit=0
139+
final_message=""
140+
141+
if [ "$RC" -eq 77 ]; then
142+
final_result="SKIP"
143+
final_exit=0
144+
final_message="$TESTNAME : Test Skipped (exit code: 77)"
145+
elif [ "$RC" -ne 0 ]; then
146+
final_result="FAIL"
147+
final_exit=1
148+
final_message="$TESTNAME : Test Failed (exit code: $RC)"
129149
elif [ "$fail_count" -gt 0 ]; then
130-
log_fail "$TESTNAME : Test Failed - $fail_count subtest(s) failed out of $total_subtests"
131-
echo "$TESTNAME FAIL" > "$result_file"
132-
exit 1
150+
final_result="FAIL"
151+
final_exit=1
152+
final_message="$TESTNAME : Test Failed - $fail_count subtest(s) failed out of $total_subtests"
133153
elif [ "$skip_count" -gt 0 ] && [ "$success_count" -eq 0 ]; then
134-
log_skip "$TESTNAME : Test Skipped - All $skip_count subtest(s) were skipped"
135-
echo "$TESTNAME SKIP" > "$result_file"
136-
exit 0
154+
final_result="SKIP"
155+
final_exit=0
156+
final_message="$TESTNAME : Test Skipped - All $skip_count subtest(s) were skipped"
137157
else
138158
if [ "$success_count" -gt 0 ]; then
139159
if [ "$skip_count" -gt 0 ]; then
140-
log_pass "$TESTNAME : Test Passed - $success_count subtest(s) succeeded, $skip_count skipped"
160+
final_message="$TESTNAME : Test Passed - $success_count subtest(s) succeeded, $skip_count skipped"
141161
else
142-
log_pass "$TESTNAME : Test Passed - All $success_count subtest(s) succeeded"
162+
final_message="$TESTNAME : Test Passed - All $success_count subtest(s) succeeded"
143163
fi
144164
else
145-
log_pass "$TESTNAME : Test Passed (return code $RC)"
165+
final_message="$TESTNAME : Test Passed (return code $RC)"
146166
fi
147-
echo "$TESTNAME PASS" > "$result_file"
148-
exit 0
149167
fi
168+
169+
if [ "$weston_stopped_by_test" -eq 1 ]; then
170+
log_info "Restoring Weston after $TESTNAME"
171+
if ! weston_restore_runtime 15; then
172+
log_error "Failed to restore Weston after $TESTNAME"
173+
final_result="FAIL"
174+
final_exit=1
175+
final_message="$TESTNAME : Test Failed - Weston restore failed after test execution"
176+
fi
177+
fi
178+
179+
log_info "-------------------Completed $TESTNAME Testcase----------------------------"
180+
181+
case "$final_result" in
182+
PASS)
183+
log_pass "$final_message"
184+
;;
185+
SKIP)
186+
log_skip "$final_message"
187+
;;
188+
*)
189+
log_fail "$final_message"
190+
;;
191+
esac
192+
193+
echo "$TESTNAME $final_result" > "$result_file"
194+
exit "$final_exit"

0 commit comments

Comments
 (0)