]> git.itanic.dy.fi Git - linux-stable/commit
perf test: Add Symbols test
authorAdrian Hunter <adrian.hunter@intel.com>
Fri, 20 Jan 2023 12:34:47 +0000 (14:34 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Sun, 22 Jan 2023 21:09:56 +0000 (18:09 -0300)
commit1b69346e7a0bd18a9c3b00bdd6219d4d8ad73466
tree357aba31da049dab5c41ce53f39add6a5c2307dc
parent1962ab6f6e0b39e4216206205bda14aff87705f3
perf test: Add Symbols test

Add a test to check function symbols do not overlap and are not zero
length.

The main motivation for the test is to make it easier to review changes
to PLT symbol synthesis i.e. changes to dso__synthesize_plt_symbols().

By default the test uses the perf executable as a test DSO, but a
specific DSO can be specified via a new perf test option "--dso".

The test is useful in the following ways:

 - Any DSO can be tested, even ones that do not run on the current
 architecture. For example, using cross-compiled DSOs to see how
 well perf handles different architectures.

 - With verbose > 1 (e.g. -vv), all the symbols are printed, which
 makes it easier to see issues.

 - perf removes duplicate symbols and expands zero-length symbols
 to reach the next symbol, however that is done before adding
 synthesized symbols, so the test is checking those also.

Example:

  $ perf test -v Symbols
   74: Symbols                                                         :
  --- start ---
  test child forked, pid 154918
  Testing /home/user/bin/perf
  Overlapping symbols:
   7d000-7f3a0 g _init
   7d030-7d040 g __printf_chk@plt
  test child finished with -1
  ---- end ----
  Symbols: FAILED!

Note the test fails because perf expands the _init symbol over the PLT
because there are no PLT symbols at that point, but then
dso__synthesize_plt_symbols() creates them.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20230120123456.12449-2-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/Documentation/perf-test.txt
tools/perf/tests/Build
tools/perf/tests/builtin-test.c
tools/perf/tests/symbols.c [new file with mode: 0644]
tools/perf/tests/tests.h