perf test: Skip diff test if test_loop is missing
Ian Rogers
reviewerPATCH 1/1 perf test: Skip diff test if test_loop is missing
The diff test depends on finding the symbol test_loop in perf and will fail if perf has been stripped and no debug object is available. In that case, skip the test instead.
Signed-off-by Ian Rogers <[email protected]>
--- tools/perf/tests/shell/diff.sh | 7 +++++++ 1 file changed, 7 insertions(+)
tools/perf/tests/shell/diff.sh +7 -0
@@ -9,8 +9,15 @@ perfdata1=$(mktemp /tmp/__perf_test.perf.data.XXXXX) perfdata2=$(mktemp /tmp/__perf_test.perf.data.XXXXX) perfdata3=$(mktemp /tmp/__perf_test.perf.data.XXXXX) testprog="perf test -w thloop" + +shelldir=$(dirname "$0") +# shellcheck source=lib/perf_has_symbol.sh +. "${shelldir}"/lib/perf_has_symbol.sh + testsym="test_loop" +skip_test_missing_symbol ${testsym} + cleanup() { rm -rf "${perfdata1}" rm -rf "${perfdata1}".old
Signature · 1 line
2.43.0.rc2.451.g8631bc7472-goog
Quoted 19 lines · Ian Rogers
The diff test depends on finding the symbol
test_loopin perf and will fail if perf has been stripped and no debug object is available. In that case, skip the test instead.Signed-off-by Ian Rogers <[email protected]>--- tools/perf/tests/shell/diff.sh | 7 +++++++ 1 file changed, 7 insertions(+)tools/perf/tests/shell/diff.sh +2
-0@@ -9,8 +9,15 @@ perfdata1=$(mktemp /tmp/__perf_test.perf.data.XXXXX) perfdata2=$(mktemp /tmp/__perf_test.perf.data.XXXXX) perfdata3=$(mktemp /tmp/__perf_test.perf.data.XXXXX) testprog="perf test -w thloop" + +shelldir=$(dirname "$0")
tools/perf/tests/shell/diff.sh perfdata1=$(mktemp /tmp/__perf_test.perf.data.XXXXX) · line 23
Quoted 10 lines
tools/perf/tests/shell/diff.sh +5
-0+# shellcheck source=lib/perf_has_symbol.sh +. "${shelldir}"/lib/perf_has_symbol.sh + testsym="test_loop" +skip_test_missing_symbol ${testsym} + cleanup() { rm -rf "${perfdata1}" rm -rf "${perfdata1}".old
The verbose output in the error case could also
be tweaked.
Before patch:
$ strip tools/perf/perf $ tools/perf/perf buildid-cache -p $(realpath tools/perf/perf) $ tools/perf/perf test -v 'diff test' 85: perf diff tests : --- start --- test child forked, pid 8621 Basic two file diff test ./tools/perf/tests/shell/diff.sh: 51: [: Workload: unexpected operator ./tools/perf/tests/shell/diff.sh: 56: [: Workload: unexpected operator Basic two file diff test [Failed diff] Basic three file diff test ./tools/perf/tests/shell/diff.sh: 73: [: Workload: unexpected operator ./tools/perf/tests/shell/diff.sh: 78: [: Workload: unexpected operator ./tools/perf/tests/shell/diff.sh: 83: [: Workload: unexpected operator Basic three file diff test [Failed diff] test child finished with -1 ---- end ---- perf diff tests: FAILED!
After patch:
$ tools/perf/perf test -v 'diff test' 85: perf diff tests : --- start --- test child forked, pid 8853 perf does not have symbol 'test_loop' perf is missing symbols - skipping test test child finished with -2 ---- end ---- perf diff tests: Skip
and with symbols:
$ tools/perf/perf test -v 'diff test' 85: perf diff tests : --- start --- test child forked, pid 10122 103e20-103e60 g test_loop perf does have symbol 'test_loop' Basic two file diff test Basic two file diff test [Success] Basic three file diff test Basic three file diff test [Success] test child finished with 0 ---- end ---- perf diff tests: Ok
Tested-by Adrian Hunter <[email protected]>