diff --git a/Runner/suites/Kernel/Baseport/watchdog/run.sh b/Runner/suites/Kernel/Baseport/watchdog/run.sh index 2f8b46ea..ddd47e49 100755 --- a/Runner/suites/Kernel/Baseport/watchdog/run.sh +++ b/Runner/suites/Kernel/Baseport/watchdog/run.sh @@ -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" + 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---------------------------" \ No newline at end of file diff --git a/Runner/utils/functestlib.sh b/Runner/utils/functestlib.sh index 79a52983..95df2f41 100755 --- a/Runner/utils/functestlib.sh +++ b/Runner/utils/functestlib.sh @@ -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 +} +