Lines Matching +full:non +full:- +full:exclusive

1 // SPDX-License-Identifier: GPL-2.0
3 * builtin-test.c
25 #include <subcmd/parse-options.h>
26 #include <subcmd/run-command.h>
33 #include <subcmd/exec-cmd.h>
36 #include "tests-scripts.h"
155 for (idx = 0; (suite)->test_cases && (suite)->test_cases[idx].name != NULL; idx++)
168 if (!t->test_cases) in skip_reason()
171 return t->test_cases[test_case >= 0 ? test_case : 0].skip_reason; in skip_reason()
176 if (t->test_cases && test_case >= 0) in test_description()
177 return t->test_cases[test_case].desc; in test_description()
179 return t->desc; in test_description()
185 return t->test_cases[0].run_case; in test_function()
187 return t->test_cases[test_case].run_case; in test_function()
193 return t->test_cases[0].exclusive; in test_exclusive()
195 return t->test_cases[test_case].exclusive; in test_exclusive()
246 fprintf(stderr, "\n---- unexpected signal (%d) ----\n", err); in run_test_child()
247 err = err > 0 ? -err : -1; in run_test_child()
254 pr_debug("--- start ---\n"); in run_test_child()
256 err = test_function(child->test, child->test_case_num)(child->test, child->test_case_num); in run_test_child()
257 pr_debug("---- end(%d) ----\n", err); in run_test_child()
263 return -err; in run_test_child()
266 #define TEST_RUNNING -3
272 int subw = width > 2 ? width - 2 : width; in print_test_result()
274 pr_info("%3d.%1d: %-*s:", curr_suite + 1, curr_test_case + 1, subw, in print_test_result()
277 pr_info("%3d: %-*s:", curr_suite + 1, width, test_description(t, curr_test_case)); in print_test_result()
312 int last_running = -1; in finish_test()
319 t = child_test->test; in finish_test()
320 curr_suite = child_test->suite_num; in finish_test()
321 curr_test_case = child_test->test_case_num; in finish_test()
322 err = child_test->process.err; in finish_test()
328 pr_info("%3d: %-*s:\n", curr_suite + 1, width, test_description(t, -1)); in finish_test()
332 * non-blocking until EOF. in finish_test()
341 pr_info("%3d: %s:\n", curr_suite + 1, test_description(t, -1)); in finish_test()
355 if (check_if_command_finished(&child_tests[y]->process) == 0) in finish_test()
359 if (last_running != -1) { in finish_test()
383 len = read(err, buf, sizeof(buf) - 1); in finish_test()
393 err_done = check_if_command_finished(&child_test->process); in finish_test()
395 if (perf_use_color_default && last_running != -1) { in finish_test()
400 ret = finish_command(&child_test->process); in finish_test()
419 pr_debug("--- start ---\n"); in start_test()
421 pr_debug("---- end ----\n"); in start_test()
428 /* When parallel, skip exclusive tests on the first pass. */ in start_test()
432 /* Sequential and non-exclusive tests were run on the first pass. */ in start_test()
437 return -ENOMEM; in start_test()
439 (*child)->test = test; in start_test()
440 (*child)->suite_num = curr_suite; in start_test()
441 (*child)->test_case_num = curr_test_case; in start_test()
442 (*child)->process.pid = -1; in start_test()
443 (*child)->process.no_stdin = 1; in start_test()
445 (*child)->process.no_stdout = 1; in start_test()
446 (*child)->process.no_stderr = 1; in start_test()
448 (*child)->process.stdout_to_stderr = 1; in start_test()
449 (*child)->process.out = -1; in start_test()
450 (*child)->process.err = -1; in start_test()
452 (*child)->process.no_exec_cmd = run_test_child; in start_test()
454 err = start_command(&(*child)->process); in start_test()
460 return start_command(&(*child)->process); in start_test()
481 int i, len = strlen(test_description(*t, -1)); in __cmd_test()
495 return -ENOMEM; in __cmd_test()
504 if (!child_test || child_test->process.pid <= 0) in __cmd_test()
508 child_test->suite_num + 1, in __cmd_test()
509 child_test->process.pid); in __cmd_test()
510 kill(child_test->process.pid, err); in __cmd_test()
518 * In parallel mode pass 1 runs non-exclusive tests in parallel, pass 2 in __cmd_test()
519 * runs the exclusive tests sequentially. In other modes all tests are in __cmd_test()
529 if (!perf_test__matches(test_description(*t, -1), curr_suite, argc, argv)) { in __cmd_test()
548 pr_info("%3d: %-*s:", curr_suite + 1, width, in __cmd_test()
549 test_description(*t, -1)); in __cmd_test()
593 if (!perf_test__matches(test_description(*t, -1), curr_suite, argc, argv)) in perf_test__list()
596 fprintf(fp, "%3d: %s\n", curr_suite + 1, test_description(*t, -1)); in perf_test__list()
615 printed += fprintf(fp, "%s\n", twl->name); in workloads__fprintf_list()
625 if (!strcmp(twl->name, work)) in run_workload()
626 return twl->func(argc, argv); in run_workload()
630 return -1; in run_workload()
671 bool exclusive = false; in build_suites() local
676 exclusive = true; in build_suites()
680 if ((!exclusive && pass == 1) || (exclusive && pass == 2)) in build_suites()
691 "perf test [<options>] [{list <test-name-fragment>|[<test-name-fragments>|<test-numbers>]}]", in cmd_test()
701 OPT_BOOLEAN('F', "dont-fork", &dont_fork, in cmd_test()
705 OPT_UINTEGER('r', "runs-per-test", &runs_per_test, in cmd_test()
707 …OPT_STRING('w', "workload", &workload, "work", "workload to run for testing, use '--list-workloads… in cmd_test()
708 …OPT_BOOLEAN(0, "list-workloads", &list_workloads, "List the available builtin workloads to use wit… in cmd_test()
730 ret = perf_test__list(stdout, suites, argc - 1, argv + 1); in cmd_test()
751 return -1; in cmd_test()