perf test: Adding an entry for the perftool-testsuite
PATCH 1/9 perf test: Adding an entry for the perftool-testsuite
In order to be able to run the bash/subcommand-based testsuite directly from perf test a new perf-test entry has been created for it.
The driver (suite.c) runs all the tests that it finds in the testsuite
directory: tools/perf/testsuite/ (rather ./testsuite as it expects it
it being run from the perf's directory).
In case the testsuite is not found, the testcase is skipped. If this is not the desired behaviour, some packaging will be needed.
Usage:
./perf test suite
or
./perf test suite -v
(for the verbose output)
--- tools/perf/tests/Build | 1 + tools/perf/tests/builtin-test.c | 4 ++ tools/perf/tests/suite.c | 143 ++++++++++++++++++++++++++++++++++++++++ tools/perf/tests/suite.h | 30 +++++++++ tools/perf/tests/tests.h | 1 + 5 files changed, 179 insertions(+) create mode 100644 tools/perf/tests/suite.c create mode 100644 tools/perf/tests/suite.h
tools/perf/tests/Build +1 -0
@@ -34,6 +34,7 @@ perf-y += thread-map.o perf-y += llvm.o llvm-src-base.o llvm-src-kbuild.o llvm-src-prologue.o perf-y += bpf.o perf-y += topology.o +perf-y += suite.o $(OUTPUT)tests/llvm-src-base.c: tests/bpf-script-example.c $(call rule_mkdir)
tools/perf/tests/builtin-test.c +4 -0
@@ -180,6 +180,10 @@ static struct test generic_tests[] = { }, }, { + .desc = "Testsuite", + .func = test__suite, + }, + { .func = NULL, }, };
tools/perf/tests/suite.c new file +143 -0
143 lines not on this page · raw message
tools/perf/tests/suite.h new file +30 -0
@@ -0,0 +1,30 @@ +#ifndef PERF_TEST_SUITE_H +#define PERF_TEST_SUITE_H + +#include <linux/compiler.h> +#include "tests.h" +#include <stdlib.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <dirent.h> +#include <unistd.h> +#include <string.h> + + +/* verbosity */ +extern int verbose; + +/* runs a shell script */ +int _run_shell (const char *script); + +/* checks for existence of a file and runs it */ +int run_shell (const char *script); + +/* if a script is available, run it, otherwise ignore it */ +int try_shell (const char *script); + +/* runs a group of tests ("base_something", ...) */ +int run_group (const char *path); + +#endif
tools/perf/tests/tests.h +1 -0
@@ -79,6 +79,7 @@ int test__bpf(int subtest);const char *test__bpf_subtest_get_desc (int subtest);int test__bpf_subtest_get_nr (void );int test_session_topology (int subtest); +int test__suite (int subtest);#if defined(__arm__) || defined(__aarch64__)#ifdef HAVE_DWARF_UNWIND_SUPPORT
Quoted 7 lines · Michael Petlan
In order to be able to run the bash/subcommand-based testsuite directly from perf test a new perf-test entry has been created for it.
The driver (
suite.c) runs all the tests that it finds in the testsuite
directory:tools/perf/testsuite/(rather ./testsuite as it expects it
it being run from the perf's directory).
Quoted 8 lines
In case the testsuite is not found, the testcase is skipped. If this is not the desired behaviour, some packaging will be needed.
Usage:
./perf test suiteor
./perf test suite -v
so -v has following output now:
--- SNIP
[jolsa@krava perf]$ sudo ./perf test suite -v
38: Testsuite :
--- start ---
test child forked, pid 11670
======== base_annotate ========
-- [ PASS ] -- perf_annotate :: setup :: building the example code
Line did not match any pattern: "Lowering default frequency rate to 2000."
Line did not match any pattern: "Please consider tweaking /proc/sys/kernel/perf_event_max_sample_rate." -- [ FAIL ] -- perf_annotate :: setup :: record data (output regexp parsing)
## [ FAIL ] ## perf_annotate :: setup SUMMARY :: 1 failures found
-- [ SKIP ] -- perf_annotate :: test_basic :: help message :: testcase skipped
-- [ PASS ] -- perf_annotate :: test_basic :: basic execution - annotate
-- [ PASS ] -- perf_annotate :: test_basic :: dso filter
-- [ PASS ] -- perf_annotate :: test_basic :: no-source
-- [ PASS ] -- perf_annotate :: test_basic :: full-paths
-- [ PASS ] -- perf_annotate :: test_basic :: print-line
-- [ PASS ] -- perf_annotate :: test_basic :: redirected input
-- [ PASS ] -- perf_annotate :: test_basic :: execution without data
## [ PASS ] ## perf_annotate :: test_basic SUMMARY
-- [ PASS ] -- perf_annotate :: cleanup :: clean-up logs
======== base_buildid ========
## [ PASS ] ## perf_buildid-cache :: setup SUMMARY
-- [ SKIP ] -- perf_buildid-cache :: test_buildid-list :: help message :: testcase skipped Line did not match any pattern: "2e228243285efef5d8b66c729703b4aebdd12c86 [kernel.kallsyms]" Line did not match any pattern: "b5105437a54662622e6d461cf3036e79e9261f4f [vdso]"
Usage: file [-bcEhikLlNnprsvz0] [--apple] [--mime-encoding] [--mime-type]
[-e testname] [-F separator] [-f namefile] [-m magicfiles] file ...
file -C [-m magicfiles]
file [--help]
Usage: file [-bcEhikLlNnprsvz0] [--apple] [--mime-encoding] [--mime-type]
[-e testname] [-F separator] [-f namefile] [-m magicfiles] file ...
file -C [-m magicfiles]
file [--help]
-- [ FAIL ] -- perf_buildid-cache :: test_buildid-list :: buildids check (output regexp parsing)
...
--- SNIP
could you ensure following output:
[jolsa@krava perf]$ sudo ./perf test suite
38: Testsuite : FAILED!
[jolsa@krava perf]$ sudo ./perf test suite -v
38: Testsuite :
--- start ---
test child forked, pid 11670
-- [ PASS ] -- perf_annotate :: setup :: building the example code
-- [ FAIL ] -- perf_annotate :: setup :: record data (output regexp parsing)
## [ FAIL ] ## perf_annotate :: setup SUMMARY :: 1 failures found
-- [ SKIP ] -- perf_annotate :: test_basic :: help message :: testcase skipped -- [ PASS ] -- perf_annotate :: test_basic :: basic execution - annotate
-- [ PASS ] -- perf_annotate :: test_basic :: dso filter
-- [ PASS ] -- perf_annotate :: test_basic :: no-source
-- [ PASS ] -- perf_annotate :: test_basic :: full-paths
-- [ PASS ] -- perf_annotate :: test_basic :: print-line
-- [ PASS ] -- perf_annotate :: test_basic :: redirected input
-- [ PASS ] -- perf_annotate :: test_basic :: execution without data
## [ PASS ] ## perf_annotate :: test_basic SUMMARY
-- [ PASS ] -- perf_annotate :: cleanup :: clean-up logs
## [ PASS ] ## perf_buildid-cache :: setup SUMMARY
-- [ SKIP ] -- perf_buildid-cache :: test_buildid-list :: help message :: testcase skipped -- [ FAIL ] -- perf_buildid-cache :: test_buildid-list :: buildids check (output regexp parsing)
...
[jolsa@krava perf]$ sudo ./perf test suite -vv unleash the hell ;-)
or even add -vvv ... would be suite developers choice anyway ;-)
thanks,
jirka