From nobody Sat Feb 7 08:02:13 2026 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8628C18A6AB for ; Thu, 9 Jan 2025 18:40:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736448054; cv=none; b=jSeKmV0RFq9kkHYFbdcR7ER4IaxzlVhrJxKlXTb2gxLAqoIyUDRooJuIiQu2uFI43mzXl3yLkoOGL6GiFtTN955NpfGMb6wR3YKgYV6cjmv7Pj57/vvW97lHU7PFbOsQaZU9HB5QsiPF1iRqWJMVapt3ZeJ/0tHGGRlNYnCSO0A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736448054; c=relaxed/simple; bh=oe8jug5TfATH6UqI+SDmWJVfhN4/Z1/tSDQisOCdIus=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=lkYTiFAihJjTbpmjAqVny7WFOLtzqWIk12Hn19h8VzZo8KzAcHAICmOtdSwJdJbMWDOWK1rA9A8E+0nK8au5EOaglb56OPzD7CO/u++dJ30r71/FR/fPEurK0x53Q95g1+03nWKlE/dIWNH4JGNFOKbuNwqQ4kE68Z+ZD+3qmJc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=pFABiYZD; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="pFABiYZD" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e3fea893dc5so5677832276.1 for ; Thu, 09 Jan 2025 10:40:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1736448051; x=1737052851; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=rt3FANMhbwUxwhbrCeMm//1cFuRBbV1k6BaJKVQj2ZQ=; b=pFABiYZDdJk918INbKyWTu4V5c+DvS4cigTEab4II54v52IFTIkTccJiLQJSxnL8sD n2N6vMrGr6LNm6lFiTCxOW+d9FB52Cz7c0YULsYdiXms2aQV0NMuqLUYWiMvvndhi8JF UGSllrWPYltaye7foYmU6pwQ8fJW4oUVyz/T0IQv+u3q8hiL/NnLMuB928xslkCTSDez Ev3gHQzrhR+hQ7IuYBeV87zJQEfhXLarxvbNRUUij0m2EsycGracYgDdLdB/kThshzB0 pZ4xECvPL+ExC1C5wWgobIA6EAeIJeaDgNAK/wrHSFgH8yNbE4//e6aC1++hyYN8qS/f a7qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736448051; x=1737052851; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rt3FANMhbwUxwhbrCeMm//1cFuRBbV1k6BaJKVQj2ZQ=; b=t7+PDv7y4PN1v3BoJqUggLd5TZdT4tha/7c81UuMIMMW8AGlSPzCFE8WjK/z9pzzA8 k4GbaCztI3Ffwun8y6bRa0tEHTSpOmUl/yOw6fTacDLKc+/YjUbDJxuhTXMJiEY6QntI HNtRUiLdTARBzX875HrV+R0F9WVaEvfDRO+kY7KwJr8GwvokMpaAA8C3uAi5l0RFXx3b 6snZ64FMh5RQafOjPYS90DLYAoABRAx7YN93lAUILHSr81r2ftNW7QkwWnwk1Lj6RF+q /lGFY+rDEEtLinXA/Hp2mtN6wxVLVkZogBCcsaMkrWASDfOd2cf9XCNq+AO1XOfpYT+2 hAAg== X-Forwarded-Encrypted: i=1; AJvYcCV3pbonKKzh+HsVLp7f1zByT+c7cng1PI8YyEeItAUf7kGw8AwmhzxX1IxjvvroVA6m0YXEuN/b+l2xk1Q=@vger.kernel.org X-Gm-Message-State: AOJu0Yy21I/YjfTUvJId2Ws1/4LPl4noxyKhF0i5QSgphH05153kX4uS /eiVF9mL4Ya8N3YoRF6nzlPBVqTr8+Y3tUcJR5FRuyGBC9FjGubJ2frI154ZLRl+UbV49mtJovp C3JWDRQ== X-Google-Smtp-Source: AGHT+IH9UgRU4CWMXTaZxquWuFp+sw1dty/9wjdv4pye804lLFn0wbP4mpAGQoDdB8NGQA76faifi5HdBglV X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:7ea3:d1e5:495a:9a4f]) (user=irogers job=sendgmr) by 2002:a25:20c2:0:b0:e4d:c8d5:81ef with SMTP id 3f1490d57ef6-e550136cda0mr16901276.0.1736448051590; Thu, 09 Jan 2025 10:40:51 -0800 (PST) Date: Thu, 9 Jan 2025 10:40:42 -0800 In-Reply-To: <20250109184046.193736-1-irogers@google.com> Message-Id: <20250109184046.193736-2-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250109184046.193736-1-irogers@google.com> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog Subject: [PATCH v3 1/5] perf test: Rename functions and variables for better clarity From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , James Clark , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The relationship between subtests and test cases is somewhat confusing, so let's do away with the notion of sub-tests and switch to just working with some number of test cases. Add a test_suite__for_each_test_case as in many cases, except the special one test case situation, the iteration can just be on all test cases. Switch variable names to be more intention revealing of what their value is. This work was motivated by discussion with Kan where it was noted the code is becoming overly indented: https://lore.kernel.org/lkml/20241109160219.49976-1-irogers@google.com/ Unifying more of the sub-test/no-sub-tests avoids one level of indentation in a number of places. Signed-off-by: Ian Rogers --- tools/perf/tests/builtin-test.c | 201 +++++++++++++++----------------- 1 file changed, 93 insertions(+), 108 deletions(-) diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-tes= t.c index a5b9ccd0033a..c3e082efb7f4 100644 --- a/tools/perf/tests/builtin-test.c +++ b/tools/perf/tests/builtin-test.c @@ -149,58 +149,51 @@ static struct test_workload *workloads[] =3D { #define workloads__for_each(workload) \ for (unsigned i =3D 0; i < ARRAY_SIZE(workloads) && ({ workload =3D workl= oads[i]; 1; }); i++) =20 -static int num_subtests(const struct test_suite *t) +#define test_suite__for_each_test_case(suite, idx) \ + for (idx =3D 0; (suite)->test_cases && (suite)->test_cases[idx].name !=3D= NULL; idx++) + +static int test_suite__num_test_cases(const struct test_suite *t) { int num; =20 - if (!t->test_cases) - return 0; - - num =3D 0; - while (t->test_cases[num].name) - num++; + test_suite__for_each_test_case(t, num); =20 return num; } =20 -static bool has_subtests(const struct test_suite *t) -{ - return num_subtests(t) > 1; -} - -static const char *skip_reason(const struct test_suite *t, int subtest) +static const char *skip_reason(const struct test_suite *t, int test_case) { if (!t->test_cases) return NULL; =20 - return t->test_cases[subtest >=3D 0 ? subtest : 0].skip_reason; + return t->test_cases[test_case >=3D 0 ? test_case : 0].skip_reason; } =20 -static const char *test_description(const struct test_suite *t, int subtes= t) +static const char *test_description(const struct test_suite *t, int test_c= ase) { - if (t->test_cases && subtest >=3D 0) - return t->test_cases[subtest].desc; + if (t->test_cases && test_case >=3D 0) + return t->test_cases[test_case].desc; =20 return t->desc; } =20 -static test_fnptr test_function(const struct test_suite *t, int subtest) +static test_fnptr test_function(const struct test_suite *t, int test_case) { - if (subtest <=3D 0) + if (test_case <=3D 0) return t->test_cases[0].run_case; =20 - return t->test_cases[subtest].run_case; + return t->test_cases[test_case].run_case; } =20 -static bool test_exclusive(const struct test_suite *t, int subtest) +static bool test_exclusive(const struct test_suite *t, int test_case) { - if (subtest <=3D 0) + if (test_case <=3D 0) return t->test_cases[0].exclusive; =20 - return t->test_cases[subtest].exclusive; + return t->test_cases[test_case].exclusive; } =20 -static bool perf_test__matches(const char *desc, int curr, int argc, const= char *argv[]) +static bool perf_test__matches(const char *desc, int suite_num, int argc, = const char *argv[]) { int i; =20 @@ -212,7 +205,7 @@ static bool perf_test__matches(const char *desc, int cu= rr, int argc, const char long nr =3D strtoul(argv[i], &end, 10); =20 if (*end =3D=3D '\0') { - if (nr =3D=3D curr + 1) + if (nr =3D=3D suite_num + 1) return true; continue; } @@ -227,8 +220,8 @@ static bool perf_test__matches(const char *desc, int cu= rr, int argc, const char struct child_test { struct child_process process; struct test_suite *test; - int test_num; - int subtest; + int suite_num; + int test_case_num; }; =20 static jmp_buf run_test_jmp_buf; @@ -258,7 +251,7 @@ static int run_test_child(struct child_process *process) =20 pr_debug("--- start ---\n"); pr_debug("test child forked, pid %d\n", getpid()); - err =3D test_function(child->test, child->subtest)(child->test, child->su= btest); + err =3D test_function(child->test, child->test_case_num)(child->test, chi= ld->test_case_num); pr_debug("---- end(%d) ----\n", err); =20 err_out: @@ -270,15 +263,16 @@ static int run_test_child(struct child_process *proce= ss) =20 #define TEST_RUNNING -3 =20 -static int print_test_result(struct test_suite *t, int i, int subtest, int= result, int width, - int running) +static int print_test_result(struct test_suite *t, int curr_suite, int cur= r_test_case, + int result, int width, int running) { - if (has_subtests(t)) { + if (test_suite__num_test_cases(t) > 1) { int subw =3D width > 2 ? width - 2 : width; =20 - pr_info("%3d.%1d: %-*s:", i + 1, subtest + 1, subw, test_description(t, = subtest)); + pr_info("%3d.%1d: %-*s:", curr_suite + 1, curr_test_case + 1, subw, + test_description(t, curr_test_case)); } else - pr_info("%3d: %-*s:", i + 1, width, test_description(t, subtest)); + pr_info("%3d: %-*s:", curr_suite + 1, width, test_description(t, curr_te= st_case)); =20 switch (result) { case TEST_RUNNING: @@ -288,7 +282,7 @@ static int print_test_result(struct test_suite *t, int = i, int subtest, int resul pr_info(" Ok\n"); break; case TEST_SKIP: { - const char *reason =3D skip_reason(t, subtest); + const char *reason =3D skip_reason(t, curr_test_case); =20 if (reason) color_fprintf(stderr, PERF_COLOR_YELLOW, " Skip (%s)\n", reason); @@ -310,7 +304,7 @@ static void finish_test(struct child_test **child_tests= , int running_test, int c { struct child_test *child_test =3D child_tests[running_test]; struct test_suite *t; - int i, subi, err; + int curr_suite, curr_test_case, err; bool err_done =3D false; struct strbuf err_output =3D STRBUF_INIT; int last_running =3D -1; @@ -321,15 +315,15 @@ static void finish_test(struct child_test **child_tes= ts, int running_test, int c return; } t =3D child_test->test; - i =3D child_test->test_num; - subi =3D child_test->subtest; + curr_suite =3D child_test->suite_num; + curr_test_case =3D child_test->test_case_num; err =3D child_test->process.err; /* * For test suites with subtests, display the suite name ahead of the * sub test names. */ - if (has_subtests(t) && subi =3D=3D 0) - pr_info("%3d: %-*s:\n", i + 1, width, test_description(t, -1)); + if (test_suite__num_test_cases(t) > 1 && curr_test_case =3D=3D 0) + pr_info("%3d: %-*s:\n", curr_suite + 1, width, test_description(t, -1)); =20 /* * Busy loop reading from the child's stdout/stderr that are set to be @@ -338,10 +332,11 @@ static void finish_test(struct child_test **child_tes= ts, int running_test, int c if (err > 0) fcntl(err, F_SETFL, O_NONBLOCK); if (verbose > 1) { - if (has_subtests(t)) - pr_info("%3d.%1d: %s:\n", i + 1, subi + 1, test_description(t, subi)); + if (test_suite__num_test_cases(t) > 1) + pr_info("%3d.%1d: %s:\n", curr_suite + 1, curr_test_case + 1, + test_description(t, curr_test_case)); else - pr_info("%3d: %s:\n", i + 1, test_description(t, -1)); + pr_info("%3d: %s:\n", curr_suite + 1, test_description(t, -1)); } while (!err_done) { struct pollfd pfds[1] =3D { @@ -366,7 +361,8 @@ static void finish_test(struct child_test **child_tests= , int running_test, int c */ fprintf(debug_file(), PERF_COLOR_DELETE_LINE); } - print_test_result(t, i, subi, TEST_RUNNING, width, running); + print_test_result(t, curr_suite, curr_test_case, TEST_RUNNING, + width, running); last_running =3D running; } } @@ -404,14 +400,14 @@ static void finish_test(struct child_test **child_tes= ts, int running_test, int c fprintf(stderr, "%s", err_output.buf); =20 strbuf_release(&err_output); - print_test_result(t, i, subi, ret, width, /*running=3D*/0); + print_test_result(t, curr_suite, curr_test_case, ret, width, /*running=3D= */0); if (err > 0) close(err); zfree(&child_tests[running_test]); } =20 -static int start_test(struct test_suite *test, int i, int subi, struct chi= ld_test **child, - int width, int pass) +static int start_test(struct test_suite *test, int curr_suite, int curr_te= st_case, + struct child_test **child, int width, int pass) { int err; =20 @@ -419,17 +415,18 @@ static int start_test(struct test_suite *test, int i,= int subi, struct child_tes if (dont_fork) { if (pass =3D=3D 1) { pr_debug("--- start ---\n"); - err =3D test_function(test, subi)(test, subi); + err =3D test_function(test, curr_suite)(test, curr_test_case); pr_debug("---- end ----\n"); - print_test_result(test, i, subi, err, width, /*running=3D*/0); + print_test_result(test, curr_suite, curr_test_case, err, width, + /*running=3D*/0); } return 0; } - if (pass =3D=3D 1 && !sequential && test_exclusive(test, subi)) { + if (pass =3D=3D 1 && !sequential && test_exclusive(test, curr_test_case))= { /* When parallel, skip exclusive tests on the first pass. */ return 0; } - if (pass !=3D 1 && (sequential || !test_exclusive(test, subi))) { + if (pass !=3D 1 && (sequential || !test_exclusive(test, curr_test_case)))= { /* Sequential and non-exclusive tests were run on the first pass. */ return 0; } @@ -438,8 +435,8 @@ static int start_test(struct test_suite *test, int i, i= nt subi, struct child_tes return -ENOMEM; =20 (*child)->test =3D test; - (*child)->test_num =3D i; - (*child)->subtest =3D subi; + (*child)->suite_num =3D curr_suite; + (*child)->test_case_num =3D curr_test_case; (*child)->process.pid =3D -1; (*child)->process.no_stdin =3D 1; if (verbose <=3D 0) { @@ -479,19 +476,15 @@ static int __cmd_test(struct test_suite **suites, int= argc, const char *argv[], int err =3D 0; =20 for (struct test_suite **t =3D suites; *t; t++) { - int len =3D strlen(test_description(*t, -1)); + int i, len =3D strlen(test_description(*t, -1)); =20 if (width < len) width =3D len; =20 - if (has_subtests(*t)) { - for (int subi =3D 0, subn =3D num_subtests(*t); subi < subn; subi++) { - len =3D strlen(test_description(*t, subi)); - if (width < len) - width =3D len; - num_tests++; - } - } else { + test_suite__for_each_test_case(*t, i) { + len =3D strlen(test_description(*t, i)); + if (width < len) + width =3D len; num_tests++; } } @@ -510,7 +503,7 @@ static int __cmd_test(struct test_suite **suites, int a= rgc, const char *argv[], continue; =20 pr_debug3("Killing %d pid %d\n", - child_test->test_num + 1, + child_test->suite_num + 1, child_test->process.pid); kill(child_test->process.pid, err); } @@ -526,47 +519,43 @@ static int __cmd_test(struct test_suite **suites, int= argc, const char *argv[], */ for (int pass =3D 1; pass <=3D 2; pass++) { int child_test_num =3D 0; - int i =3D 0; + int curr_suite =3D 0; =20 - for (struct test_suite **t =3D suites; *t; t++) { - int curr =3D i++; + for (struct test_suite **t =3D suites; *t; t++, curr_suite++) { + int curr_test_case; =20 - if (!perf_test__matches(test_description(*t, -1), curr, argc, argv)) { + if (!perf_test__matches(test_description(*t, -1), curr_suite, argc, arg= v)) { /* * Test suite shouldn't be run based on - * description. See if subtest should. + * description. See if any test case should. */ bool skip =3D true; =20 - for (int subi =3D 0, subn =3D num_subtests(*t); subi < subn; subi++) { - if (perf_test__matches(test_description(*t, subi), - curr, argc, argv)) + test_suite__for_each_test_case(*t, curr_test_case) { + if (perf_test__matches(test_description(*t, curr_test_case), + curr_suite, argc, argv)) { skip =3D false; + break; + } } - if (skip) continue; } =20 - if (intlist__find(skiplist, i)) { - pr_info("%3d: %-*s:", curr + 1, width, test_description(*t, -1)); + if (intlist__find(skiplist, curr_suite + 1)) { + pr_info("%3d: %-*s:", curr_suite + 1, width, + test_description(*t, -1)); color_fprintf(stderr, PERF_COLOR_YELLOW, " Skip (user override)\n"); continue; } =20 - if (!has_subtests(*t)) { - err =3D start_test(*t, curr, -1, &child_tests[child_test_num++], - width, pass); - if (err) - goto err_out; - continue; - } - for (int subi =3D 0, subn =3D num_subtests(*t); subi < subn; subi++) { - if (!perf_test__matches(test_description(*t, subi), - curr, argc, argv)) + test_suite__for_each_test_case(*t, curr_test_case) { + if (!perf_test__matches(test_description(*t, curr_test_case), + curr_suite, argc, argv)) continue; =20 - err =3D start_test(*t, curr, subi, &child_tests[child_test_num++], + err =3D start_test(*t, curr_suite, curr_test_case, + &child_tests[child_test_num++], width, pass); if (err) goto err_out; @@ -592,23 +581,22 @@ static int __cmd_test(struct test_suite **suites, int= argc, const char *argv[], =20 static int perf_test__list(struct test_suite **suites, int argc, const cha= r **argv) { - int i =3D 0; + int curr_suite =3D 0; =20 - for (struct test_suite **t =3D suites; *t; t++) { - int curr =3D i++; + for (struct test_suite **t =3D suites; *t; t++, curr_suite++) { + int curr_test_case; =20 - if (!perf_test__matches(test_description(*t, -1), curr, argc, argv)) + if (!perf_test__matches(test_description(*t, -1), curr_suite, argc, argv= )) continue; =20 - pr_info("%3d: %s\n", i, test_description(*t, -1)); + pr_info("%3d: %s\n", curr_suite + 1, test_description(*t, -1)); =20 - if (has_subtests(*t)) { - int subn =3D num_subtests(*t); - int subi; + if (test_suite__num_test_cases(*t) <=3D 1) + continue; =20 - for (subi =3D 0; subi < subn; subi++) - pr_info("%3d:%1d: %s\n", i, subi + 1, - test_description(*t, subi)); + test_suite__for_each_test_case(*t, curr_test_case) { + pr_info("%3d:%1d: %s\n", curr_suite + 1, curr_test_case + 1, + test_description(*t, curr_test_case)); } } return 0; @@ -665,27 +653,24 @@ static struct test_suite **build_suites(void) if (suites[2] =3D=3D NULL) suites[2] =3D create_script_test_suites(); =20 -#define for_each_test(t) \ +#define for_each_suite(suite) \ for (size_t i =3D 0, j =3D 0; i < ARRAY_SIZE(suites); i++, j =3D 0) \ - while ((t =3D suites[i][j++]) !=3D NULL) + while ((suite =3D suites[i][j++]) !=3D NULL) =20 - for_each_test(t) + for_each_suite(t) num_suites++; =20 result =3D calloc(num_suites + 1, sizeof(struct test_suite *)); =20 for (int pass =3D 1; pass <=3D 2; pass++) { - for_each_test(t) { + for_each_suite(t) { bool exclusive =3D false; + int curr_test_case; =20 - if (!has_subtests(t)) { - exclusive =3D test_exclusive(t, -1); - } else { - for (int subi =3D 0, subn =3D num_subtests(t); subi < subn; subi++) { - if (test_exclusive(t, subi)) { - exclusive =3D true; - break; - } + test_suite__for_each_test_case(t, curr_test_case) { + if (test_exclusive(t, curr_test_case)) { + exclusive =3D true; + break; } } if ((!exclusive && pass =3D=3D 1) || (exclusive && pass =3D=3D 2)) @@ -693,7 +678,7 @@ static struct test_suite **build_suites(void) } } return result; -#undef for_each_test +#undef for_each_suite } =20 int cmd_test(int argc, const char **argv) --=20 2.47.1.613.gc27f4b7a9f-goog From nobody Sat Feb 7 08:02:13 2026 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED1841B0404 for ; Thu, 9 Jan 2025 18:40:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736448057; cv=none; b=jyLO15O+71Vz6UvYuMBvCFUnm7Y4jjzRIeVb0i48hENY6sai91g1rCiFvfefT3yIGcYRQi2U7BX3PmzeqIJiSj5thWw4nQDbQ5TTjfH072nssbEdZprz3TTHxuAeENOUeXFQVIwmtcvkU57/oX5oCut4NKWmvOkKDPIallArkYw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736448057; c=relaxed/simple; bh=SN+I17RDaZh8oc6X/iRBk7GMORcptVGS1eILZ2DUaL4=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=jVzYzZFNIxdlejHW3lJcZfODXq1hwnEgcd3QbhT5rJKYL5z6sndhjfogVpxHpI3VhYl/HD6zUahx3VWAY64Ltf4Y3Pl+Xk1s622wq3Fb1hcJVchr2yCrpHO0v60gkueSb6TTU4QQTyKpW/GZdD5Ku3odQFRfNWz01UewgO7CkfA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Z2cVfc6N; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Z2cVfc6N" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e535f2c8f7eso2984152276.3 for ; Thu, 09 Jan 2025 10:40:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1736448054; x=1737052854; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=ELN3tE1PcOELRVYFu0oyotf1UYI5umGCfo/xf2c5iT4=; b=Z2cVfc6NUU+Im2/2Jt8c3C0ZiVqRo1H/2FByvBoknztgU8Nr+XUfXFQyTDB6Vr63GB xvmw6BUwtxWQ0eV9jria/03yf5IJ58sb5Ch6Y0CA4UsKXzBJ8mlms2xKjdGa61SpHDs2 omUNLoIRbAqGJsZMIsgRaN7X3joEeMonBu5J9vp+8asIBoETQkqTq96Ggw0m68FmFOfc XtFoWUcqpmTYpysBF6grKhftgaFE3c5UMFx6bDerUrh5kGG6yj46pioUz/Tbzimjz7Wa CP04koBl4Y+h2woPMwA2X/rNeFiZLVDK7pqQbkMHvzqx4va9eGDHApOzg3SiyUaOC3in f5Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736448054; x=1737052854; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ELN3tE1PcOELRVYFu0oyotf1UYI5umGCfo/xf2c5iT4=; b=b1SDCOhvFRGFd5tLr2gmx7LmXwqsbgkbfDocxwxkSvaaXYZgCjukzV9ij+sFIrQvVr CK3c6so+DsCxr/64AbaJUpqPpjaztueLvDzM98zsppfH9UJY7OMrhlktY7paQoBALqxk NaLi8T+MMMyX/65eIOWOabmp40UKlHrn/ruZ8nsP6HIuNUU/tc61K4H30HOBkZS8xyq/ Ltt9nENgOroqL7coSQEwmHLYUi9/GuhyeD+GBbNVqgYDnpu9KRSuks4mN6nHzpzihMRw +Tw7DQkTGlBUI1LdZMZLetbcDBn8yA5mPEpFfxFNq5ClCdasasj50qWcHz1ff1mffnob kwgQ== X-Forwarded-Encrypted: i=1; AJvYcCUiZDHrrV13biUNxIJdnsi4/xIV9tPUjKo4rAp2Mk8zvj+WhibQzeMKl/2BrPOAmhyBG46gkQK1O/CVhzw=@vger.kernel.org X-Gm-Message-State: AOJu0YxVdP3CKXEW+VwPDUAYTxa7ZdYE4pgN7yznXm3mE+r4utqlCg/M ANe6pPwbf5Vo+iSfsFSw0r6HswDgf0nEWedWElN3Ry310mdqztR/vLzqjhHbVCvWxybBpDn/mc3 PQRKt2g== X-Google-Smtp-Source: AGHT+IHA3Dli0QE8tWCoJZww07Sv8vM+fS066RHw4aYQHAGR4xnxAi4KMPfcxw9tLH35+QPuZCDlJ9uW8tC6 X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:7ea3:d1e5:495a:9a4f]) (user=irogers job=sendgmr) by 2002:a25:361f:0:b0:e0e:8b26:484e with SMTP id 3f1490d57ef6-e54ee20cc49mr17600276.8.1736448053935; Thu, 09 Jan 2025 10:40:53 -0800 (PST) Date: Thu, 9 Jan 2025 10:40:43 -0800 In-Reply-To: <20250109184046.193736-1-irogers@google.com> Message-Id: <20250109184046.193736-3-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250109184046.193736-1-irogers@google.com> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog Subject: [PATCH v3 2/5] perf test: Send list output to stdout rather than stderr From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , James Clark , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Follow the workload listing in using stdout rather than stderr. Correct the numbering of sub-tests to be 1.1 rather than 1:1. Signed-off-by: Ian Rogers --- tools/perf/tests/builtin-test.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-tes= t.c index c3e082efb7f4..887f735da900 100644 --- a/tools/perf/tests/builtin-test.c +++ b/tools/perf/tests/builtin-test.c @@ -579,7 +579,7 @@ static int __cmd_test(struct test_suite **suites, int a= rgc, const char *argv[], return err; } =20 -static int perf_test__list(struct test_suite **suites, int argc, const cha= r **argv) +static int perf_test__list(FILE *fp, struct test_suite **suites, int argc,= const char **argv) { int curr_suite =3D 0; =20 @@ -589,13 +589,13 @@ static int perf_test__list(struct test_suite **suites= , int argc, const char **ar if (!perf_test__matches(test_description(*t, -1), curr_suite, argc, argv= )) continue; =20 - pr_info("%3d: %s\n", curr_suite + 1, test_description(*t, -1)); + fprintf(fp, "%3d: %s\n", curr_suite + 1, test_description(*t, -1)); =20 if (test_suite__num_test_cases(*t) <=3D 1) continue; =20 test_suite__for_each_test_case(*t, curr_test_case) { - pr_info("%3d:%1d: %s\n", curr_suite + 1, curr_test_case + 1, + fprintf(fp, "%3d.%1d: %s\n", curr_suite + 1, curr_test_case + 1, test_description(*t, curr_test_case)); } } @@ -721,7 +721,7 @@ int cmd_test(int argc, const char **argv) argc =3D parse_options_subcommand(argc, argv, test_options, test_subcomma= nds, test_usage, 0); if (argc >=3D 1 && !strcmp(argv[0], "list")) { suites =3D build_suites(); - ret =3D perf_test__list(suites, argc - 1, argv + 1); + ret =3D perf_test__list(stdout, suites, argc - 1, argv + 1); free(suites); return ret; } --=20 2.47.1.613.gc27f4b7a9f-goog From nobody Sat Feb 7 08:02:13 2026 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2218519E96B for ; Thu, 9 Jan 2025 18:40:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736448058; cv=none; b=O3rubWUDLyz3SF34O+dXzY+quuwjybau/HUMjwdeY4pt8YAXupqg4mdTTpcAFGNUZNLqxNoc2lFbCSgRTXurIW60AE6WkkNxFUJt1qs7Dss+tuRfOiZJh2U0dRv2wM2fiHay1GpCWAOchYgRDfldFQ0MgTH/tiZO2QJEq9tIAzs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736448058; c=relaxed/simple; bh=03zxN2UsxLOpbQk3XmD+PZeej4CtfK4bugESkK4+E9I=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=ZwGMfa2fyb0VVF30M1kdUz9xIG4jlmQZ8qsk1VwuwEvO1MmOtwbT+XXdgfSB0MVD2KqphE1FLacNck6oPS83oDBxjBoqkKri2L1yyfy+LatMUOlkf0cQbZtNkmrfKolaoPKRktzykWdACPQ4zKJGNS0o0i8Gm3Pk6hvePXIkKqU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=T7jBtivB; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="T7jBtivB" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e53bf9e60e4so2797690276.1 for ; Thu, 09 Jan 2025 10:40:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1736448056; x=1737052856; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=7FgaDCd82RhWxCDiAHRf7hDKnWcYPhRmEM5CI1fivqE=; b=T7jBtivBAwPo5/8MPRogPPuLKYenekjKGAUw+DN/xm3OcLqFG4RB66zs0DzvVIzJl+ 6BjRW5rktVO/zQiyIBQ64xhwufZIQcL5lnTTGadVkXtLH/uV5P0dlrW6f7RUtbRHM/84 z5SH28a8kC+6TnvylUdT0VPoMirh0/mLy95sXzjpbSOf9CCUd4hg2XCtZye/JtKxwcSX 5uCXbNsx9XXFNiradzNKtZUhT4zpbmiA+M6tui6gzcoFWl4do13K5LAydqb84tpf7ZQe 8+0XzuowMndFtAOKacS/BhCh8GtgFCBASJa/t/6s8fwb9+ranuZFXht98oiPbxOf7U46 /hoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736448056; x=1737052856; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7FgaDCd82RhWxCDiAHRf7hDKnWcYPhRmEM5CI1fivqE=; b=CsHb8FwIV1T2ifl3evCArRQtqov5K4v5+D4c/toPt59Ax3J0JOvk96pgp4BWEXq8yo diB9qy5ahZltzFXG478vU+w9HDpoO1VGXLU2PX8tiAJEzQg2rGViP9tdP7grV6i16hnX 5H55ljl28bjsBpiyfCTlezWbemSvbgx7yS456o/YyAG87AYI+GFrdFdNYZMYx0TFyt8b Lc6Q7hEJIPc80/GhSl97dv38KTpUaBpgyBJGAFEm/W8C20nQCDHQ9hyziG4BBE7RwJTo QzZgKxiC2ftM6hNBxzQpVdyw+P7WD/MSBluvNQ/Y8SlUmv6efmYHgT/MNxGWjOQxwcUg FSbg== X-Forwarded-Encrypted: i=1; AJvYcCXctMAN/5vpoWlFXsJjfaB0mz5qxMxG1dl3FvdL5bGO8WToelEHNv853aro8desnf2rPG6IoIrQl4Xr5eY=@vger.kernel.org X-Gm-Message-State: AOJu0YyKwcpEjDDUAOAOWymui4i8gM6goSvRL8385FBWYn4PLkIhUfkp M4Y0GvHhYrBiER10uKQeNLeXvEX7h3Dkb3IrSc+mBOzKRTWJQnwmgch8t9oTd6qVIh1mFVCzAIi FdASq4w== X-Google-Smtp-Source: AGHT+IGrlo28ICZjlYnHKHud5Lhbw52hO5bMA6E6bVy8S25WjrRcSMy9qsfxFUgBQHqIGe7Ixi3ejTvYspZN X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:7ea3:d1e5:495a:9a4f]) (user=irogers job=sendgmr) by 2002:a25:aaf4:0:b0:e48:4046:6bc5 with SMTP id 3f1490d57ef6-e54ee23ec0fmr15959276.8.1736448056155; Thu, 09 Jan 2025 10:40:56 -0800 (PST) Date: Thu, 9 Jan 2025 10:40:44 -0800 In-Reply-To: <20250109184046.193736-1-irogers@google.com> Message-Id: <20250109184046.193736-4-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250109184046.193736-1-irogers@google.com> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog Subject: [PATCH v3 3/5] perf test: Remove parallel option documentation From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , James Clark , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The parallel option was removed in commit 94d1a913bdc4 ("perf test: Make parallel testing the default"). Fixes: 94d1a913bdc4 ("perf test: Make parallel testing the default") Signed-off-by: Ian Rogers --- tools/perf/Documentation/perf-test.txt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tools/perf/Documentation/perf-test.txt b/tools/perf/Documentat= ion/perf-test.txt index efcdec528a8f..8f8a3c367570 100644 --- a/tools/perf/Documentation/perf-test.txt +++ b/tools/perf/Documentation/perf-test.txt @@ -35,12 +35,6 @@ OPTIONS --sequential:: Run tests one after the other, this is the default mode. =20 --p::=20 ---parallel:: - Run tests in parallel, speeds up the whole process but is not safe with - the current infrastructure, where some tests that compete for some resour= ces, - for instance, 'perf probe' tests that add/remove probes or clean all prob= es, etc. - -F:: --dont-fork:: Do not fork child for each test, run all tests within single process, this --=20 2.47.1.613.gc27f4b7a9f-goog From nobody Sat Feb 7 08:02:13 2026 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5EC971F9ED1 for ; Thu, 9 Jan 2025 18:40:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736448062; cv=none; b=f/2/Nyxeg0bY+uISHnvRyJUpRH7NHjIIK8OHE3MyVNCxfhSe0nRm7cZNvlsXfF7AUY3Dm3IEiwbmT3OJeymO8ydI3qXk+rNYrwyk5Yidnd+7vBWCmJ8MirzN6ivi/0z8swUUA7OCCCc+DQWuTYfBH3zRTCcylIq3/xggGFmKSPw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736448062; c=relaxed/simple; bh=94yDeESgARdf6BTx6q8uGdmYCl+Uug81Nad7ZVVSVzc=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=eAhDINh4gt7kwZOEUhtB+PtWiThrYUOn1vfVU4iK/jU6q9eJt0PUvnnqTc3BwETzkyVnuXZHb9T/4TUIjXkeEWSVoq437iwoxjmnjo6x5fVELZtILR7Uzl/KAlU6n5T21CuNLNaaT0VeAiZf0isjwUmnvvB54etXJmWL14UPUSY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=RJjze8DJ; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="RJjze8DJ" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e48beea5778so2893543276.1 for ; Thu, 09 Jan 2025 10:40:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1736448058; x=1737052858; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=bV8GcHcKtuj7GMNesJ0KkhHJkb7OCaruvoF/b4TYI9U=; b=RJjze8DJrewfGNROv3kLrlZjh33BgCG+pJj/YsOWgHPBmP6zXwqCXg59RuITrhsV1F 0bZ5eWOGT9S38OgZ6ZBJAt+p7v+4vd1OiD+hK9OyDMHzawzpdt7ASJFr1ikykbqbnTYL caNtzHfbzbXCixXQTyVQjL6vXqG9WpWmB1lj/Tzbx6sHEeqsY7ovEJzA24jIiSpXpEFp vuxEvSLcQXju2uSnOxJ0Q0MYkZAL0jo+KWp9lfl5koj0K//ssy639fUGbUemw1po6Ayo BmsxpJr7HhLrA36KuVdg8HwmbDwdA0n1V7gNPLwALwtnjci87yCzaaCVZVNsU05sz+oj dnwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736448058; x=1737052858; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bV8GcHcKtuj7GMNesJ0KkhHJkb7OCaruvoF/b4TYI9U=; b=ccJDe3o2RgdvXDl7HayXU27xxcIfEmZibA0ZLBtFyPG2AFEHgxjqpXpc/5GrtQZqwL W7M8J1KemyK6+SNEh7Je9oNNcH/DiSGRlU0Pe0NetwE7DjqMl5Cca1rLjIdMlJJ19Z3c FUMyeFgIt+X5QcbkWxmZUD2+8yOAlj/FCE2yI3xJn7ymdu2pOrEycmuL2WZzPVAhrIWu Dass9o/z1qvBOfbTd1TRe88O1UE6mhm495JBxhyTE5mLxvuYpQuytBdmtbYw6qkTNQxI OVFZfhrCmQJOV4TbWVwCqTtvTOLVIhowzdQnulrFddlS2hYb4ocV/C8S+OfFRxQcaOo1 HcZg== X-Forwarded-Encrypted: i=1; AJvYcCVSzI/0sYsoO5pO6WIpFyP21Z2x47u2qcFXwbgUT9HfoDVP6+dDI40+MqpzP+h1PY1FrIcjYiX5S8PmDbU=@vger.kernel.org X-Gm-Message-State: AOJu0YwAIemISH6pmJRi1F2LQBw9+Jm9x9ciOeDoK4r81FE/q2Jz+1RF 9jbQRjQ30ntzJ7bJMaemjTTgZfF0NHtihe34YWjBnkN0RXtVn4VvbLGSxBYYPTebFeZ+9iSrua7 7Xqma2A== X-Google-Smtp-Source: AGHT+IFg3DTQaMdwxZGCSqbwJsY7QUgVzARMAoFENDrPBpO9GNpfN2JnuS4lJ8aOdPZkSUJMUpzNXhiL9ODo X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:7ea3:d1e5:495a:9a4f]) (user=irogers job=sendgmr) by 2002:a25:684b:0:b0:e48:9cab:d051 with SMTP id 3f1490d57ef6-e54f01e588bmr17250276.9.1736448058531; Thu, 09 Jan 2025 10:40:58 -0800 (PST) Date: Thu, 9 Jan 2025 10:40:45 -0800 In-Reply-To: <20250109184046.193736-1-irogers@google.com> Message-Id: <20250109184046.193736-5-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250109184046.193736-1-irogers@google.com> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog Subject: [PATCH v3 4/5] perf test: Add a runs-per-test flag From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , James Clark , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" To detect flakes it is useful to run tests more than once. Add a runs-per-test flag that will run each test multiple times. Example output: ``` $ perf test -r 3 lbr -v 122: perf record LBR tests : Ok 122: perf record LBR tests : Ok 122: perf record LBR tests : Ok ``` Update the documentation for the runs-per-test option. Signed-off-by: Ian Rogers --- tools/perf/Documentation/perf-test.txt | 9 ++++++++- tools/perf/tests/builtin-test.c | 28 ++++++++++++++++---------- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/tools/perf/Documentation/perf-test.txt b/tools/perf/Documentat= ion/perf-test.txt index 8f8a3c367570..85f868c324ff 100644 --- a/tools/perf/Documentation/perf-test.txt +++ b/tools/perf/Documentation/perf-test.txt @@ -33,7 +33,14 @@ OPTIONS =20 -S:: --sequential:: - Run tests one after the other, this is the default mode. + Run all tests one after the other. By default "exclusive" + tests are run sequentially, but other tests are run in + parallel to speed execution. + +-r:: +--runs-per-test:: + Run each test the given number of times, by default once. This + option can be useful to determine if a test is flaky. =20 -F:: --dont-fork:: diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-tes= t.c index 887f735da900..729740c1e5e5 100644 --- a/tools/perf/tests/builtin-test.c +++ b/tools/perf/tests/builtin-test.c @@ -42,6 +42,8 @@ static bool dont_fork; /* Fork the tests in parallel and wait for their completion. */ static bool sequential; +/* Number of times each test is run. */ +static unsigned int runs_per_test =3D 1; const char *dso_to_test; const char *test_objdump_path =3D "objdump"; =20 @@ -485,7 +487,7 @@ static int __cmd_test(struct test_suite **suites, int a= rgc, const char *argv[], len =3D strlen(test_description(*t, i)); if (width < len) width =3D len; - num_tests++; + num_tests +=3D runs_per_test; } } child_tests =3D calloc(num_tests, sizeof(*child_tests)); @@ -549,16 +551,18 @@ static int __cmd_test(struct test_suite **suites, int= argc, const char *argv[], continue; } =20 - test_suite__for_each_test_case(*t, curr_test_case) { - if (!perf_test__matches(test_description(*t, curr_test_case), - curr_suite, argc, argv)) - continue; - - err =3D start_test(*t, curr_suite, curr_test_case, - &child_tests[child_test_num++], - width, pass); - if (err) - goto err_out; + for (unsigned int run =3D 0; run < runs_per_test; run++) { + test_suite__for_each_test_case(*t, curr_test_case) { + if (!perf_test__matches(test_description(*t, curr_test_case), + curr_suite, argc, argv)) + continue; + + err =3D start_test(*t, curr_suite, curr_test_case, + &child_tests[child_test_num++], + width, pass); + if (err) + goto err_out; + } } } if (!sequential) { @@ -698,6 +702,8 @@ int cmd_test(int argc, const char **argv) "Do not fork for testcase"), OPT_BOOLEAN('S', "sequential", &sequential, "Run the tests one after another rather than in parallel"), + OPT_UINTEGER('r', "runs-per-test", &runs_per_test, + "Run each test the given number of times, default 1"), OPT_STRING('w', "workload", &workload, "work", "workload to run for testi= ng, use '--list-workloads' to list the available ones."), OPT_BOOLEAN(0, "list-workloads", &list_workloads, "List the available bui= ltin workloads to use with -w/--workload"), OPT_STRING(0, "dso", &dso_to_test, "dso", "dso to test"), --=20 2.47.1.613.gc27f4b7a9f-goog From nobody Sat Feb 7 08:02:13 2026 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ABB5E1A239D for ; Thu, 9 Jan 2025 18:41:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736448063; cv=none; b=f8v4GMVtZdXu4wAF114hebqsdKCAgGfAuwW6CccTtRKcJ177WvpogjB/e+0lKOreO95bB9ht686yTVq1Z+mXH9DAq1W8Q/nyF1Ifdl3CvJCZvb4KciQ/ff41b6E4F4OrrM105/IemnaZWRK0UILvfTrYRSLf51l+gDZAdnJPcQ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736448063; c=relaxed/simple; bh=rb3nJ50Qx6Av0jjPKM4BDhZRCZf5SaYdGkra8TgFlyQ=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=ZdM8B6kSEMgohBN7HXFeIY8H+YCHSGkhsuzQkNRImxm0b7ksGuU0wgoUI1PsU6DbutSccqRp6k09G+OED/ZHPMPz4U17In9JNMYdfjmEbgXRtNCnGulMacAbQLMqzCdaUo9eQDbbQgCJ9ThKeN3Xehmgef5Yhkz4m+g/8nJkvtg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=1cJqO3It; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="1cJqO3It" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e3a1bc0c876so2749016276.1 for ; Thu, 09 Jan 2025 10:41:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1736448061; x=1737052861; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=XY2zs0NTwgAFtZHHxTu56AgcGBqwz9PeDUjhHd39VYk=; b=1cJqO3ItTWH5pTwQeDjCidj6AjbLpsgTdOJC3Zqwm5PrMNoG5QoKWjh4W9kvd48lF+ Zo/beixUsLlrdZyXTpb39CAzRPlR66RfJL3aQBpPiNpBHUMIUGgMrJFfTM9MmM7Zslgt PscC4ZGuYObB6plbIc2sovfXQVx2O0q5497yDZD8/VSGB4OUemEBpU7hO4xjkXEnJKc3 2qA1bhbw5/Nw9UngR4di1KC6H3Bj6yc4Fz0Rd3HRLenfFAAOVZihM7zEXvNrFRsfbLED ibEoohLb7cvpEBuqIB2oAsPN5EfktwWXLRJIpue2iXDnVrPUIfeA6ZICjMoUOB7SSvxs SOOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736448061; x=1737052861; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=XY2zs0NTwgAFtZHHxTu56AgcGBqwz9PeDUjhHd39VYk=; b=Ous6AQIcjTcsmRhL3s/YCNenTC43AKf9sS/LTdra2g7v1kz5aRh9nTDLPj1Q5cYFyU On5RBL5107XFOZ+ShXa3s4ap2nRBjKdDXNvDSOQccRJVPFMUw5pIMxU7Ruc0nGc3pxDA qYiL10LEw2CdmTZBPDFnWsyJxsY4FTRJoJFvsDoueAIxvJlMCMXbpRmGVkv5FsVAfdVv J3Gb8BsxqWz6VruaNgfxb8z2gFNcdHCLRGL1z7xLgzFZ2u9pb0REYcm1Yy45Y5v6yUWs tw5XAGp8fJ0WtTNjQPD9gsEw9ZDnWgBiR1Yp4BxisMFdzsNfqz3/12RlxZTs6yeiS28q 7frA== X-Forwarded-Encrypted: i=1; AJvYcCUMKBweSGrl7ZYSCTCzOLiJsnL9nXjcfDVt+LQC63kb63HGE4SlvjW9hv4L238Rbf3qxpVD5dj4+IplFUE=@vger.kernel.org X-Gm-Message-State: AOJu0Yyfo+Ie3goHDKzNZLxuMrWJad51meY+xoKnZa0Vn63vqsI9a67t AFzcrPUdlRMs/I2quFrfJNu1M1Jum5AYAWs30R1uqiKd+C/5qFjof14JbnAcSSHCHPxKN0UWrcv Np+Ujig== X-Google-Smtp-Source: AGHT+IHNBvMWxanjKC8QS7NH7qsJsOuz65mVwiMf26a4eMkkRLNSflqcdOavXLImDkXTJ2bKRo+CcSYhllmj X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:7ea3:d1e5:495a:9a4f]) (user=irogers job=sendgmr) by 2002:a25:acce:0:b0:e53:9459:3ae5 with SMTP id 3f1490d57ef6-e54f01d5fbamr17539276.7.1736448060647; Thu, 09 Jan 2025 10:41:00 -0800 (PST) Date: Thu, 9 Jan 2025 10:40:46 -0800 In-Reply-To: <20250109184046.193736-1-irogers@google.com> Message-Id: <20250109184046.193736-6-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250109184046.193736-1-irogers@google.com> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog Subject: [PATCH v3 5/5] perf test: Improve verbose documentation From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , James Clark , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add a little more detail on the output expectations for each verbose level. Signed-off-by: Ian Rogers --- tools/perf/Documentation/perf-test.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/perf/Documentation/perf-test.txt b/tools/perf/Documentat= ion/perf-test.txt index 85f868c324ff..32da0d1fa86a 100644 --- a/tools/perf/Documentation/perf-test.txt +++ b/tools/perf/Documentation/perf-test.txt @@ -28,8 +28,11 @@ OPTIONS Tests to skip (comma separated numeric list). =20 -v:: +-vv:: +-vvv:: --verbose:: - Be more verbose. + With a single '-v', verbose level 1, only failing test output + is displayed. With '-vv' and higher all test output is shown. =20 -S:: --sequential:: --=20 2.47.1.613.gc27f4b7a9f-goog