]> git.baikalelectronics.ru Git - kernel.git/commit
perf tests record: Fail the test if the 'errs' counter is not zero
authorArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 28 Sep 2022 15:55:43 +0000 (12:55 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 29 Sep 2022 12:53:15 +0000 (09:53 -0300)
commit3e5d1bdf83c967731ad89a7feb763c8a7c0d26c5
treeb2f7bd7c5e2de1015cf64caee8368e7c3ee48bd9
parent3be8b06e79d6fd05b08293a8700ea90a6e873819
perf tests record: Fail the test if the 'errs' counter is not zero

We were just checking for the 'err' variable, when we should really see
if there was some of the many checked errors that don't stop the test
right away.

Detected with clang 15.0.0:

  44    75.23 fedora:37       : FAIL clang version 15.0.0 (Fedora 15.0.0-2.fc37)

    tests/perf-record.c:68:16: error: variable 'errs' set but not used [-Werror,-Wunused-but-set-variable]
            int err = -1, errs = 0, i, wakeups = 0;
                          ^
    1 error generated.

The patch introducing this 'perf test' entry had that check:

  +       return (err < 0 || errs > 0) ? -1 : 0;

But at some point we lost that:

  -   return (err < 0 || errs > 0) ? -1 : 0;
  +   if (err == -EACCES)
  +               return TEST_SKIP;
  +   if (err < 0)
  +               return TEST_FAIL;
  +   return TEST_OK

Put it back.

Fixes: 2d5e9d931c8234e2 ("perf test: Use skip in PERF_RECORD_*")
Acked-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/lkml/YzR0n5QhsH9VyYB0@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/tests/perf-record.c