From nobody Sun Feb 8 02:15:10 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 7A6D7204F80 for ; Thu, 9 Jan 2025 21:51:06 +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=1736459469; cv=none; b=oQYCrKCb92GsvfII9qdxXu45I1qv6gwwSRsNhkgqSg3vTeqgSBME5Z8O2PGNGUe3fUp/6Z2BOcXlhXI/OgQn5H39PRbLMQqZS4UDL1cOW90cKoWdsPFraZ/Ncjm67/UZmlPM6T1CoBRwXj/Sa9zY068vPJhdBwx1dwT63dL4w4w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736459469; c=relaxed/simple; bh=7gA7HT5SXdSFHBIOe2LxL87NTrfsGGTcLWM2P5vNAws=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=r/SeoO5bwcJnMmRV+QXl8EpEyLlk4zUpsevhbjx4rRPeibXNj8J8YQbpOht+N2SYpbIxESvVVAHuOgHbOcVQ2oMvXlYBP0G9h4EbfvrEAbSJVdTvuRBSeLK42qxILhGMV1OX1RJlaXoYeKY2lVKwQ2q2zHuWXYntIu/5qDhmBzU= 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=hTKQKgwl; 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="hTKQKgwl" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e399d4ef55cso3768903276.2 for ; Thu, 09 Jan 2025 13:51:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1736459465; x=1737064265; 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=BzrjGp3+jbBJ+s2Q3VOtY6vPcZlQ2YRB/M7kmVR3fMM=; b=hTKQKgwl5wi0RpaDX7f32+m6AH36l8YoHpKhV7lxcks0UI4E5duP2tw9J6cm961vxa 3TPVjJSpCsHagycFkVrsnKr5c831HBrXAR3BVTnC1AiuIakA++v73arPki3h/OAOjyvK 22hJd9Nyq9QxvbOpr0ajTd6y5SkCRGFfj30/naKBvIzjYa++Bm/zUTlAHdffh5LihP/8 t+slcmH0SzSCyuJ3HLuY8BnmRYfNsQzby92p/UAv5Z0jRox5IELZ2/nDqyZ2+68SKegf L/G1YSRWLCT7L6mQ/4wD2DqpLT1EL4Zs/fhBtNEw9FQQusr4tP+73ELjcyTTOcZoxR0B v8+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736459465; x=1737064265; 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=BzrjGp3+jbBJ+s2Q3VOtY6vPcZlQ2YRB/M7kmVR3fMM=; b=uqYLeMwYqlNNyXhrr/bMEoGBR+YNazc50RKeT9EEsMauAHWcbwSYRH0EfYEoc36zYx ZXBnIVLiHLNcBzKgkVwKXBecvWnReikk75+ESFz2wAbL8kBbUemCp91ywr1Z+Nz28SJF s4IWAhjML/R/BIW7QfEQLqm+1ZyxF/zFYAGk5hN/4w4TCqQzAX/eokSgvUSLRnpxbHgP FBqiWQgkog1BqFqHbL1SpFI7oYyVl+4ws8MvNCepLBjMiQwYMbK8WgLvcCAJHAUnDngy t8TqWA3gy4FHg8Ybm/DFXK7jRFKSXHUZQgQ9VGR+bcjCz/scf/oc2ulVBcalaBqJd7bd zCfg== X-Forwarded-Encrypted: i=1; AJvYcCXqCZpHvPa/5mY1A3W5QSnhIstYrpdky3nt4KvKj4EaCJFE64GYJzk3zilzURkiBpSncYL+vGxGSETJl/k=@vger.kernel.org X-Gm-Message-State: AOJu0YwuyM2ZB6zP+M6vt7FSaOJCmCc+TXPj0dt5PJImn2bV/PbN2SCX XQLz2RrR4N90VLG6ukavwZoXwrdLzyKxszGDIXy8FqED9ahcOtDW+HXbm0I8zjkVh20+pUmxhSJ 1tyhQNQ== X-Google-Smtp-Source: AGHT+IF1ZTQ6udd5GVL4tN7RPTbDcC547Q9PMeq9wzmXNsFYYsHHW0dVSqay7Er27FKdn2His6/HHG7CDSHz X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:7ea3:d1e5:495a:9a4f]) (user=irogers job=sendgmr) by 2002:a05:690c:3510:b0:6ef:4ba2:6bfc with SMTP id 00721157ae682-6f5312d8339mr230307b3.5.1736459465559; Thu, 09 Jan 2025 13:51:05 -0800 (PST) Date: Thu, 9 Jan 2025 13:50:51 -0800 In-Reply-To: <20250109215055.454888-1-irogers@google.com> Message-Id: <20250109215055.454888-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: <20250109215055.454888-1-irogers@google.com> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog Subject: [PATCH v4 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..daf52c83b0f9 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_test_case)(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 Sun Feb 8 02:15:10 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 83C8B2054F1 for ; Thu, 9 Jan 2025 21:51:08 +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=1736459470; cv=none; b=LmDDyat8BaF/fVJP2VFyQqMZbJorjP9EmjCZseMqBDAwuFy3G8QnBxkXWYh81AvymYXrgMMkn0BSnzAT4o8AMPufdEThyxiYHaoInIpzich95wHgyvmCDgx0qtkmoMaHy92f7BjTt03SBghLZP3vPHC4CWWoPWz+Cap7jCsb0m4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736459470; c=relaxed/simple; bh=vhCg2Tn4Jb988ijQ0zQZjM97dW0OeNNbp1gyJpRiTaU=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=juiMCaWAKSpFdAuSLv8RZZYHBZOJ3lNZUpxtLP1KfMs8+ttn++6KXHmLZUIN/T8u1lfIXJbzIiQCMi6uA/VkmX1C9uzAXBcRFagZjcvLZ6uc5Od1HVbWtPjCqDgBxDn/80TevaKsJs09sogX80LjMxAjYzLbUcc5tfKDuPI513w= 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=ku+1h5dS; 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="ku+1h5dS" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e5505f613e5so2762558276.0 for ; Thu, 09 Jan 2025 13:51:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1736459467; x=1737064267; 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=thLKIjRQQE/DKKTvw6zU/13XquDliG1HZakbYNUIuAA=; b=ku+1h5dSWyTo14iOgEZx4Nk0KGxinj9aUKPYw2V4poEdp5k1/DcDHFpzr1eytj2TMG EkDJIo907Luf/q3cvCmnxBYwihaa7H8KoN5UIZrPcJP0UadMVZA5gBBuz99v7AR1FWmb 3SPQ1lMw2/mP7YLIn/9BWP+7TfCgIb4vzDtnpGcccz4FbQ+TL9NkWiekI7IWEZSOJS+g Kp16zjBdoE5UFxFrGegufBvmUnLehIluVBp9wdumFr2OMh4OUjgwkyJAjSvp+AKTklsK T164QTzW5KkwJazZlsWFEIUlfYxfirNrP3ckOvjpOG+utVVyqy5Bn5PsPn8V8SU4seEC Qzew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736459467; x=1737064267; 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=thLKIjRQQE/DKKTvw6zU/13XquDliG1HZakbYNUIuAA=; b=pBB1QhLkTLLDg99TWd8XO3jCHdSdRYoxQk8hFvjDEIF4RFQWaTfYy6BpVOkYZHTv+V O1AFPtniWnOlvpVl5ZVg6Oomr8hiAHtyZ1JtGyReNAMnjFMVdujai/w2u9I42EhPu01z 8q7uAcpluv6QItcSKHvbckiRIAZ8C+DTPqeG0m5P3OlQmyF/0cu7HtamwOa1gSATXwNt iBGk/EhmSykNp8oevXsSQn1nrDWkeuHE5Ya06j0Q2kHFhdPbbBz/QPHb/W0zElet7GO9 SQVGFn5T7WC+jwHMX00kgQjC0j3Djf4hxqsBAnfU/3Ua2mQf214vs1M0xBmtIA3lS/RT 7q7g== X-Forwarded-Encrypted: i=1; AJvYcCVtMS2Z60nkGrDzMS+Su/QvS7yQzXbPA3bP3G/zAWC24mOUGEPsM4DE46QrINA53HNPFh/quIQz1nwbn/g=@vger.kernel.org X-Gm-Message-State: AOJu0Yz1rbFXF7LCJpuJHn2c3bFAkLt6dP4fIZM73ZYizSc1sM7fQpWN rIkvO25DWRKWy0cpOGJXc9rrOPPIjw8j/gJSMOI0EDFerhTS8LoDx268AQk4hTw+68bR7oyjucj ujy8afA== X-Google-Smtp-Source: AGHT+IE0kvQqeFKIpoGAYSuP5lV8JZPyWKwfFHxLLAsfv1Ims860mcvv1SmXf/HZbXKN/4mdTvKRyQkF7/QW X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:7ea3:d1e5:495a:9a4f]) (user=irogers job=sendgmr) by 2002:a05:690c:e1f:b0:6e3:c4cb:689b with SMTP id 00721157ae682-6f543f7dbc7mr192377b3.4.1736459467557; Thu, 09 Jan 2025 13:51:07 -0800 (PST) Date: Thu, 9 Jan 2025 13:50:52 -0800 In-Reply-To: <20250109215055.454888-1-irogers@google.com> Message-Id: <20250109215055.454888-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: <20250109215055.454888-1-irogers@google.com> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog Subject: [PATCH v4 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 daf52c83b0f9..c6071c4db741 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 Sun Feb 8 02:15:10 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 B839C205AAB for ; Thu, 9 Jan 2025 21:51:10 +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=1736459472; cv=none; b=qpsAAqFPtoYnnAI+9Ca1gPHPwGo/feY4gDTydNyPOmMCv9eP2zF0lynP9JPbgKYXzB9MMA9MNuhqxMa59uXcqqyvVbsEtFhkRluXsfaq3YjSJFGNC6BToBNpIS/xtEIWha0yoZ9oRAjoRzW1xWKKcwWW2I1ABXXR6kEOucxoQ2Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736459472; c=relaxed/simple; bh=03zxN2UsxLOpbQk3XmD+PZeej4CtfK4bugESkK4+E9I=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=Wasev7Zb+mLSgY3DTRgv9sGg8r27MbOSHi/BbuAjp/gWQi6jEb1V6y2Egfs00rpL6JR6TXe39ExdEYItBVUZGVqoyGdrDiMjRFsFdwAfKH7SnkIVZXpi+nVmZT8ESAstrTJyy8FVUExDuHHouZapEL9syBeF54nzV8x6ThzU/3o= 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=sPtnQchg; 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="sPtnQchg" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e564e2528ccso439595276.3 for ; Thu, 09 Jan 2025 13:51:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1736459470; x=1737064270; 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=sPtnQchgkOk/RR8E/0zKBd9ApR6j+QvZqH4+gUc1iYEo9k+bhVcZxPZ9tQACveLWhv 03ZNdSLJJMO6avQ008MHixARBbrNyEbTQwccJoT48ocEUodC25p8GC4e6ioyAo+2DT61 HpB3OCA8XvyjS2yTHJ3cO0apEDhLoRmvSUKUSrL4H/8/bjbZ5Odnk6TdbeGRW8Cc9MdY q1ITHa1C2EJH3upNLAGuusTH7Hos0IQTsfsz3pvV7T/HjOKTdlCky8k595wmBkbHBSTK giFHlKO2fHDRzHmOLn7tooT19R2fp3eD948ZEtQAdFdc68ddyXPp9MSgC9Qf03ELAnPm 6qqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736459470; x=1737064270; 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=QQdJekcUmx0YVbomvuOKTTtLhTI6j8TVqLkZZPmrPSlxmx/HqiycJz5O7SqwF7pDgR M5Wb/dL6BIji0ISRaEooE4Lo4BUG4fFM2YeO1TPwGMirYc7zBZSFLAxmXtKi+IwgimNr 2ysjemT1I496pKrCQQ1JTAKN0rIvN3YzbFk3Hcpe+xDMbWDvolqaqIa042Y8ukvQYpXx tkbhOVwPZ+XdyXv8q0RGrbOqTI4p7r1B5knOPW0CUViS5WxsX/g5mxOjF2xSM/oZSO6Z gzMIgbfpr9TSMmPv2inr2SXgQCsBTL+6bI/9FLPpq3JLGlSNQlWcvVEZtpaHBpzTX11X EvKw== X-Forwarded-Encrypted: i=1; AJvYcCWjQVGyT2xoNdvF7e9qh2Qat2V3CyTXsDsvLJZtx6JyDDeceqGX7Bjvx1Wk8pRgRjZUkLrarkk80XJCzFQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yxv2mAWNuKzSQmEqzlG9wMVDhxiEXKvSAR5mFBh54Ni3lblmF7Z 9DzKoRHqmIB9pRXEHOJEMlTmoKezGA2DD6TNJWUMIzKxixcCn3cBk+BSdH7/q7AI9OSGdCc9BKS BLnFDQg== X-Google-Smtp-Source: AGHT+IGnwX6L2FUl2G02NKrPL02+5oEhagwozaUuxDFAZBw9MxOCG2u4MAxOOJBXh733/cqFCLlq67k65p81 X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:7ea3:d1e5:495a:9a4f]) (user=irogers job=sendgmr) by 2002:a05:6902:15c9:b0:e39:8506:c03d with SMTP id 3f1490d57ef6-e54ee273f9emr23376276.9.1736459469828; Thu, 09 Jan 2025 13:51:09 -0800 (PST) Date: Thu, 9 Jan 2025 13:50:53 -0800 In-Reply-To: <20250109215055.454888-1-irogers@google.com> Message-Id: <20250109215055.454888-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: <20250109215055.454888-1-irogers@google.com> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog Subject: [PATCH v4 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 Sun Feb 8 02:15:10 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 08CCF205E0B for ; Thu, 9 Jan 2025 21:51:12 +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=1736459474; cv=none; b=nO6nD+XkenXjtRkhM5VRR9+MyMnRi/8xX5vkryetA2ISzhil8WX+YiACTBAgEUvouMT+RGIzVfCq/Tyv78KMQY4EOHDHniMOVqEkBlDg/N7XReCx74MsAWxv2TaFfoYY/jDU5JiQyPZ4hCMLIe8Co/CTqeKdbNnhre9F6yyLlyk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736459474; c=relaxed/simple; bh=+7Yhxzt89Bt/FtZ0vYhkiBaegzjMmVsjRss0mqjtWOY=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=P2XbtlbHo1oSCBEEJCE9qx4Bq5FRtXXjJHccmSsVKowo8d2TJpyQKKTpzfKUEZg87mqwN8pzfEn5lMQ9d92SwQPDCIhakXKVyh8ek0SkUybKB1SL5q7mV+mMXS25w+zTKyYLtAq8Dz+9+OyA4KvkEWlNdHyaAaBb8f/6D50rKfM= 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=T1tbGudC; 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="T1tbGudC" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e5505f613e5so2762644276.0 for ; Thu, 09 Jan 2025 13:51:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1736459472; x=1737064272; 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=YLGfjWF8Dvwd5vX5dBqbXBJjQRQp0vBCnTiwsZVrhXw=; b=T1tbGudC77Ktw+8Nd6Bi7/6r+hkAU6d4362MSV3IOEyvEyQ+Qi+8KjAKj2JUbAJ5kH 6WDyxFE5PUNQgk3cFFrjY8Sxui534lWQPRRvqwBpNPWVnHwHMifveFtN4PcdbkYG2JYM l2CQTPIGtax4EoVWCsLK/VETZ4kG9thz7Pds8FfQLZSopL9BvGiH/2VLhEe4FWI4wZV1 Pysqm3Ku8LvYKYnAQEVHSrxDf703nTtjLFQHSPAl14jH9lodFH8xF1Yzo+HZYlOjSOAg BQXEAnUW/PTH0LBnuNF1d5UO9vhJc4UE7Zyp9XMNWqUjpYGjlwYAhnH9m3AVkS2BWklR vDvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736459472; x=1737064272; 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=YLGfjWF8Dvwd5vX5dBqbXBJjQRQp0vBCnTiwsZVrhXw=; b=kBo3x914+Ur0g3eorv4+eZXuq38pG2zscmLQVGuzRPV4aKd8NYSNtBqA6VDpRB+Xof oIsJLkZK46aJQejnZ+2RPSVbOoSrgwmKT9fcbw2d+KEr9Nm6BRkhMTMLQxhSWd8kN89I lpYCTYXclOtuBOeia0kNaR2ADFco9FJb2j/14f3K2mH7XY/SejVOfhWbjnfCImJgi9Ej uPVGTB5+AGOrAmSRPQdXKDyT02jVNZccV9jBHzWY4JOn5vj3St3KbzolK4f9BcuZBWP2 MocKw6x17kGkYsxRgyGAoJF1vSXQp4jy5fvlFvabrlVOHf1RarieA8BWueHbowfKzQ1v fuBQ== X-Forwarded-Encrypted: i=1; AJvYcCVans/8U2Lyf2CDtNaKbzcSwkdt9rbdMXNlYZW0i6BmGVs8e+TTzRTcTZVE/PYT8bUHCO4qjglnpFGQ3jg=@vger.kernel.org X-Gm-Message-State: AOJu0YxN1/7eKDueQ9u53IGUuZevHbgKYhu2+15WisK/qQbwqTjBakPm A+5h8LboHlezS/Rge380aOisF1NuymClRu3uzIWopi1RTWOSNBA2W+jkt79GBNLRNd8KIRQdUis UVDgKQw== X-Google-Smtp-Source: AGHT+IFNBF8/b18TaeHOjZXwlLPSns4sJbrZYHGMf0g4LTtJa9asgt72dPYr9HcdZ/mkL+akKyCJgOUBs+Av X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:7ea3:d1e5:495a:9a4f]) (user=irogers job=sendgmr) by 2002:a81:a985:0:b0:620:32ea:e1d4 with SMTP id 00721157ae682-6f543c590b5mr198097b3.0.1736459472119; Thu, 09 Jan 2025 13:51:12 -0800 (PST) Date: Thu, 9 Jan 2025 13:50:54 -0800 In-Reply-To: <20250109215055.454888-1-irogers@google.com> Message-Id: <20250109215055.454888-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: <20250109215055.454888-1-irogers@google.com> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog Subject: [PATCH v4 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 c6071c4db741..14d30a5053be 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 Sun Feb 8 02:15:10 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 85F562063C0 for ; Thu, 9 Jan 2025 21:51:15 +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=1736459477; cv=none; b=uDylujQSzVgNoj8h4BIlc/R/J0SCDNrV3Vg3rqNM1UbNm6ZneZja6H2IXdAwq+PxGwxp2fVB3Q2ZCBO0soPaNaKTOpf763swoZcr45rxM/cGbQ/sEsyl/4OMwxXTRI+KAzfXIHWkbmi+IIJ798GoQpG6T3FUXVBnY9IIV/FXALg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736459477; c=relaxed/simple; bh=rb3nJ50Qx6Av0jjPKM4BDhZRCZf5SaYdGkra8TgFlyQ=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=KcHp2+uKE+cXInY4ANgCvtVpsEm1lF7h+fWc2CMYjkFiy56suM9rLn5+dugGbEbGXnGBJwdp4GKQeJjZVLlGOHVlcl3honplOETMMeXGkFik2XFMGsKCM1u9mAPWnmfVSdQLKobtpvJbQam+EAyMMVswoq17n80SDHqndcdjpgM= 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=mWGMevKH; 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="mWGMevKH" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e3a0d165daeso3342857276.1 for ; Thu, 09 Jan 2025 13:51:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1736459474; x=1737064274; 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=mWGMevKH6ra1j6yZuIfMmMTdudhmhnUbn7AYy/8L23tXS7ET4Ba54hd+fuKBOs4irH xZq+8HTr8M1LGQOBXIV6o/ShZGaq+DJyh11MkO94nLdRz6gCYqanqr6W1sVDaSwIythL R/vbdli/S2alihy5LI7fB2yv32JRGDS7gFGu1XzLRlqSHbP/sKNg2nKCdORiRSjRszO5 rFr2W7KX5ez+QodArSPWZBbWqHJxG09girQYnVjociOVFOaeruYsgVNTjz5jiPn2i3A8 qvxmThy4KmLLBIVL5Xp9Dy16VwgkIQMVcBQWKg9sfnnfiYQ98X6/HLf0xSqN2skmr1OY 9iNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736459474; x=1737064274; 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=eFI1axVS46iAjwivkLwpdN6Y+/maKXCvjjV/pyLtfsaHL5A3QAl36apx0/mVBilkOW J6d4Ye1h2NMAkvlXdP76MU4a8gJJ/pFe86n5jduusGoU+TacsyQcNF8+ZKPD2M9ipAuI 3sfLlzCcRPxy3Ac/rOauVjT//5fXlg5LHtyzXuqUaDpVS3lgH4GDG09WuL2iA+jTRCQt /E/P4gYu8BVsukJGnfsROa19gyzxEbpbtXH2Cnpf0p4Wox27532Llo/Sz0O0yhmorOuL 9iCeNGD9zCy7XaIBQY0omx3LOnl1W80C2OPisH/baU/pzTQRmCkttMFO+lcytmfXdxFI YkOw== X-Forwarded-Encrypted: i=1; AJvYcCUtc5BdyWH9EvdywUezLcJ4OJIaSsJjgJYIXV59v6tHZkgCI059sMG/daIw2cUZ4e+jC0OSgbRZNK5nA1o=@vger.kernel.org X-Gm-Message-State: AOJu0YyiiOWCa0NI9wPLHjim7goIylezPVcKYWUs9AFquQZxOBluDK7O +7nGtRT1G8/EdaK/VhoF8gUbCHqw2dAtO9EhulxSUwWpbrve2uOrQTPUsgJf8sZ1Y+/kFP4llnK VqEViYw== X-Google-Smtp-Source: AGHT+IH2qwOcfHH2bK3OckucCWIEdi7YApF7/mRchMh0i7t2VufuaD66SsX539TxewHKkwJtAR5ode736gWi X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:7ea3:d1e5:495a:9a4f]) (user=irogers job=sendgmr) by 2002:a25:ce08:0:b0:e46:91aa:992a with SMTP id 3f1490d57ef6-e54edf44475mr17922276.4.1736459474673; Thu, 09 Jan 2025 13:51:14 -0800 (PST) Date: Thu, 9 Jan 2025 13:50:55 -0800 In-Reply-To: <20250109215055.454888-1-irogers@google.com> Message-Id: <20250109215055.454888-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: <20250109215055.454888-1-irogers@google.com> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog Subject: [PATCH v4 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