Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 29 additions & 7 deletions Runner/suites/Kernel/Baseport/watchdog/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,37 @@ log_info "----------------------------------------------------------------------
log_info "-------------------Starting $TESTNAME Testcase----------------------------"
log_info "=== Test Initialization ==="

soc_id=$(getsocId)

if [ $? -eq 0 ]; then
log_info "SOC ID is: $soc_id"
else
log_skip "Failed to retrieve SOC ID"
echo "$TESTNAME SKIP" > "$res_file"
exit 0
fi


if [ $soc_id = "498" ]; then
log_skip "Testcase not applicable to this target"
echo "$TESTNAME SKIP" > "$res_file"
exit 0
fi

if [ -e /dev/watchdog ]; then
log_pass "/dev/watchdog node is present."
CONFIGS="CONFIG_WATCHDOG CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED"
for cfg in $CONFIGS; do
log_info "Checking if $cfg is enabled"
if ! check_kernel_config "$cfg" 2>/dev/null; then
log_fail "$cfg is not enabled"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to log a message when checking the config, especially if it fails at that step. This will make it easier to debug failures in the CI environment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example logs of config failure
sh-5.1# ./run-test.sh watchdog
[Executing test case: watchdog] 2022-04-29 00:07:32 -
[INFO] 2022-04-29 00:07:32 - -----------------------------------------------------------------------------------------
[INFO] 2022-04-29 00:07:32 - -------------------Starting watchdog Testcase----------------------------
[INFO] 2022-04-29 00:07:32 - === Test Initialization ===
[INFO] 2022-04-29 00:07:33 - SOC ID is: 534
[PASS] 2022-04-29 00:07:33 - /dev/watchdog node is present.
[INFO] 2022-04-29 00:07:33 - Checking if CONFIG_WATCHDOG is enabled
[PASS] 2022-04-29 00:07:33 - Kernel config CONFIG_WATCHDOG is enabled
[INFO] 2022-04-29 00:07:33 - Checking if CONFIG_WATTTSAPP is enabled
[FAIL] 2022-04-29 00:07:33 - Kernel config CONFIG_WATTTSAPP is missing or not enabled
[FAIL] 2022-04-29 00:07:33 - CONFIG_WATTTSAPP is not enabled
[FAIL] 2022-04-29 00:07:33 - watchdog failed

[INFO] 2022-04-29 00:07:33 - ========== Test Summary ==========
PASSED:
None

FAILED:
watchdog

SKIPPED:
None
[INFO] 2022-04-29 00:07:33 - ==================================

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to dev node and kernel configuration checks, it would be beneficial to include some functional validation based on the type of build—whether it's a full build or a kernel-only build. For kernel builds, try opening and petting the watchdog, and for systemd-based builds, consider checking the system services.

echo "$TESTNAME FAIL" > "$res_file"
exit 1
fi
done
log_pass "$TESTNAME : Test Passed"
echo "$TESTNAME PASS" > "$res_file"
exit 0
else
log_fail "/dev/watchdog node is not present."
log_fail "$TESTNAME : Test Failed"
echo "$TESTNAME FAIL" > "$res_file"
exit 1
exit 0
fi
log_info "-------------------Completed $TESTNAME Testcase---------------------------"
echo "$TESTNAME FAIL" > "$res_file"
log_info "-------------------Completed $TESTNAME Testcase---------------------------"
22 changes: 22 additions & 0 deletions Runner/utils/functestlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1475,3 +1475,25 @@ scan_dmesg_errors() {
log_info "No $label-related errors found in recent dmesg logs."
fi
}

getsocId() {
for path in /sys/devices/soc0/soc_id /sys/devices/system/soc/soc0/id; do
if [ -r "$path" ]; then
read -r soc_id < "$path"
case "$soc_id" in
''|*[!0-9]*)
log_error "Invalid soc_id" >&2
return 1
;;
*)
echo "$soc_id"
return 0
;;
esac
fi
done

log_error "$soc_id path not found" >&2
return 1
}

Loading