From nobody Sat Feb 7 16:33:27 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 95ED92063CA for ; Fri, 10 Jan 2025 04:57:42 +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=1736485064; cv=none; b=NqmFdBzSlW1b9KSHn8FWot64qzJB6j5V3f09rFbs+I4iuBEqdzWUyUk74NCQ3wrg0wCZYe59uNBicW2MPAn+ehIStMa3aOVsZaPJrCBQ9AWqs8AmiVSH5xXNHMpi+YXJU0G1gVHswcKI8UqX7K8JkbP8Ahb0Vopb8DvWP8hHxrM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736485064; c=relaxed/simple; bh=7gA7HT5SXdSFHBIOe2LxL87NTrfsGGTcLWM2P5vNAws=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=gu12v/xhXYde156GbM+fA2fcZJsxyh9I7Ip9Xcb76sJ/asOcj9QRlJD5TFWPvldApnOwAbNOL0UHFpRIqftHWlULtEHt/abm08Opqse0bN6iQGPoLln6Agpt5iNW9g7ZagQ0jfSH0Vx7XD/URJ2yGjHnSJnnmUfpx8HH4D+jrhM= 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=SCAD4C/s; 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="SCAD4C/s" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e3988f71863so3895420276.0 for ; Thu, 09 Jan 2025 20:57:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1736485061; x=1737089861; 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=SCAD4C/se5sZ6MCgyaleM1zTmhTjETg5HGDcMeYhmbp+PQgJVnvUvKoEqgPFtAB4c6 iTEvah1ljLS5aP4i4DPtawtPsJwcZuvtcHnWazmRjMgpMOMC+Vglj0SiOPZGjp8wxLNl WqiwlSjYaeRyoEgw1sCjLgWqnRoFQ4pvhHEDZ2b4MHW0YtOHT8iJhNfor4cU7fYwhv0T xdECSzT+F7Sp0Lqgjp/Baeio91PQJpEYpm22r1bIX12+tJDFLg0LSuER/IrzznYpvdwD 03Pnsm/xn1/aI7g4hgpot3QuZlkRkFG1g1FpL4L087i283pJCCKLyh7cvDdsEFR1fmh5 lGNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736485061; x=1737089861; 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=lUlLLAq/sJRBCnw5AV4ZwOn05/ZLkTrSHqD9md6wIzYOW18GGQobx0Mr7n4+7OSaOG kzbj/Dm4jMsxkUm5MJp7MVxDxC1eIuHgi9PcX2h+f69EBLgjl8JpvY0TibAKKfXZE5N3 dLsWomv0ZNL8uCLrMWNTV0UxHXA8Yozzmp1fSO7/xfREMxzYuOp07jpBR2IzdSHEDDAG m30P3RiWmMbI8/nRsCKzhXuHXPaHjKxsJaEDArKSlUGmc5iIJCPd03Hgyrvfrp9JKwQ1 w1TbQ77G/HMrJatZ9MpCq4e8HQceM3sVQbzV7oCsJ+lbVhGRd+w3uo5kLuvjol20ZRd+ sUHA== X-Forwarded-Encrypted: i=1; AJvYcCU93igzOn3I/ZCBroP/r4VEoRhHP4D5/L3j6i2hFCMEBwkiDw0L5nhL0A9UsYV5AwQp787NKn8MZHCaCSk=@vger.kernel.org X-Gm-Message-State: AOJu0YynZpEJ36L+Qsbo9oDhJcOFYTcgs4YwLhSkbjYJymtDY0Jz+DHt 3xZLM6fw+/Gx8nIFyhpubEOrCHvrOaSLY/1lwLGItS5oqHHC+plW2nXfhk3XaWR03OSzinzIM82 xs/1U+g== X-Google-Smtp-Source: AGHT+IHkFzZXSAs9jYaIboXxHHVBvGnbhV7YQmJ361UUW77hmSJfp3Qd/v9/37oI8xJTKF7eDMDF0QsCMnKr X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:7ea3:d1e5:495a:9a4f]) (user=irogers job=sendgmr) by 2002:a05:690c:7241:b0:6ef:94b3:730b with SMTP id 00721157ae682-6f531353ec3mr236677b3.7.1736485061713; Thu, 09 Jan 2025 20:57:41 -0800 (PST) Date: Thu, 9 Jan 2025 20:57:32 -0800 In-Reply-To: <20250110045736.598281-1-irogers@google.com> Message-Id: <20250110045736.598281-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: <20250110045736.598281-1-irogers@google.com> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog Subject: [PATCH v5 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 Reviewed-by: Namhyung Kim --- 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 Sat Feb 7 16:33:27 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 091EF2066C5 for ; Fri, 10 Jan 2025 04:57:44 +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=1736485067; cv=none; b=geKlYnfsYd7NqoTWZbtzfWwNTt/u51tuhNaEPsBl6+nbqZNSuReCT7cweCGCPS79d1DIG9kcheJAie3gZzmHf4p2DdTTNmDMnjS7WS8+Qav7CIwpty9ZFs5joEzZQYRb4ZhkyMrWKc5kiQP/VH+tTSgBjB82dClwzRMSvhYGz60= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736485067; c=relaxed/simple; bh=vhCg2Tn4Jb988ijQ0zQZjM97dW0OeNNbp1gyJpRiTaU=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=JI63BFMggrFjVBxesHO24DDfnNv4HB5TsdyRIqODbCMtJQ6Fd7g/p8NeWc6LzSmsiaNSKvciADE8x0Pwq4UZIPl/E/oRv3a/k0JlbLCS5iknTs53Mu9F++Mf/mjhqYpGm64PdyATXMnPWn2FLH0720EILpVLeYD+sVkwc5a/U/s= 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=IItVIZ/0; 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="IItVIZ/0" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e3c61a11a40so4129643276.2 for ; Thu, 09 Jan 2025 20:57:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1736485064; x=1737089864; 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=IItVIZ/0AofM0DoEssDnNitX0TC2xS/v1vfHLcWdAm+HRcIC6UBJTbYR/GB12z6NKe QO/JuJAyyf486ovQaTVY66Gy/HcTE4uZv5qOFf6gEoxt/4JsfPTax/uAwoU0cu1WHtHy ePbPwtN3T24aQup83sDbt4BDbljzOBCE6MXH7BItQwFwY5J6JY6BYbveMEn27nPEg6qD Qi4RzAK+mBxwsqAFbsTzq9TkWjCJAxJQngwaIkO5O1uC4A58RpCpG4l0gNOK7OtOb3WW IajUZArlungoAQHEamjrgwM9IPZPYnwoXkKiDMI170hLGuq/LZAb8wAynv66WPuuHgrN /sBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736485064; x=1737089864; 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=uCx9yM/Mq7acHYkoljw9bld5mBhV3IxvHzAfc09zg3HvF1KqQKYoPMWF8fhf3iled3 VbtByDE/6j0e29SsX1DmKZ+9PnDJ/TCeM0GXpRlbdV3wYFgYm6I7OZUG/66jQbVY9Dl/ M0Yoog4JK1bOrvmDYDZgz+pUa0nH2Ron69IQkpkBzbIMgWscFF7rWuEGbgRA1M9zA4By 7Hp/Qa4wT8qoQYwj1FzsRw8diDIXCMB66NprDV5v39RQLOrgZWYJuxC5HzTbOiCG/0aB NDIaH+pi+xH1Xk9PD9YzEwuDcqC3lGX45QggnePk9NOXrqdJ75hOzEWUO1QWYykP8lOt kqpQ== X-Forwarded-Encrypted: i=1; AJvYcCWw26ys5scs8NFng1UzEex9XAVVF97x4E5HDVn3j782psdUdvWTjL/6Hy4vqLeaImexEGHB/LSZccHwiWQ=@vger.kernel.org X-Gm-Message-State: AOJu0YycqR3crOwTgrbAOQNBqvKh+BLN5c3hVf22MNXJqKwBGhtwCOOD tmNAYgMgJQ4Eph3wILN5CJBCAN47oxeXljspxx7EHDhZB7LQpVZVCNtsO1KWYilGGIp5RDBqwqE nElXSHQ== X-Google-Smtp-Source: AGHT+IEJN0HinTlexQ7R1EtYrmRqv7xFgm3o7LgBYzge1N5nr8Jp5d/ALxvVMuKv3yb+q+6iCkBD6Dg2FoXS X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:7ea3:d1e5:495a:9a4f]) (user=irogers job=sendgmr) by 2002:a05:690c:6f0b:b0:6ef:6eba:1d53 with SMTP id 00721157ae682-6f5313014c0mr259517b3.6.1736485064147; Thu, 09 Jan 2025 20:57:44 -0800 (PST) Date: Thu, 9 Jan 2025 20:57:33 -0800 In-Reply-To: <20250110045736.598281-1-irogers@google.com> Message-Id: <20250110045736.598281-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: <20250110045736.598281-1-irogers@google.com> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog Subject: [PATCH v5 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 Reviewed-by: Namhyung Kim --- 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 Sat Feb 7 16:33:27 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 64B412066DC for ; Fri, 10 Jan 2025 04:57:47 +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=1736485068; cv=none; b=aEpVtnIeXzjiKOu7rUi8QqGPkPIv0xyVRxHpi+1ctF/rHve4YNoqR18Z0GvKMzLmd01UWn9s+sHs8qhMEpOiduDmIR9mKFA9VfHzwSK33NYiQvKjntb1Q7U61gbSH4nMOxepLi49+TWCtlh7z9efuK6TwAI1fhwmLYF8NQvNKwc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736485068; c=relaxed/simple; bh=YOepETVfHonn8uZir4r4eusKZejQHN7ESN5brod9p/Q=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=nTA3lMDRO7zoN2gtFYMxGBdWlvW7d5y2J8a/3XRLTIi6I+kVWbL0Hoob0HDmbO9wYXTk9V0qbtFcjIiWszEWmKnVtCcdquMOi03nxf1CNlfqVAzGWQRVOMWjZnTRtiVjP66J+xZq0+qu/zAOZSwNom872guayo17QqSCsn9p+cY= 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=IqgXv7rn; 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="IqgXv7rn" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e39993d8594so3852400276.3 for ; Thu, 09 Jan 2025 20:57:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1736485066; x=1737089866; 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=s63/Y/oKa0if/THcgPq3FL+TPGZ7JCSoXdoBNLnmIzc=; b=IqgXv7rnTM3vwmyrrROTkt44G2kWE09ChsunNayA+h9btdxPRMfurJ43wckIZ0OMow t7HtScyXUHPrmhTbhmzens47M5AvlWOq1FR6LL9tgeV0hn8cYTrVasReAlkjZTiZxNbv jeK1UPQpYVX4FS/m5QM/+VY7ChLR5YemUBKZcueLAOR/0B6UBY1T4lGfIWme28z329vI KpzSM7eLg5sQAaz/WCQ6KQjJXEFYtFuXcTS/iN/k/i/Ddo9sCOcpR5D+Ex5EihqBEqze Eu+A4lGF8XYWCNSLBYQk/eE5g20rYAMMZ/PR9QpJIJls66WcMHuzyk5/+jnF8tWxBkHD ztdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736485066; x=1737089866; 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=s63/Y/oKa0if/THcgPq3FL+TPGZ7JCSoXdoBNLnmIzc=; b=LAS8QBOEU669PhHHmPvWF9FMnXdhYM/5OWEfyd6GWsQnFTtBcYYdYQenY/Vzg6v8wu Ov9Ec0bwR12wYbDzbwYJiVJMf8u62Rz6khUuWQFC5xL+SZ73zISzXXFBUZ9FujdYZOSl eEt/GfsaWWPqiP2FneuXosmkMA7RKJbxomfCko//wORXryAvbgwYvsTItJEm9won966+ KQJPz23iWYWcbqtw5uMVPe22zLTQIYPMo51QXmgWdsDOi9dKhzBqUeJJph+fk4KlZXTj J9ltqjmMsslnPJjVHqlnHNOCHHWnJ3N1k96cqDf7SEEu+b1AMJKzBxSrFVoQ3OLtsS5T sNTg== X-Forwarded-Encrypted: i=1; AJvYcCWeUlN3a74OvgFQzyid++OC+AoYZ0tk38i+TLYsBSLtXi/mxE7GEgAm5p6S7g0rmm2jxgIpxgWDPpjwFtw=@vger.kernel.org X-Gm-Message-State: AOJu0Ywqe6f6iR4GrfoR+b9+y76qaT/e0iELriG66a8B/W9rx9JXI5KD 09D6DKQI68qhpqnj0eG6O+nNvS04NBp+3WG/XfckVtIfDNt1pJQy9neXNkyXL2bJLWsrfJlXYff V7MQyhA== X-Google-Smtp-Source: AGHT+IFPeRWpfLYB+la4IH4hxWInhVIyCyFBDphutveXRxwdCHDaA0mZAuPZTPXzO9htsEjo+ugr93nIBaEE X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:7ea3:d1e5:495a:9a4f]) (user=irogers job=sendgmr) by 2002:a5b:10a:0:b0:e4a:dea9:fe07 with SMTP id 3f1490d57ef6-e54eff2ce3cmr20589276.4.1736485066457; Thu, 09 Jan 2025 20:57:46 -0800 (PST) Date: Thu, 9 Jan 2025 20:57:34 -0800 In-Reply-To: <20250110045736.598281-1-irogers@google.com> Message-Id: <20250110045736.598281-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: <20250110045736.598281-1-irogers@google.com> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog Subject: [PATCH v5 3/5] perf test: Fix parallel/sequential 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"). Update the sequential documentation to reflect it isn't the default except for "exclusive" tests. Fixes: 94d1a913bdc4 ("perf test: Make parallel testing the default") Signed-off-by: Ian Rogers Reviewed-by: Namhyung Kim --- tools/perf/Documentation/perf-test.txt | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tools/perf/Documentation/perf-test.txt b/tools/perf/Documentat= ion/perf-test.txt index efcdec528a8f..2e40869b64de 100644 --- a/tools/perf/Documentation/perf-test.txt +++ b/tools/perf/Documentation/perf-test.txt @@ -33,13 +33,9 @@ OPTIONS =20 -S:: --sequential:: - Run tests one after the other, this is the default mode. - --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. + Run all tests one after the other. By default "exclusive" + tests are run sequentially, but other tests are run in + parallel to speed execution. =20 -F:: --dont-fork:: --=20 2.47.1.613.gc27f4b7a9f-goog From nobody Sat Feb 7 16:33:27 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 AD5FD206F05 for ; Fri, 10 Jan 2025 04:57:49 +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=1736485071; cv=none; b=lVQ+JZAUTJgMfdDA88dwICJ7NtsvUPayTP5NF1hHtRoPKNpCWil9H05D+Nzkgqb1O0Txd9ZpyqVzzRPsi53T7NiGYSjn3vQQr088pWcFTcjR0zM9KlNUIxi40dsTmsykOY2AvTbx9tz3TP0SxZH1a9yLRWNDvoi06DIb8F8PhEg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736485071; c=relaxed/simple; bh=mh40pFTVB78EoqC5lTfrKoFSR+pG9AjMFlTEGuREGAA=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=XTdA6RopDAUIbmCbjt47goizYM/iaAx85yAKv7rnOaXoOAIh57asowX+EvEned9lt6lemOJD0JMNBh6gwWLaBwkxBM7tAcRgbAbJ7lPLMg4OPlBVoXnxwxxB3nUcsSgdFv8PheEINsIcfHOkpQrB8TzmDy/3i5dt3gV/Qw2laI0= 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=Hf/MMVhi; 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="Hf/MMVhi" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e3a1bc0c876so3725636276.1 for ; Thu, 09 Jan 2025 20:57:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1736485069; x=1737089869; 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=nki34OflXNMOF1Pr+0EwWgqUSzPdOTYpV9z5+MVXOF8=; b=Hf/MMVhi4BNAyVzcYsSvWc0o9nv42vb/pU2lPItsdgz6b6G40K9f8ndpnDbfSZ3whS +oHR6navbu9BOenkKiyn0wMNcFcxXjqYr3DiDmhT81PzDRJ6N6dv+mJmHecG40onAQvO IagHyx3LvMq5B++OcyBjLU+FyHnBi8DT7eRTQj9Hcwm9wed59yOdVom8axhgXrxodrGN kXkZRkP1+maxj/QY1rtR2H/3oJ+W8iVSFpK/ysaka3MCW0QpVjga8LzuuRWQWT88FAjF 9FuATrwC1lbMNnrku5cX+slUXM+I7I2w8Hy6GtDkFfuM9ss5wVrLgY4oZk7H/h3jmRYy LcOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736485069; x=1737089869; 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=nki34OflXNMOF1Pr+0EwWgqUSzPdOTYpV9z5+MVXOF8=; b=PR4nVsEAbewvcpbDTFF4piwpMaUWmxeZvYEvqT38R+L+ek3s3mrWP5dB7VSsNePkf4 oYfBcAbVGwSgJ8INioVzph1NlqMIqzWIX+mlkrufI7qrQS94FlNXl+/KE6kHhS/xmNLh HrYCIXvuwcxAfENdKb5JIce/Z4NJ1H+Lgk8NfcmUNVpPaX/IQNoyDwLSu/PfhRSXAJGP 84kj2gr51uprBRPDpOBLZS/NsrD7E6mPRh76vleac114jwlKkBuRLPxnzoevRg3lzZOc Rb9w1kmKlNpQRkRbu1jZDAEtgLB6wRukfPMESbJBtzgpw0bnZll83nWHtgssSFTyMlU7 y8Pw== X-Forwarded-Encrypted: i=1; AJvYcCX5BSwkIp0EIm7zJd084yxFpJYSITBhAk+UCFburIOqJzjzWYagejVFX6Pj7F/zCVu32XItf2llW9DD76k=@vger.kernel.org X-Gm-Message-State: AOJu0YytOctamPNsppID/yIQkXHdweQhe/5GlOuCcSSFJGsOx27KQzmy F7Xi6I3yrlyd8UI2OyULL2npgp+DkVqu/ThUmF5FiMl8q+zt2xjfmr+Tx2MuHnZZ5R+Egx3SWM4 XYguiAg== X-Google-Smtp-Source: AGHT+IG+7QSa4MxOrxEvtHfaHE5rSZStaue4MuFj0zlZuGNWqvyRZkXaMX6e/DPHFkfLYo0+RSempBi5e4YB X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:7ea3:d1e5:495a:9a4f]) (user=irogers job=sendgmr) by 2002:a05:690c:c99:b0:6ef:c86b:af2c with SMTP id 00721157ae682-6f530f0591emr303017b3.0.1736485068790; Thu, 09 Jan 2025 20:57:48 -0800 (PST) Date: Thu, 9 Jan 2025 20:57:35 -0800 In-Reply-To: <20250110045736.598281-1-irogers@google.com> Message-Id: <20250110045736.598281-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: <20250110045736.598281-1-irogers@google.com> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog Subject: [PATCH v5 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 Reviewed-by: Namhyung Kim --- tools/perf/Documentation/perf-test.txt | 5 +++++ tools/perf/tests/builtin-test.c | 28 ++++++++++++++++---------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/tools/perf/Documentation/perf-test.txt b/tools/perf/Documentat= ion/perf-test.txt index 2e40869b64de..85f868c324ff 100644 --- a/tools/perf/Documentation/perf-test.txt +++ b/tools/perf/Documentation/perf-test.txt @@ -37,6 +37,11 @@ OPTIONS tests are run sequentially, but other tests are run in parallel to speed execution. =20 +-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. + -F:: --dont-fork:: Do not fork child for each test, run all tests within single process, this 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 Sat Feb 7 16:33:27 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 316432066DC for ; Fri, 10 Jan 2025 04:57: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=1736485073; cv=none; b=iYe3Qut4O7FTcK7eVBdStnoGm3VcxHi0/tNkg31+AAzHqHFx7FU8xUfMpo/ZbxbYSN+6zy1SkSQiMcle9gXCZ7y026lIspkH+9oVGB9IiKIMb1iaTN7F9ijlJeQohseSSQK6rWKhJmj2ENf53PvaZyNRxeXJ/jLKcqbPP//vStk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736485073; c=relaxed/simple; bh=rb3nJ50Qx6Av0jjPKM4BDhZRCZf5SaYdGkra8TgFlyQ=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=swsx9hqtQhSZapIKUeFXaO0KN7J3b/rYtS57BuX2QraZTXM1UE5G9v3oBKmEyqRKiv2NO7LRPQneeQrodLAnLDKK99PJW8smScT8oMTPR25Pgnc9slpty1yMAhu3tWT+GkCsiSqVqcL7oxMSTkkaL2QcPanyu2xvtg4kCUr6bHo= 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=fan6/XZi; 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="fan6/XZi" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e54d9b54500so3764515276.3 for ; Thu, 09 Jan 2025 20:57:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1736485071; x=1737089871; 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=fan6/XZiBnJm2zZlvwEMm9efPeJV1fwwhPdCveNpExAZP/igb87wNWlH+km030cVZI LNFctBt747SV04T9GiwaUb//EQ8AOTlR5302sT88bLksiRqAqtSYbxqDicGYIiMaffrz PQz93/q2FErJ+88WD5KGj9/ViY69lL0JJtaxdIOg4CrR+PmbqXDx3qWzXRBgZedeVDGK 9oAhVCtjehsV9HYG4IYtL2iXTib+U+y5pB5Ah0NKXPeLSCp2L5edlbhUgUXc30Koedp4 ivlg6+mekvgZkP3XZKWcnsr05pu2DgvXwndj7WHDiznHgXmNXj3wrVZnZQQo+25QhYwY zgdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736485071; x=1737089871; 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=jW4aPl3V7zquOJhS1TdZkkJPl/2mlGym8V9ERttzPER3nwqP4kmw4Ap0xGOzrssFFM gW3gkZDSdishpNgw7X1O99ZGCWGdh6/dfD5dE04CBRCB33it1dvcRDI6sPxAC4HfUlJu PeKN6T7mgJDq9JUS+w4PfvHsDCok0ppNhYyVHWuj2dF4oVUwyuFlwNWaPldO3YmqFYYz nJgdaBCzaIE/wjYrYhKg5fJZFS3QPKvqpPhpNrdEdxnTzmQpMxTFYMIe5+4IiztR1jiF YffMxcGVrJpC9aH6su45BtQLv87/1E7S2tZkT3nAvw1xiCLD7XFUqIiBTa//f8Wpo4Bj MeUA== X-Forwarded-Encrypted: i=1; AJvYcCWlx0ZN6uGCOTTlLzwSpWwdfdeVmKTzA3cBylncjTVfTKJAeq/VhBox4ZfJi6APcRlsXXUBKFdqwyvnrGU=@vger.kernel.org X-Gm-Message-State: AOJu0YyWColg/ALOBkrsLOXBARvE47lN/hs9Vw+QyVFGFmUug3eU8qQ4 sMwgnmjYLqXj3VNWlXM63YjszG9ceB820A7PPVKX1Yrcjzv3S2wwnvypTRpWvX5hLcxoom1JkPa fu1qSFA== X-Google-Smtp-Source: AGHT+IFIVuzArGHZBa7KPHOYY4abC9lrWC65jcX0uiEnKNDtualD+N8pzCnxGBoqwct7KUkJxB+AZRqcdjJo X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:7ea3:d1e5:495a:9a4f]) (user=irogers job=sendgmr) by 2002:a05:6902:124e:b0:e48:6770:76de with SMTP id 3f1490d57ef6-e54efe6685dmr29054276.7.1736485071247; Thu, 09 Jan 2025 20:57:51 -0800 (PST) Date: Thu, 9 Jan 2025 20:57:36 -0800 In-Reply-To: <20250110045736.598281-1-irogers@google.com> Message-Id: <20250110045736.598281-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: <20250110045736.598281-1-irogers@google.com> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog Subject: [PATCH v5 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 Reviewed-by: Namhyung Kim --- 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