]> git.baikalelectronics.ru Git - kernel.git/commit
perf test: Avoid shell test description infinite loop
authorIan Rogers <irogers@google.com>
Tue, 17 May 2022 20:41:44 +0000 (13:41 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Sat, 21 May 2022 17:45:19 +0000 (14:45 -0300)
commitd6f98ce806ffe12cb14e20557cc8e5b090fca337
tree5fa9050093f430ae3d4045d4666ecfa74e5d8c3f
parent2c327b28e6da16c624d12cf4b772fd85b89265eb
perf test: Avoid shell test description infinite loop

for_each_shell_test() is already strict in expecting tests to be files
and executable. It is sometimes possible when it iterates over all files
that it finds one that is executable and lacks a newline character. When
this happens the loop never terminates as it doesn't check for EOF.

Add the EOF check to make this loop at least bounded by the file size.

If the description is returned as NULL then also skip the test.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Marco Elver <elver@google.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Riccardo Mancini <rickyman7@gmail.com>
Cc: Sohaib Mohamed <sohaib.amhmd@gmail.com>
Cc: Stephane Eranian <eranian@google.com>
Link: https://lore.kernel.org/r/20220517204144.645913-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/tests/builtin-test.c