Lines Matching +full:overload +full:- +full:control
4 * SPDX-License-Identifier: Apache-2.0
12 #include <zephyr/sys/libc-hooks.h>
103 PRINT_DATA("Test %s failed: Unused mock parameter values\n", test->name); in cleanup_test()
106 PRINT_DATA("Test %s failed: Unused mock return values\n", test->name); in cleanup_test()
118 #define MAX_NUM_CPUHOLD (CONFIG_MP_MAX_NUM_CPUS - 1)
143 return -1; in find_unused_thread()
158 volatile void **shp = (void *)&thread->switch_handle; in wait_for_thread_to_switch_out()
165 * non-null. in wait_for_thread_to_switch_out()
174 * may need to control that configuration themselves. We do this at
190 __ASSERT_NO_MSG(i != -1); in cpu_hold()
200 * Busy-wait until we know the spawned thread is running to in cpu_hold()
233 * We'll be spinning with IRQs disabled. The flush-your-FPU request in cpu_hold()
238 k_float_disable(_current_cpu->arch.fpu_owner); in cpu_hold()
246 * for long-running test cases tends to overload the CI system in cpu_hold()
250 dt = k_uptime_get_32() - start_ms; in cpu_hold()
266 /* Spawn N-1 threads to "hold" the other CPUs, waiting for in z_impl_z_test_1cpu_start()
269 for (int i = 0; i < num_cpus - 1; i++) { in z_impl_z_test_1cpu_start()
272 __ASSERT_NO_MSG(j != -1); in z_impl_z_test_1cpu_start()
316 if (is_before && rule->before_each) { in run_test_rules()
317 rule->before_each(test, data); in run_test_rules()
318 } else if (!is_before && rule->after_each) { in run_test_rules()
319 rule->after_each(test, data); in run_test_rules()
328 test->test(data); in run_test_functions()
335 enum ztest_expected_result expected_result = -1; in get_final_test_result()
340 if (strcmp(expectation->test_name, test->name) == 0 && in get_final_test_result()
341 strcmp(expectation->test_suite_name, test->test_suite_name) == 0) { in get_final_test_result()
342 expected_result = expectation->expected_result; in get_final_test_result()
349 * - If we got a failure, return TC_PASS in get_final_test_result()
350 * - Otherwise force a failure in get_final_test_result()
356 * - If we got a skip, return TC_PASS in get_final_test_result()
357 * - Otherwise force a failure in get_final_test_result()
408 #include <setjmp.h> /* parasoft-suppress MISRAC2012-RULE_21_4-a MISRAC2012-RULE_21_4-b*/
492 TC_START(test->name); in run_test()
516 if (suite->before) { in run_test()
517 suite->before(data); in run_test()
528 if (suite->after != NULL) { in run_test()
529 suite->after(data); in run_test()
537 Z_TC_END_RESULT(ret, test->name); in run_test()
650 const bool config_user_mode = FIELD_GET(K_USER, test->thread_options) != 0; in test_cb()
655 if (suite->before) { in test_cb()
656 suite->before(/*data=*/c); in test_cb()
673 TC_START(test->name); in run_test()
686 k_thread_access_grant(&ztest_thread, suite, test, suite->stats); in run_test()
687 if (test->name != NULL) { in run_test()
688 k_thread_name_set(&ztest_thread, test->name); in run_test()
701 if (suite->before) { in run_test()
702 suite->before(data); in run_test()
708 if (suite->after != NULL) { in run_test()
709 suite->after(data); in run_test()
714 if (tc_spend_time > test->stats->duration_worst_ms) { in run_test()
715 test->stats->duration_worst_ms = tc_spend_time; in run_test()
739 Z_TC_END_RESULT(ret, test->name); in run_test()
754 if (strcmp(name, node->name) == 0) { in ztest_find_test_suite()
767 if (strcmp(suite, test->test_suite_name) == 0) { in z_ztest_get_next_test()
786 for (size_t i = num_items - 1; i > 0; i--) { in z_ztest_shuffle()
813 return -1; in z_ztest_run_test_suite_ptr()
827 TC_SUITE_START(suite->name); in z_ztest_run_test_suite_ptr()
836 if (test_result != ZTEST_RESULT_SUITE_FAIL && suite->setup != NULL) { in z_ztest_run_test_suite_ptr()
837 data = suite->setup(); in z_ztest_run_test_suite_ptr()
854 if (strcmp(suite->name, test->test_suite_name) != 0) { in z_ztest_run_test_suite_ptr()
857 if (ztest_api.should_test_run(suite->name, test->name)) { in z_ztest_run_test_suite_ptr()
858 test->stats->run_count++; in z_ztest_run_test_suite_ptr()
861 test->stats->pass_count++; in z_ztest_run_test_suite_ptr()
863 test->stats->skip_count++; in z_ztest_run_test_suite_ptr()
865 test->stats->fail_count++; in z_ztest_run_test_suite_ptr()
877 while (((test = z_ztest_get_next_test(suite->name, test)) != NULL)) { in z_ztest_run_test_suite_ptr()
878 if (ztest_api.should_test_run(suite->name, test->name)) { in z_ztest_run_test_suite_ptr()
879 test->stats->run_count++; in z_ztest_run_test_suite_ptr()
882 test->stats->pass_count++; in z_ztest_run_test_suite_ptr()
884 test->stats->skip_count++; in z_ztest_run_test_suite_ptr()
886 test->stats->fail_count++; in z_ztest_run_test_suite_ptr()
904 TC_SUITE_END(suite->name, (fail > 0 ? TC_FAIL : TC_PASS)); in z_ztest_run_test_suite_ptr()
906 if (suite->teardown != NULL) { in z_ztest_run_test_suite_ptr()
907 suite->teardown(data); in z_ztest_run_test_suite_ptr()
928 while (((test = z_ztest_get_next_test(suite->name, test)) != NULL)) { in __ztest_init_unit_test_result_for_suite()
929 test->stats->run_count = 0; in __ztest_init_unit_test_result_for_suite()
930 test->stats->skip_count = 0; in __ztest_init_unit_test_result_for_suite()
931 test->stats->fail_count = 0; in __ztest_init_unit_test_result_for_suite()
932 test->stats->pass_count = 0; in __ztest_init_unit_test_result_for_suite()
933 test->stats->duration_worst_ms = 0; in __ztest_init_unit_test_result_for_suite()
964 while (((test = z_ztest_get_next_test(suite->name, test)) != NULL)) { in __ztest_show_suite_summary_oneline()
966 suite_duration_worst_ms += test->stats->duration_worst_ms; in __ztest_show_suite_summary_oneline()
967 if (test->stats->skip_count == test->stats->run_count) { in __ztest_show_suite_summary_oneline()
969 } else if (test->stats->pass_count == test->stats->run_count) { in __ztest_show_suite_summary_oneline()
981 effective_total = distinct_total - distinct_skip; in __ztest_show_suite_summary_oneline()
985 passrate_minor = (expanded_passrate - passrate_major * 1000) / 10; in __ztest_show_suite_summary_oneline()
986 passrate_tail = expanded_passrate - passrate_major * 1000 - passrate_minor * 10; in __ztest_show_suite_summary_oneline()
992 TC_SUMMARY_PRINT("SUITE %s - %3d.%02d%% [%s]: pass = %d, fail = %d, " in __ztest_show_suite_summary_oneline()
995 suite->name, distinct_pass, distinct_fail, distinct_skip, distinct_total, in __ztest_show_suite_summary_oneline()
1010 while (((test = z_ztest_get_next_test(suite->name, test)) != NULL)) { in __ztest_show_suite_summary_verbose()
1011 if (test->stats->skip_count == test->stats->run_count) { in __ztest_show_suite_summary_verbose()
1013 } else if (test->stats->pass_count == test->stats->run_count) { in __ztest_show_suite_summary_verbose()
1015 } else if (test->stats->pass_count == 0) { in __ztest_show_suite_summary_verbose()
1023 " - %s - [%s.%s] - (Failed %d of %d attempts)" in __ztest_show_suite_summary_verbose()
1024 " - duration = %u.%03u seconds\n", in __ztest_show_suite_summary_verbose()
1025 TC_RESULT_TO_STR(tc_result), test->test_suite_name, test->name, in __ztest_show_suite_summary_verbose()
1026 test->stats->run_count - test->stats->pass_count, in __ztest_show_suite_summary_verbose()
1027 test->stats->run_count, test->stats->duration_worst_ms / 1000, in __ztest_show_suite_summary_verbose()
1028 test->stats->duration_worst_ms % 1000); in __ztest_show_suite_summary_verbose()
1030 TC_SUMMARY_PRINT(" - %s - [%s.%s] duration = %u.%03u seconds\n", in __ztest_show_suite_summary_verbose()
1031 TC_RESULT_TO_STR(tc_result), test->test_suite_name, in __ztest_show_suite_summary_verbose()
1032 test->name, test->stats->duration_worst_ms / 1000, in __ztest_show_suite_summary_verbose()
1033 test->stats->duration_worst_ms % 1000); in __ztest_show_suite_summary_verbose()
1055 TC_SUMMARY_PRINT("\n------ TESTSUITE SUMMARY START ------\n\n"); in __ztest_show_suite_summary()
1063 TC_SUMMARY_PRINT("------ TESTSUITE SUMMARY END ------\n\n"); in __ztest_show_suite_summary()
1070 struct ztest_suite_stats *stats = ptr->stats; in __ztest_run_test_suite()
1079 stats->run_count++; in __ztest_run_test_suite()
1080 stats->fail_count += (fail != 0) ? 1 : 0; in __ztest_run_test_suite()
1082 stats->skip_count++; in __ztest_run_test_suite()
1172 if (suite->stats->run_count < 1) { in ztest_verify_all_test_suites_ran()
1173 PRINT_DATA("ERROR: Test suite '%s' did not run.\n", suite->name); in ztest_verify_all_test_suites_ran()
1179 suite = ztest_find_test_suite(test->test_suite_name); in ztest_verify_all_test_suites_ran()
1184 test->name, test->test_suite_name); in ztest_verify_all_test_suites_ran()
1195 if (test->stats->fail_count + test->stats->pass_count + test->stats->skip_count != in ztest_verify_all_test_suites_ran()
1196 test->stats->run_count) { in ztest_verify_all_test_suites_ran()
1197 PRINT_DATA("Bad stats for %s.%s\n", test->test_suite_name, test->name); in ztest_verify_all_test_suites_ran()
1248 shell_print(sh, "%s", suite->name); in cmd_list_suites()
1261 while ((test = z_ztest_get_next_test(ptr->name, test)) != NULL) { in cmd_list_cases()
1262 shell_print(sh, "%s::%s", test->test_suite_name, test->name); in cmd_list_cases()
1295 while ((opt = getopt_long(argc, argv, "s:c:", long_options, &opt_index)) != -1) { in cmd_shuffle()
1299 val = atoi(state->optarg); in cmd_shuffle()
1302 return -ENOEXEC; in cmd_shuffle()
1308 val = atoi(state->optarg); in cmd_shuffle()
1311 return -ENOEXEC; in cmd_shuffle()
1319 return -ENOEXEC; in cmd_shuffle()
1341 while ((opt = getopt_long(argc, argv, "r:p:", long_options, &opt_index)) != -1) { in cmd_run_suite()
1345 val = atoi(state->optarg); in cmd_run_suite()
1349 return -ENOEXEC; in cmd_run_suite()
1355 param = state->optarg; in cmd_run_suite()
1361 return -ENOEXEC; in cmd_run_suite()
1382 if (strcmp(shell_command, "run-testcase") == 0) { in cmd_run_suite()
1384 } else if (strcmp(shell_command, "run-testsuite") == 0) { in cmd_run_suite()
1402 return _ztest_suite_node_list_end - _ztest_suite_node_list_start; in testsuite_get_all_static()
1413 if ((suite->name != NULL) && (strlen(suite->name) != 0) && in suite_lookup()
1414 ((prefix == NULL) || (strncmp(prefix, suite->name, strlen(prefix)) == 0))) { in suite_lookup()
1430 entry->syntax = (suite != NULL) ? suite->name : NULL; in testsuite_list_get()
1431 entry->handler = NULL; in testsuite_list_get()
1432 entry->help = NULL; in testsuite_list_get()
1433 entry->subcmd = NULL; in testsuite_list_get()
1436 /* clang-format off */
1439 SHELL_CMD_ARG(run-all, NULL, "Run all tests", cmd_runall, 0, 0),
1444 SHELL_CMD_ARG(list-testsuites, NULL,
1446 SHELL_CMD_ARG(list-testcases, NULL,
1448 SHELL_CMD_ARG(run-testsuite, &testsuite_names,
1450 SHELL_CMD_ARG(run-testcase, NULL, "Run testcase", cmd_run_suite, 2, 2),
1453 /* clang-format on */