]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
perf test: Split monolithic 'util' test suite into sub-tests
authorIan Rogers <irogers@google.com>
Tue, 2 Jun 2026 17:41:24 +0000 (10:41 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 4 Jun 2026 14:40:51 +0000 (11:40 -0300)
Refactor the monolithic 'util' test suite into distinct 'String
replacement' and 'BLAKE2s hash' sub-tests using the struct test_case
framework. This improves test reporting granularity and is used in a
subsequent perf test for JUnit XML test result reporting.

Assisted-by: Gemini-CLI:Google Gemini 3
Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/tests/util.c

index bf2c5b1338844c2e8247e5ad5ff25f366b2dde8f..f9abd9911e6cae9a835025b9ca591677045e611b 100644 (file)
@@ -86,7 +86,12 @@ static int test_blake2s(void)
        return 0;
 }
 
-static int test__util(struct test_suite *t __maybe_unused, int subtest __maybe_unused)
+static int test__blake2s_case(struct test_suite *t __maybe_unused, int subtest __maybe_unused)
+{
+       return test_blake2s();
+}
+
+static int test__strreplace(struct test_suite *t __maybe_unused, int subtest __maybe_unused)
 {
        TEST_ASSERT_VAL("empty string", test_strreplace(' ', "", "123", ""));
        TEST_ASSERT_VAL("no match", test_strreplace('5', "123", "4", "123"));
@@ -95,7 +100,16 @@ static int test__util(struct test_suite *t __maybe_unused, int subtest __maybe_u
        TEST_ASSERT_VAL("replace long", test_strreplace('a', "abcabc", "longlong",
                                                        "longlongbclonglongbc"));
 
-       return test_blake2s();
+       return 0;
 }
 
-DEFINE_SUITE("util", util);
+static struct test_case tests__util[] = {
+       TEST_CASE("String replacement", strreplace),
+       TEST_CASE("BLAKE2s hash", blake2s_case),
+       { .name = NULL, }
+};
+
+struct test_suite suite__util = {
+       .desc = "util",
+       .test_cases = tests__util,
+};