diff --git a/val/include/val_status.h b/val/include/val_status.h index 503f276d..48111def 100644 --- a/val/include/val_status.h +++ b/val/include/val_status.h @@ -103,6 +103,7 @@ void val_data_cache_ops_by_va(addr_t addr, uint32_t type); void val_set_status(uint32_t index, uint32_t status); uint32_t val_get_status(uint32_t index); void test_report_status(uint32_t status); +void val_report_subtest(uint32_t status); #endif /* VAL_STATUS_H */ diff --git a/val/src/acs_exerciser.c b/val/src/acs_exerciser.c index 7ab33e23..461bb026 100644 --- a/val/src/acs_exerciser.c +++ b/val/src/acs_exerciser.c @@ -511,18 +511,22 @@ val_exerciser_get_init_result(const char8_t *rule_id) #ifndef COMPILE_RB_EXE return RESULT_PASS; #else + uint32_t status = g_exerciser_init_result; + /* Surface the cached warning for each caller when no exerciser is present. */ - if (GET_STATE(g_exerciser_init_result) == TEST_WARNING) { + if (GET_STATE(status) == TEST_WARNING) { if (rule_is_conditional(rule_id)) { - return RESULT_SKIP(0); + status = RESULT_SKIP(0); + } else { + val_print(WARN, + "\n This test requires PCIe exerciser."); + val_print(WARN, + "\n Please rerun with a supported exerciser device"); + val_print(WARN, + "\n or conduct manual review."); } - val_print(WARN, - "\n This test requires PCIe exerciser."); - val_print(WARN, - "\n Please rerun with a supported exerciser device"); - val_print(WARN, - "\n or conduct manual review."); } - return g_exerciser_init_result; + val_report_subtest(status); + return status; #endif } diff --git a/val/src/acs_test_infra.c b/val/src/acs_test_infra.c index 3b8393c0..d66523a4 100644 --- a/val/src/acs_test_infra.c +++ b/val/src/acs_test_infra.c @@ -25,6 +25,39 @@ uint32_t g_override_skip; static acs_test_status_counters_t g_rule_test_stats; +#ifdef COMPILE_RB_EXE +static char8_t *g_current_test_desc; +static uint32_t g_current_test_num; +static bool g_current_test_reported; +bool g_print_subtests; +#endif + +/** + @brief Print the current subtest result once when rule-based subtest reporting is enabled. + 1. Caller - val_check_for_error, val_exerciser_get_init_result + 2. Prerequisite - val_initialize_test + + @param status Encoded test result + + @return None + **/ +void +val_report_subtest(uint32_t status) +{ +#ifdef COMPILE_RB_EXE + if (!g_print_subtests || g_current_test_reported) + return; + + val_print(INFO, "\n Test %4d : ", g_current_test_num); + val_print(INFO, g_current_test_desc); + val_print(INFO, " : "); + test_report_status(status); + g_current_test_reported = true; +#else + (void)status; +#endif +} + /** @brief Print standardized log context prefix. 1. Caller - Application/VAL layers @@ -450,9 +483,13 @@ uint32_t val_initialize_test(uint32_t test_num, char8_t *desc, uint32_t num_pe) { uint32_t i; - (void)desc; (void)num_pe; + /* Retain internal test details for rule-level subtest reporting. */ + g_current_test_desc = desc; + g_current_test_num = test_num; + g_current_test_reported = false; + /* Set TEST_PENDING_VAL status for all PEs, hint for val_wait_for_test_completion */ for (i = 0; i < num_pe; i++) val_set_status(i, RESULT_PENDING(test_num)); @@ -747,6 +784,7 @@ val_check_for_error(uint32_t test_num, uint32_t num_pe, char8_t *ruleid) uint32_t overall_status; uint32_t status = RESULT_FAIL(0); uint32_t my_index = val_pe_get_primary_index(); + uint8_t state; if (num_pe == 1) { status = val_get_status(my_index); @@ -767,11 +805,15 @@ val_check_for_error(uint32_t test_num, uint32_t num_pe, char8_t *ruleid) } checkpoint = (uint32_t)GET_CODE(overall_status); - if (GET_STATE(overall_status) == TEST_FAIL) { + state = GET_STATE(overall_status); + + val_report_subtest(overall_status); + + if (state == TEST_FAIL) { val_print(ERROR, "\nFailed at checkpoint - %2d", checkpoint); - } else if (GET_STATE(overall_status) == TEST_SKIP) { + } else if (state == TEST_SKIP) { val_print(ERROR, "\nSkipped at checkpoint - %2d", checkpoint); - } else if (GET_STATE(overall_status) == TEST_WARNING) { + } else if (state == TEST_WARNING) { val_print(WARN, "\ncheckpoint - %2d", checkpoint); } diff --git a/val/src/test_wrappers.c b/val/src/test_wrappers.c index b6165dc2..d3623792 100644 --- a/val/src/test_wrappers.c +++ b/val/src/test_wrappers.c @@ -31,6 +31,7 @@ #include "rule_based_execution.h" extern test_entry_fn_t test_entry_func_table[TEST_ENTRY_SENTINEL]; +extern bool g_print_subtests; /* Helper to execute test entries */ static uint32_t run_test_entries(TEST_ENTRY_ID_e *tst_entry_list, uint32_t num_pe) @@ -41,7 +42,9 @@ static uint32_t run_test_entries(TEST_ENTRY_ID_e *tst_entry_list, uint32_t num_p bool test_pass_flag = 0; bool test_ns_flag = 0; bool test_warn_flag = 0; + bool previous_print_subtests = g_print_subtests; + g_print_subtests = true; for (i = 0; tst_entry_list[i] != TEST_ENTRY_SENTINEL ; i++) { if (test_entry_func_table[tst_entry_list[i]] != NULL) { @@ -67,6 +70,8 @@ static uint32_t run_test_entries(TEST_ENTRY_ID_e *tst_entry_list, uint32_t num_p } } + g_print_subtests = previous_print_subtests; + /* Mixed PASS+SKIP/WARN or PASS+unsupported entry should be reported as partial coverage rather than worst-case max. */ if ((test_pass_flag &&