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 <>
Cc: Adrian Hunter <>
Cc: Alexander Shishkin <>
Cc: Ingo Molnar <>
Cc: Jiri Olsa <>
Cc: Marco Elver <>
Cc: Mark Rutland <>
Cc: Namhyung Kim <>
Cc: Peter Zijlstra <>
Cc: Riccardo Mancini <>
Cc: Sohaib Mohamed <>
Cc: Stephane Eranian <>
Signed-off-by: Arnaldo Carvalho de Melo <>
1 file changed