perf test: Iterate over shell tests in alphabetical order
authorRiccardo Mancini <rickyman7@gmail.com>
Tue, 25 May 2021 23:05:17 +0000 (01:05 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 27 May 2021 16:55:28 +0000 (13:55 -0300)
commitda963834fe6975a11f88d7ad9e9280938476c8dc
treed2dea567e356b97a006356b5dd71ebba6ee09ddb
parent41ca1d1e88d485cb835a21032538e55102982a7a
perf test: Iterate over shell tests in alphabetical order

The for_each_shell_test macro iterated over all shell tests in the
directory using readdir, which does not guarantee any ordering, causing
problems on certain fs. However, the order in which they are visited
determines the id of the test, in case one wants to run a single test.

This patch replaces readdir with scandir using alphabetical sorting.
This guarantees that, given the same set of tests, all machines will
see the tests in the same order, and, thus, that test ids are
consistent.

Signed-off-by: Riccardo Mancini <rickyman7@gmail.com>
Reported-by: Ian Rogers <irogers@google.com>
Acked-by: Ian Rogers <irogers@google.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Fabian Hemmer <copy@copy.sh>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tommi Rantala <tommi.t.rantala@nokia.com>
Link: http://lore.kernel.org/lkml/20210525230521.244553-1-rickyman7@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/tests/builtin-test.c