|
42 | 42 | static bool dont_fork;
|
43 | 43 | /* Fork the tests in parallel and wait for their completion. */
|
44 | 44 | static bool sequential;
|
| 45 | +/* Number of times each test is run. */ |
| 46 | +static unsigned int runs_per_test = 1; |
45 | 47 | const char *dso_to_test;
|
46 | 48 | const char *test_objdump_path = "objdump";
|
47 | 49 |
|
@@ -485,7 +487,7 @@ static int __cmd_test(struct test_suite **suites, int argc, const char *argv[],
|
485 | 487 | len = strlen(test_description(*t, i));
|
486 | 488 | if (width < len)
|
487 | 489 | width = len;
|
488 |
| - num_tests++; |
| 490 | + num_tests += runs_per_test; |
489 | 491 | }
|
490 | 492 | }
|
491 | 493 | child_tests = calloc(num_tests, sizeof(*child_tests));
|
@@ -549,16 +551,18 @@ static int __cmd_test(struct test_suite **suites, int argc, const char *argv[],
|
549 | 551 | continue;
|
550 | 552 | }
|
551 | 553 |
|
552 |
| - test_suite__for_each_test_case(*t, curr_test_case) { |
553 |
| - if (!perf_test__matches(test_description(*t, curr_test_case), |
554 |
| - curr_suite, argc, argv)) |
555 |
| - continue; |
556 |
| - |
557 |
| - err = start_test(*t, curr_suite, curr_test_case, |
558 |
| - &child_tests[child_test_num++], |
559 |
| - width, pass); |
560 |
| - if (err) |
561 |
| - goto err_out; |
| 554 | + for (unsigned int run = 0; run < runs_per_test; run++) { |
| 555 | + test_suite__for_each_test_case(*t, curr_test_case) { |
| 556 | + if (!perf_test__matches(test_description(*t, curr_test_case), |
| 557 | + curr_suite, argc, argv)) |
| 558 | + continue; |
| 559 | + |
| 560 | + err = start_test(*t, curr_suite, curr_test_case, |
| 561 | + &child_tests[child_test_num++], |
| 562 | + width, pass); |
| 563 | + if (err) |
| 564 | + goto err_out; |
| 565 | + } |
562 | 566 | }
|
563 | 567 | }
|
564 | 568 | if (!sequential) {
|
@@ -698,6 +702,8 @@ int cmd_test(int argc, const char **argv)
|
698 | 702 | "Do not fork for testcase"),
|
699 | 703 | OPT_BOOLEAN('S', "sequential", &sequential,
|
700 | 704 | "Run the tests one after another rather than in parallel"),
|
| 705 | + OPT_UINTEGER('r', "runs-per-test", &runs_per_test, |
| 706 | + "Run each test the given number of times, default 1"), |
701 | 707 | OPT_STRING('w', "workload", &workload, "work", "workload to run for testing, use '--list-workloads' to list the available ones."),
|
702 | 708 | OPT_BOOLEAN(0, "list-workloads", &list_workloads, "List the available builtin workloads to use with -w/--workload"),
|
703 | 709 | OPT_STRING(0, "dso", &dso_to_test, "dso", "dso to test"),
|
|
0 commit comments