License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 21:07:57 +07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 04:58:32 +07:00
|
|
|
/*
|
|
|
|
* builtin-test.c
|
|
|
|
*
|
|
|
|
* Builtin regression testing command: ever growing number of sanity tests
|
|
|
|
*/
|
2017-09-11 20:50:26 +07:00
|
|
|
#include <fcntl.h>
|
2017-04-18 20:46:11 +07:00
|
|
|
#include <errno.h>
|
2014-05-10 22:22:30 +07:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
2017-08-04 02:49:15 +07:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <dirent.h>
|
2017-04-20 05:06:30 +07:00
|
|
|
#include <sys/wait.h>
|
2017-08-04 02:49:15 +07:00
|
|
|
#include <sys/stat.h>
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 04:58:32 +07:00
|
|
|
#include "builtin.h"
|
2014-10-10 02:16:00 +07:00
|
|
|
#include "hist.h"
|
2013-01-25 02:22:55 +07:00
|
|
|
#include "intlist.h"
|
2012-11-10 07:46:41 +07:00
|
|
|
#include "tests.h"
|
2012-11-10 07:46:51 +07:00
|
|
|
#include "debug.h"
|
|
|
|
#include "color.h"
|
2015-12-15 22:39:39 +07:00
|
|
|
#include <subcmd/parse-options.h>
|
2017-08-04 02:49:15 +07:00
|
|
|
#include "string2.h"
|
2012-11-10 07:46:51 +07:00
|
|
|
#include "symbol.h"
|
2017-04-17 21:39:06 +07:00
|
|
|
#include <linux/kernel.h>
|
2017-08-04 02:49:15 +07:00
|
|
|
#include <subcmd/exec-cmd.h>
|
2011-01-04 20:55:27 +07:00
|
|
|
|
2016-06-28 18:29:01 +07:00
|
|
|
static bool dont_fork;
|
|
|
|
|
2015-10-05 21:40:19 +07:00
|
|
|
struct test __weak arch_tests[] = {
|
|
|
|
{
|
|
|
|
.func = NULL,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct test generic_tests[] = {
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 04:58:32 +07:00
|
|
|
{
|
|
|
|
.desc = "vmlinux symtab matches kallsyms",
|
|
|
|
.func = test__vmlinux_matches_kallsyms,
|
|
|
|
},
|
2011-01-04 09:16:20 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Detect openat syscall event",
|
2015-04-16 20:52:53 +07:00
|
|
|
.func = test__openat_syscall_event,
|
2011-01-04 09:16:20 +07:00
|
|
|
},
|
2011-01-04 20:55:27 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Detect openat syscall event on all cpus",
|
2015-04-16 20:52:53 +07:00
|
|
|
.func = test__openat_syscall_event_on_all_cpus,
|
2011-01-04 20:55:27 +07:00
|
|
|
},
|
2011-01-15 19:42:46 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Read samples using the mmap interface",
|
2011-01-15 19:42:46 +07:00
|
|
|
.func = test__basic_mmap,
|
|
|
|
},
|
2017-08-17 05:21:56 +07:00
|
|
|
{
|
|
|
|
.desc = "Test data source output",
|
|
|
|
.func = test__mem,
|
|
|
|
},
|
2011-07-14 16:25:33 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Parse event definition strings",
|
2012-11-10 07:46:51 +07:00
|
|
|
.func = test__parse_events,
|
2011-07-14 16:25:33 +07:00
|
|
|
},
|
2017-03-21 03:17:05 +07:00
|
|
|
{
|
|
|
|
.desc = "Simple expression parser",
|
|
|
|
.func = test__expr,
|
|
|
|
},
|
2011-12-02 20:13:50 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "PERF_RECORD_* events & perf_sample fields",
|
2011-12-02 20:13:50 +07:00
|
|
|
.func = test__PERF_RECORD,
|
|
|
|
},
|
2012-03-16 02:09:17 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Parse perf pmu format",
|
2012-11-10 07:46:50 +07:00
|
|
|
.func = test__pmu,
|
2012-03-16 02:09:17 +07:00
|
|
|
},
|
2012-07-22 19:14:40 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "DSO data read",
|
2012-11-10 07:46:51 +07:00
|
|
|
.func = test__dso_data,
|
2012-07-22 19:14:40 +07:00
|
|
|
},
|
2014-05-12 19:43:53 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "DSO data cache",
|
2014-05-12 19:43:53 +07:00
|
|
|
.func = test__dso_data_cache,
|
|
|
|
},
|
2014-05-12 19:50:03 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "DSO data reopen",
|
2014-05-12 19:50:03 +07:00
|
|
|
.func = test__dso_data_reopen,
|
|
|
|
},
|
2012-09-06 23:11:18 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Roundtrip evsel->name",
|
2012-11-10 07:46:47 +07:00
|
|
|
.func = test__perf_evsel__roundtrip_name_test,
|
2012-09-06 23:11:18 +07:00
|
|
|
},
|
2012-09-18 21:56:28 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Parse sched tracepoints fields",
|
2012-11-10 07:46:48 +07:00
|
|
|
.func = test__perf_evsel__tp_sched_test,
|
2012-09-18 21:56:28 +07:00
|
|
|
},
|
2012-09-26 23:23:10 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "syscalls:sys_enter_openat event fields",
|
2015-04-16 20:52:53 +07:00
|
|
|
.func = test__syscall_openat_tp_fields,
|
2012-09-26 23:23:10 +07:00
|
|
|
},
|
2012-10-31 05:02:05 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Setup struct perf_event_attr",
|
2012-11-10 07:46:51 +07:00
|
|
|
.func = test__attr,
|
2012-10-31 05:02:05 +07:00
|
|
|
},
|
2012-12-10 15:29:57 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Match and link multiple hists",
|
2012-12-10 15:29:57 +07:00
|
|
|
.func = test__hists_link,
|
|
|
|
},
|
2012-12-14 23:06:13 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "'import perf' in python",
|
2012-12-14 23:06:13 +07:00
|
|
|
.func = test__python_use,
|
|
|
|
},
|
2013-03-11 01:41:10 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Breakpoint overflow signal handler",
|
2013-03-11 01:41:10 +07:00
|
|
|
.func = test__bp_signal,
|
2017-06-02 03:54:50 +07:00
|
|
|
.is_supported = test__bp_signal_is_supported,
|
2013-03-11 01:41:10 +07:00
|
|
|
},
|
2013-03-11 01:41:11 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Breakpoint overflow sampling",
|
2013-03-11 01:41:11 +07:00
|
|
|
.func = test__bp_signal_overflow,
|
2017-06-02 03:54:50 +07:00
|
|
|
.is_supported = test__bp_signal_is_supported,
|
2013-03-11 01:41:11 +07:00
|
|
|
},
|
2018-03-12 20:45:48 +07:00
|
|
|
{
|
|
|
|
.desc = "Breakpoint accounting",
|
|
|
|
.func = test__bp_accounting,
|
2018-04-12 23:21:40 +07:00
|
|
|
.is_supported = test__bp_signal_is_supported,
|
2018-03-12 20:45:48 +07:00
|
|
|
},
|
2018-09-12 13:12:29 +07:00
|
|
|
{
|
|
|
|
.desc = "Watchpoint",
|
|
|
|
.func = test__wp,
|
2018-09-28 17:53:35 +07:00
|
|
|
.is_supported = test__wp_is_supported,
|
2018-09-12 13:12:29 +07:00
|
|
|
.subtest = {
|
|
|
|
.skip_if_fail = false,
|
|
|
|
.get_nr = test__wp_subtest_get_nr,
|
|
|
|
.get_desc = test__wp_subtest_get_desc,
|
|
|
|
},
|
|
|
|
},
|
2013-03-15 12:58:11 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Number of exit events of a simple workload",
|
2013-03-15 12:58:11 +07:00
|
|
|
.func = test__task_exit,
|
|
|
|
},
|
2013-03-18 09:41:47 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Software clock events period values",
|
2013-03-18 09:41:47 +07:00
|
|
|
.func = test__sw_clock_freq,
|
|
|
|
},
|
2013-08-07 18:38:45 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Object code reading",
|
2013-08-07 18:38:45 +07:00
|
|
|
.func = test__code_reading,
|
|
|
|
},
|
2013-08-27 15:23:13 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Sample parsing",
|
2013-08-27 15:23:13 +07:00
|
|
|
.func = test__sample_parsing,
|
|
|
|
},
|
2013-09-01 01:50:53 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Use a dummy software event to keep tracking",
|
2013-09-01 01:50:53 +07:00
|
|
|
.func = test__keep_tracking,
|
|
|
|
},
|
2013-09-05 03:18:16 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Parse with no sample_id_all bit set",
|
2013-09-05 03:18:16 +07:00
|
|
|
.func = test__parse_no_sample_id_all,
|
|
|
|
},
|
2014-04-25 10:28:14 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Filter hist entries",
|
2014-04-25 10:28:14 +07:00
|
|
|
.func = test__hists_filter,
|
|
|
|
},
|
2014-03-05 23:20:31 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Lookup mmap thread",
|
2014-03-05 23:20:31 +07:00
|
|
|
.func = test__mmap_thread_lookup,
|
|
|
|
},
|
2014-03-17 20:39:00 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Share thread mg",
|
2014-03-17 20:39:00 +07:00
|
|
|
.func = test__thread_mg_share,
|
|
|
|
},
|
2014-05-12 12:43:18 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Sort output of hist entries",
|
2014-05-12 12:43:18 +07:00
|
|
|
.func = test__hists_output,
|
|
|
|
},
|
2014-05-23 16:04:42 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Cumulate child hist entries",
|
2014-05-23 16:04:42 +07:00
|
|
|
.func = test__hists_cumulate,
|
|
|
|
},
|
2014-08-16 02:08:36 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Track with sched_switch",
|
2014-08-16 02:08:36 +07:00
|
|
|
.func = test__switch_tracking,
|
|
|
|
},
|
perf tests: Add test for perf_evlist__filter_pollfd()
That will use a synthetic evlist with just what is touched by this new
method to check that it works as expected.
Output in verbose mode:
$ perf test -v pollfd
33: Filter fds with revents mask in a pollfd array :
--- start ---
filtering all but pollfd[2]:
before: 5 [ 5, 4, 3, 2, 1 ]
after: 1 [ 3 ]
filtering all but (pollfd[0], pollfd[3]):
before: 5 [ 5, 4, 3, 2, 1 ]
after: 2 [ 5, 2 ]
test child finished with 0
---- end ----
Filter fds with revents mask in a pollfd array: Ok
$
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-x7c8liszdvc3ocmanf2cet8p@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2014-08-13 09:34:06 +07:00
|
|
|
{
|
2014-09-04 04:02:59 +07:00
|
|
|
.desc = "Filter fds with revents mask in a fdarray",
|
|
|
|
.func = test__fdarray__filter,
|
perf tests: Add test for perf_evlist__filter_pollfd()
That will use a synthetic evlist with just what is touched by this new
method to check that it works as expected.
Output in verbose mode:
$ perf test -v pollfd
33: Filter fds with revents mask in a pollfd array :
--- start ---
filtering all but pollfd[2]:
before: 5 [ 5, 4, 3, 2, 1 ]
after: 1 [ 3 ]
filtering all but (pollfd[0], pollfd[3]):
before: 5 [ 5, 4, 3, 2, 1 ]
after: 2 [ 5, 2 ]
test child finished with 0
---- end ----
Filter fds with revents mask in a pollfd array: Ok
$
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-x7c8liszdvc3ocmanf2cet8p@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2014-08-13 09:34:06 +07:00
|
|
|
},
|
perf tests: Add pollfd growing test
[acme@ssdandy linux]$ perf test "Add fd"
34: Add fd to pollfd array, making it autogrow : Ok
[acme@ssdandy linux]$ perf test -v "Add fd"
34: Add fd to pollfd array, making it autogrow :
--- start ---
test child forked, pid 19817
before growing array: 2 [ 1, 2 ]
after 3rd add_pollfd: 3 [ 1, 2, 35 ]
after 4th add_pollfd: 4 [ 1, 2, 35, 88 ]
test child finished with 0
---- end ----
Add fd to pollfd array, making it autogrow: Ok
[acme@ssdandy linux]$
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jean Pihet <jean.pihet@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-smflpyta146bzog7z0effjss@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2014-08-19 02:49:00 +07:00
|
|
|
{
|
2014-09-04 04:02:59 +07:00
|
|
|
.desc = "Add fd to a fdarray, making it autogrow",
|
|
|
|
.func = test__fdarray__add,
|
perf tests: Add pollfd growing test
[acme@ssdandy linux]$ perf test "Add fd"
34: Add fd to pollfd array, making it autogrow : Ok
[acme@ssdandy linux]$ perf test -v "Add fd"
34: Add fd to pollfd array, making it autogrow :
--- start ---
test child forked, pid 19817
before growing array: 2 [ 1, 2 ]
after 3rd add_pollfd: 3 [ 1, 2, 35 ]
after 4th add_pollfd: 4 [ 1, 2, 35, 88 ]
test child finished with 0
---- end ----
Add fd to pollfd array, making it autogrow: Ok
[acme@ssdandy linux]$
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jean Pihet <jean.pihet@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-smflpyta146bzog7z0effjss@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2014-08-19 02:49:00 +07:00
|
|
|
},
|
perf tools: Add kmod_path__parse function
Provides united way of parsing kernel module path
into several components.
The new kmod_path__parse function and few defines:
int __kmod_path__parse(struct kmod_path *m, const char *path,
bool alloc_name, bool alloc_ext);
#define kmod_path__parse(__m, __p) __kmod_path__parse(__m, __p, false, false)
#define kmod_path__parse_name(__m, __p) __kmod_path__parse(__m, __p, true , false)
#define kmod_path__parse_ext(__m, __p) __kmod_path__parse(__m, __p, false, true)
parse kernel module @path and updates @m argument like:
@comp - true if @path contains supported compression suffix,
false otherwise
@kmod - true if @path contains '.ko' suffix in right position,
false otherwise
@name - if (@alloc_name && @kmod) is true, it contains strdup-ed base name
of the kernel module without suffixes, otherwise strudup-ed
base name of @path
@ext - if (@alloc_ext && @comp) is true, it contains strdup-ed string
the compression suffix
It returns 0 if there's no strdup error, -ENOMEM otherwise.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-9t6eqg8j610r94l743hkntiv@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-02-05 21:40:25 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "kmod_path__parse",
|
perf tools: Add kmod_path__parse function
Provides united way of parsing kernel module path
into several components.
The new kmod_path__parse function and few defines:
int __kmod_path__parse(struct kmod_path *m, const char *path,
bool alloc_name, bool alloc_ext);
#define kmod_path__parse(__m, __p) __kmod_path__parse(__m, __p, false, false)
#define kmod_path__parse_name(__m, __p) __kmod_path__parse(__m, __p, true , false)
#define kmod_path__parse_ext(__m, __p) __kmod_path__parse(__m, __p, false, true)
parse kernel module @path and updates @m argument like:
@comp - true if @path contains supported compression suffix,
false otherwise
@kmod - true if @path contains '.ko' suffix in right position,
false otherwise
@name - if (@alloc_name && @kmod) is true, it contains strdup-ed base name
of the kernel module without suffixes, otherwise strudup-ed
base name of @path
@ext - if (@alloc_ext && @comp) is true, it contains strdup-ed string
the compression suffix
It returns 0 if there's no strdup error, -ENOMEM otherwise.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-9t6eqg8j610r94l743hkntiv@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-02-05 21:40:25 +07:00
|
|
|
.func = test__kmod_path__parse,
|
|
|
|
},
|
2015-06-26 16:29:08 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Thread map",
|
2015-06-26 16:29:08 +07:00
|
|
|
.func = test__thread_map,
|
|
|
|
},
|
2015-07-08 17:04:02 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "LLVM search and compile",
|
2015-07-08 17:04:02 +07:00
|
|
|
.func = test__llvm,
|
2015-11-17 15:32:48 +07:00
|
|
|
.subtest = {
|
|
|
|
.skip_if_fail = true,
|
|
|
|
.get_nr = test__llvm_subtest_get_nr,
|
|
|
|
.get_desc = test__llvm_subtest_get_desc,
|
|
|
|
},
|
2015-07-08 17:04:02 +07:00
|
|
|
},
|
2015-09-04 15:58:31 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Session topology",
|
2017-08-04 01:16:31 +07:00
|
|
|
.func = test__session_topology,
|
2015-09-04 15:58:31 +07:00
|
|
|
},
|
2015-11-06 20:49:43 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "BPF filter",
|
2015-11-06 20:49:43 +07:00
|
|
|
.func = test__bpf,
|
2015-11-17 15:32:49 +07:00
|
|
|
.subtest = {
|
|
|
|
.skip_if_fail = true,
|
|
|
|
.get_nr = test__bpf_subtest_get_nr,
|
|
|
|
.get_desc = test__bpf_subtest_get_desc,
|
|
|
|
},
|
2015-11-06 20:49:43 +07:00
|
|
|
},
|
2015-10-25 21:51:20 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Synthesize thread map",
|
2015-10-25 21:51:20 +07:00
|
|
|
.func = test__thread_map_synthesize,
|
|
|
|
},
|
2016-12-12 17:35:41 +07:00
|
|
|
{
|
|
|
|
.desc = "Remove thread map",
|
|
|
|
.func = test__thread_map_remove,
|
|
|
|
},
|
2015-10-25 21:51:24 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Synthesize cpu map",
|
2015-10-25 21:51:24 +07:00
|
|
|
.func = test__cpu_map_synthesize,
|
|
|
|
},
|
2015-10-25 21:51:28 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Synthesize stat config",
|
2015-10-25 21:51:28 +07:00
|
|
|
.func = test__synthesize_stat_config,
|
|
|
|
},
|
2015-10-25 21:51:31 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Synthesize stat",
|
2015-10-25 21:51:31 +07:00
|
|
|
.func = test__synthesize_stat,
|
|
|
|
},
|
2015-10-25 21:51:34 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Synthesize stat round",
|
2015-10-25 21:51:34 +07:00
|
|
|
.func = test__synthesize_stat_round,
|
|
|
|
},
|
2015-10-25 21:51:37 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Synthesize attr update",
|
2015-10-25 21:51:37 +07:00
|
|
|
.func = test__event_update,
|
|
|
|
},
|
perf tests: Add test to check for event times
This test creates software event 'cpu-clock' attaches it in several ways
and checks that enabled and running times match.
Committer notes:
Testing it:
[acme@jouet linux]$ perf test -v times
44: Test events times :
--- start ---
test child forked, pid 27170
attaching to spawned child, enable on exec
OK : ena 307328, run 307328
attaching to current thread as enabled
OK : ena 7826, run 7826
attaching to current thread as disabled
OK : ena 738, run 738
attaching to CPU 0 as enabled
SKIP : not enough rights
attaching to CPU 0 as enabled
SKIP : not enough rights
test child finished with -2
---- end ----
Test events times: Skip
[acme@jouet linux]$
[root@jouet ~]# perf test times
44: Test events times : Ok
[root@jouet ~]# perf test -v times
44: Test events times :
--- start ---
test child forked, pid 27306
attaching to spawned child, enable on exec
OK : ena 479290, run 479290
attaching to current thread as enabled
OK : ena 11356, run 11356
attaching to current thread as disabled
OK : ena 987, run 987
attaching to CPU 0 as enabled
OK : ena 3717, run 3717
attaching to CPU 0 as enabled
OK : ena 2323, run 2323
test child finished with 0
---- end ----
Test events times: Ok
[root@jouet ~]#
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1458823940-24583-7-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-03-24 19:52:20 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Event times",
|
perf tests: Add test to check for event times
This test creates software event 'cpu-clock' attaches it in several ways
and checks that enabled and running times match.
Committer notes:
Testing it:
[acme@jouet linux]$ perf test -v times
44: Test events times :
--- start ---
test child forked, pid 27170
attaching to spawned child, enable on exec
OK : ena 307328, run 307328
attaching to current thread as enabled
OK : ena 7826, run 7826
attaching to current thread as disabled
OK : ena 738, run 738
attaching to CPU 0 as enabled
SKIP : not enough rights
attaching to CPU 0 as enabled
SKIP : not enough rights
test child finished with -2
---- end ----
Test events times: Skip
[acme@jouet linux]$
[root@jouet ~]# perf test times
44: Test events times : Ok
[root@jouet ~]# perf test -v times
44: Test events times :
--- start ---
test child forked, pid 27306
attaching to spawned child, enable on exec
OK : ena 479290, run 479290
attaching to current thread as enabled
OK : ena 11356, run 11356
attaching to current thread as disabled
OK : ena 987, run 987
attaching to CPU 0 as enabled
OK : ena 3717, run 3717
attaching to CPU 0 as enabled
OK : ena 2323, run 2323
test child finished with 0
---- end ----
Test events times: Ok
[root@jouet ~]#
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1458823940-24583-7-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-03-24 19:52:20 +07:00
|
|
|
.func = test__event_times,
|
|
|
|
},
|
2016-05-09 08:47:51 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Read backward ring buffer",
|
2016-05-09 08:47:51 +07:00
|
|
|
.func = test__backward_ring_buffer,
|
|
|
|
},
|
2016-06-28 18:29:04 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Print cpu map",
|
2016-06-28 18:29:04 +07:00
|
|
|
.func = test__cpu_map_print,
|
|
|
|
},
|
2016-07-12 17:06:05 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Probe SDT events",
|
2016-07-12 17:06:05 +07:00
|
|
|
.func = test__sdt_event,
|
|
|
|
},
|
2016-07-16 23:11:20 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "is_printable_array",
|
2016-07-16 23:11:20 +07:00
|
|
|
.func = test__is_printable_array,
|
|
|
|
},
|
2016-08-02 01:02:32 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Print bitmap",
|
2016-08-02 01:02:32 +07:00
|
|
|
.func = test__bitmap_print,
|
|
|
|
},
|
2016-11-26 14:03:28 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "perf hooks",
|
2016-11-26 14:03:28 +07:00
|
|
|
.func = test__perf_hooks,
|
|
|
|
},
|
2016-11-26 14:03:34 +07:00
|
|
|
{
|
|
|
|
.desc = "builtin clang support",
|
|
|
|
.func = test__clang,
|
|
|
|
.subtest = {
|
|
|
|
.skip_if_fail = true,
|
|
|
|
.get_nr = test__clang_subtest_get_nr,
|
|
|
|
.get_desc = test__clang_subtest_get_desc,
|
|
|
|
}
|
|
|
|
},
|
2017-01-09 16:51:55 +07:00
|
|
|
{
|
|
|
|
.desc = "unit_number__scnprintf",
|
|
|
|
.func = test__unit_number__scnprint,
|
|
|
|
},
|
2018-03-09 17:14:36 +07:00
|
|
|
{
|
|
|
|
.desc = "mem2node",
|
|
|
|
.func = test__mem2node,
|
|
|
|
},
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 04:58:32 +07:00
|
|
|
{
|
|
|
|
.func = NULL,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2015-10-05 21:40:19 +07:00
|
|
|
static struct test *tests[] = {
|
|
|
|
generic_tests,
|
|
|
|
arch_tests,
|
|
|
|
};
|
|
|
|
|
2015-09-06 02:02:20 +07:00
|
|
|
static bool perf_test__matches(struct test *test, int curr, int argc, const char *argv[])
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 04:58:32 +07:00
|
|
|
{
|
2011-11-29 21:52:07 +07:00
|
|
|
int i;
|
|
|
|
|
|
|
|
if (argc == 0)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
for (i = 0; i < argc; ++i) {
|
|
|
|
char *end;
|
|
|
|
long nr = strtoul(argv[i], &end, 10);
|
|
|
|
|
|
|
|
if (*end == '\0') {
|
|
|
|
if (nr == curr + 1)
|
|
|
|
return true;
|
|
|
|
continue;
|
|
|
|
}
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 04:58:32 +07:00
|
|
|
|
2015-11-07 03:03:38 +07:00
|
|
|
if (strcasestr(test->desc, argv[i]))
|
2011-11-29 21:52:07 +07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
perf tests: Pass the subtest index to each test routine
Some tests have sub-tests we want to run, so allow passing this.
Wang tried to avoid having to touch all tests, but then, having the
test.func in an anonymous union makes the build fail on older compilers,
like the one in RHEL6, where:
test a = {
.func = foo,
};
fails.
To fix it leave the func pointer in the main structure and pass the subtest
index to all tests, end result function is the same, but we have just one
function pointer, not two, with and without the subtest index as an argument.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-5genj0ficwdmelpoqlds0u4y@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-11-19 22:01:48 +07:00
|
|
|
static int run_test(struct test *test, int subtest)
|
2014-05-10 22:22:30 +07:00
|
|
|
{
|
2016-06-28 18:29:01 +07:00
|
|
|
int status, err = -1, child = dont_fork ? 0 : fork();
|
2014-08-14 09:22:45 +07:00
|
|
|
char sbuf[STRERR_BUFSIZE];
|
2014-05-10 22:22:30 +07:00
|
|
|
|
|
|
|
if (child < 0) {
|
2014-08-14 09:22:45 +07:00
|
|
|
pr_err("failed to fork test: %s\n",
|
tools: Introduce str_error_r()
The tools so far have been using the strerror_r() GNU variant, that
returns a string, be it the buffer passed or something else.
But that, besides being tricky in cases where we expect that the
function using strerror_r() returns the error formatted in a provided
buffer (we have to check if it returned something else and copy that
instead), breaks the build on systems not using glibc, like Alpine
Linux, where musl libc is used.
So, introduce yet another wrapper, str_error_r(), that has the GNU
interface, but uses the portable XSI variant of strerror_r(), so that
users rest asured that the provided buffer is used and it is what is
returned.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-d4t42fnf48ytlk8rjxs822tf@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-07-06 21:56:20 +07:00
|
|
|
str_error_r(errno, sbuf, sizeof(sbuf)));
|
2014-05-10 22:22:30 +07:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!child) {
|
2016-06-28 18:29:01 +07:00
|
|
|
if (!dont_fork) {
|
|
|
|
pr_debug("test child forked, pid %d\n", getpid());
|
|
|
|
|
2017-02-17 15:17:38 +07:00
|
|
|
if (verbose <= 0) {
|
2016-06-28 18:29:01 +07:00
|
|
|
int nullfd = open("/dev/null", O_WRONLY);
|
|
|
|
|
|
|
|
if (nullfd >= 0) {
|
|
|
|
close(STDERR_FILENO);
|
|
|
|
close(STDOUT_FILENO);
|
|
|
|
|
|
|
|
dup2(nullfd, STDOUT_FILENO);
|
|
|
|
dup2(STDOUT_FILENO, STDERR_FILENO);
|
|
|
|
close(nullfd);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
signal(SIGSEGV, sighandler_dump_stack);
|
|
|
|
signal(SIGFPE, sighandler_dump_stack);
|
2015-11-17 15:32:50 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-04 01:16:31 +07:00
|
|
|
err = test->func(test, subtest);
|
2016-06-28 18:29:01 +07:00
|
|
|
if (!dont_fork)
|
|
|
|
exit(err);
|
2014-05-10 22:22:30 +07:00
|
|
|
}
|
|
|
|
|
2016-06-28 18:29:01 +07:00
|
|
|
if (!dont_fork) {
|
|
|
|
wait(&status);
|
2014-05-10 22:22:30 +07:00
|
|
|
|
2016-06-28 18:29:01 +07:00
|
|
|
if (WIFEXITED(status)) {
|
|
|
|
err = (signed char)WEXITSTATUS(status);
|
|
|
|
pr_debug("test child finished with %d\n", err);
|
|
|
|
} else if (WIFSIGNALED(status)) {
|
|
|
|
err = -1;
|
|
|
|
pr_debug("test child interrupted\n");
|
|
|
|
}
|
2014-05-10 22:22:30 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2015-10-05 21:40:19 +07:00
|
|
|
#define for_each_test(j, t) \
|
|
|
|
for (j = 0; j < ARRAY_SIZE(tests); j++) \
|
|
|
|
for (t = &tests[j][0]; t->func; t++)
|
2015-09-06 02:02:20 +07:00
|
|
|
|
2015-11-17 15:32:48 +07:00
|
|
|
static int test_and_print(struct test *t, bool force_skip, int subtest)
|
|
|
|
{
|
|
|
|
int err;
|
|
|
|
|
|
|
|
if (!force_skip) {
|
|
|
|
pr_debug("\n--- start ---\n");
|
|
|
|
err = run_test(t, subtest);
|
|
|
|
pr_debug("---- end ----\n");
|
|
|
|
} else {
|
|
|
|
pr_debug("\n--- force skipped ---\n");
|
|
|
|
err = TEST_SKIP;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!t->subtest.get_nr)
|
|
|
|
pr_debug("%s:", t->desc);
|
|
|
|
else
|
2018-07-27 00:17:33 +07:00
|
|
|
pr_debug("%s subtest %d:", t->desc, subtest + 1);
|
2015-11-17 15:32:48 +07:00
|
|
|
|
|
|
|
switch (err) {
|
|
|
|
case TEST_OK:
|
|
|
|
pr_info(" Ok\n");
|
|
|
|
break;
|
|
|
|
case TEST_SKIP:
|
|
|
|
color_fprintf(stderr, PERF_COLOR_YELLOW, " Skip\n");
|
|
|
|
break;
|
|
|
|
case TEST_FAIL:
|
|
|
|
default:
|
|
|
|
color_fprintf(stderr, PERF_COLOR_RED, " FAILED!\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2017-08-04 02:49:15 +07:00
|
|
|
static const char *shell_test__description(char *description, size_t size,
|
|
|
|
const char *path, const char *name)
|
|
|
|
{
|
|
|
|
FILE *fp;
|
|
|
|
char filename[PATH_MAX];
|
|
|
|
|
|
|
|
path__join(filename, sizeof(filename), path, name);
|
|
|
|
fp = fopen(filename, "r");
|
|
|
|
if (!fp)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
description = fgets(description, size, fp);
|
|
|
|
fclose(fp);
|
|
|
|
|
|
|
|
return description ? trim(description + 1) : NULL;
|
|
|
|
}
|
|
|
|
|
2017-12-07 00:45:35 +07:00
|
|
|
#define for_each_shell_test(dir, base, ent) \
|
2017-08-04 02:49:15 +07:00
|
|
|
while ((ent = readdir(dir)) != NULL) \
|
2018-06-30 00:46:58 +07:00
|
|
|
if (!is_directory(base, ent) && ent->d_name[0] != '.')
|
2017-08-04 02:49:15 +07:00
|
|
|
|
|
|
|
static const char *shell_tests__dir(char *path, size_t size)
|
|
|
|
{
|
|
|
|
const char *devel_dirs[] = { "./tools/perf/tests", "./tests", };
|
|
|
|
char *exec_path;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(devel_dirs); ++i) {
|
|
|
|
struct stat st;
|
|
|
|
if (!lstat(devel_dirs[i], &st)) {
|
|
|
|
scnprintf(path, size, "%s/shell", devel_dirs[i]);
|
|
|
|
if (!lstat(devel_dirs[i], &st))
|
|
|
|
return path;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Then installed path. */
|
|
|
|
exec_path = get_argv_exec_path();
|
|
|
|
scnprintf(path, size, "%s/tests/shell", exec_path);
|
|
|
|
free(exec_path);
|
|
|
|
return path;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int shell_tests__max_desc_width(void)
|
|
|
|
{
|
|
|
|
DIR *dir;
|
|
|
|
struct dirent *ent;
|
|
|
|
char path_dir[PATH_MAX];
|
|
|
|
const char *path = shell_tests__dir(path_dir, sizeof(path_dir));
|
|
|
|
int width = 0;
|
|
|
|
|
|
|
|
if (path == NULL)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
dir = opendir(path);
|
|
|
|
if (!dir)
|
|
|
|
return -1;
|
|
|
|
|
2017-12-07 00:45:35 +07:00
|
|
|
for_each_shell_test(dir, path, ent) {
|
2017-08-04 02:49:15 +07:00
|
|
|
char bf[256];
|
|
|
|
const char *desc = shell_test__description(bf, sizeof(bf), path, ent->d_name);
|
|
|
|
|
|
|
|
if (desc) {
|
|
|
|
int len = strlen(desc);
|
|
|
|
|
|
|
|
if (width < len)
|
|
|
|
width = len;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
closedir(dir);
|
|
|
|
return width;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct shell_test {
|
|
|
|
const char *dir;
|
|
|
|
const char *file;
|
|
|
|
};
|
|
|
|
|
|
|
|
static int shell_test__run(struct test *test, int subdir __maybe_unused)
|
|
|
|
{
|
|
|
|
int err;
|
|
|
|
char script[PATH_MAX];
|
|
|
|
struct shell_test *st = test->priv;
|
|
|
|
|
|
|
|
path__join(script, sizeof(script), st->dir, st->file);
|
|
|
|
|
|
|
|
err = system(script);
|
|
|
|
if (!err)
|
|
|
|
return TEST_OK;
|
|
|
|
|
|
|
|
return WEXITSTATUS(err) == 2 ? TEST_SKIP : TEST_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int run_shell_tests(int argc, const char *argv[], int i, int width)
|
|
|
|
{
|
|
|
|
DIR *dir;
|
|
|
|
struct dirent *ent;
|
|
|
|
char path_dir[PATH_MAX];
|
|
|
|
struct shell_test st = {
|
|
|
|
.dir = shell_tests__dir(path_dir, sizeof(path_dir)),
|
|
|
|
};
|
|
|
|
|
|
|
|
if (st.dir == NULL)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
dir = opendir(st.dir);
|
|
|
|
if (!dir)
|
|
|
|
return -1;
|
|
|
|
|
2017-12-07 00:45:35 +07:00
|
|
|
for_each_shell_test(dir, st.dir, ent) {
|
2017-08-04 02:49:15 +07:00
|
|
|
int curr = i++;
|
|
|
|
char desc[256];
|
|
|
|
struct test test = {
|
|
|
|
.desc = shell_test__description(desc, sizeof(desc), st.dir, ent->d_name),
|
|
|
|
.func = shell_test__run,
|
|
|
|
.priv = &st,
|
|
|
|
};
|
|
|
|
|
|
|
|
if (!perf_test__matches(&test, curr, argc, argv))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
st.file = ent->d_name;
|
|
|
|
pr_info("%2d: %-*s:", i, width, test.desc);
|
|
|
|
test_and_print(&test, false, -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
closedir(dir);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-01-25 02:22:55 +07:00
|
|
|
static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist)
|
2011-11-29 21:52:07 +07:00
|
|
|
{
|
2015-09-06 02:02:20 +07:00
|
|
|
struct test *t;
|
2015-10-05 21:40:19 +07:00
|
|
|
unsigned int j;
|
2011-11-29 21:52:07 +07:00
|
|
|
int i = 0;
|
2017-08-04 02:49:15 +07:00
|
|
|
int width = shell_tests__max_desc_width();
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 04:58:32 +07:00
|
|
|
|
2015-10-05 21:40:19 +07:00
|
|
|
for_each_test(j, t) {
|
2015-09-06 02:02:20 +07:00
|
|
|
int len = strlen(t->desc);
|
2012-10-25 00:44:41 +07:00
|
|
|
|
|
|
|
if (width < len)
|
|
|
|
width = len;
|
|
|
|
}
|
2012-10-31 05:01:43 +07:00
|
|
|
|
2015-10-05 21:40:19 +07:00
|
|
|
for_each_test(j, t) {
|
2011-11-29 21:52:07 +07:00
|
|
|
int curr = i++, err;
|
|
|
|
|
2015-09-06 02:02:20 +07:00
|
|
|
if (!perf_test__matches(t, curr, argc, argv))
|
2011-11-29 21:52:07 +07:00
|
|
|
continue;
|
|
|
|
|
2017-06-02 03:54:50 +07:00
|
|
|
if (t->is_supported && !t->is_supported()) {
|
|
|
|
pr_debug("%2d: %-*s: Disabled\n", i, width, t->desc);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2015-09-06 02:02:20 +07:00
|
|
|
pr_info("%2d: %-*s:", i, width, t->desc);
|
2013-01-25 02:22:55 +07:00
|
|
|
|
|
|
|
if (intlist__find(skiplist, i)) {
|
|
|
|
color_fprintf(stderr, PERF_COLOR_YELLOW, " Skip (user override)\n");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2015-11-17 15:32:48 +07:00
|
|
|
if (!t->subtest.get_nr) {
|
|
|
|
test_and_print(t, false, -1);
|
|
|
|
} else {
|
|
|
|
int subn = t->subtest.get_nr();
|
|
|
|
/*
|
|
|
|
* minus 2 to align with normal testcases.
|
|
|
|
* For subtest we print additional '.x' in number.
|
|
|
|
* for example:
|
|
|
|
*
|
|
|
|
* 35: Test LLVM searching and compiling :
|
|
|
|
* 35.1: Basic BPF llvm compiling test : Ok
|
|
|
|
*/
|
|
|
|
int subw = width > 2 ? width - 2 : width;
|
|
|
|
bool skip = false;
|
|
|
|
int subi;
|
|
|
|
|
|
|
|
if (subn <= 0) {
|
|
|
|
color_fprintf(stderr, PERF_COLOR_YELLOW,
|
|
|
|
" Skip (not compiled in)\n");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
pr_info("\n");
|
|
|
|
|
|
|
|
for (subi = 0; subi < subn; subi++) {
|
|
|
|
int len = strlen(t->subtest.get_desc(subi));
|
|
|
|
|
|
|
|
if (subw < len)
|
|
|
|
subw = len;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (subi = 0; subi < subn; subi++) {
|
|
|
|
pr_info("%2d.%1d: %-*s:", i, subi + 1, subw,
|
|
|
|
t->subtest.get_desc(subi));
|
2018-07-27 00:17:33 +07:00
|
|
|
err = test_and_print(t, skip, subi);
|
2015-11-17 15:32:48 +07:00
|
|
|
if (err != TEST_OK && t->subtest.skip_if_fail)
|
|
|
|
skip = true;
|
|
|
|
}
|
2012-12-19 21:33:39 +07:00
|
|
|
}
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 04:58:32 +07:00
|
|
|
}
|
|
|
|
|
2017-08-04 02:49:15 +07:00
|
|
|
return run_shell_tests(argc, argv, i, width);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int perf_test__list_shell(int argc, const char **argv, int i)
|
|
|
|
{
|
|
|
|
DIR *dir;
|
|
|
|
struct dirent *ent;
|
|
|
|
char path_dir[PATH_MAX];
|
|
|
|
const char *path = shell_tests__dir(path_dir, sizeof(path_dir));
|
|
|
|
|
|
|
|
if (path == NULL)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
dir = opendir(path);
|
|
|
|
if (!dir)
|
|
|
|
return -1;
|
|
|
|
|
2017-12-07 00:45:35 +07:00
|
|
|
for_each_shell_test(dir, path, ent) {
|
2017-08-04 21:16:40 +07:00
|
|
|
int curr = i++;
|
2017-08-04 02:49:15 +07:00
|
|
|
char bf[256];
|
2017-08-04 21:16:40 +07:00
|
|
|
struct test t = {
|
|
|
|
.desc = shell_test__description(bf, sizeof(bf), path, ent->d_name),
|
|
|
|
};
|
2017-08-04 02:49:15 +07:00
|
|
|
|
2017-08-04 21:16:40 +07:00
|
|
|
if (!perf_test__matches(&t, curr, argc, argv))
|
2017-08-04 02:49:15 +07:00
|
|
|
continue;
|
|
|
|
|
2017-08-04 21:16:40 +07:00
|
|
|
pr_info("%2d: %s\n", i, t.desc);
|
2017-08-04 02:49:15 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
closedir(dir);
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 04:58:32 +07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-11-29 21:52:07 +07:00
|
|
|
static int perf_test__list(int argc, const char **argv)
|
|
|
|
{
|
2015-10-05 21:40:19 +07:00
|
|
|
unsigned int j;
|
2015-09-06 02:02:20 +07:00
|
|
|
struct test *t;
|
2011-11-29 21:52:07 +07:00
|
|
|
int i = 0;
|
|
|
|
|
2015-10-05 21:40:19 +07:00
|
|
|
for_each_test(j, t) {
|
2017-08-04 21:16:40 +07:00
|
|
|
int curr = i++;
|
2017-08-04 21:16:40 +07:00
|
|
|
|
2017-08-04 21:16:40 +07:00
|
|
|
if (!perf_test__matches(t, curr, argc, argv) ||
|
|
|
|
(t->is_supported && !t->is_supported()))
|
2011-11-29 21:52:07 +07:00
|
|
|
continue;
|
|
|
|
|
2017-08-04 21:16:40 +07:00
|
|
|
pr_info("%2d: %s\n", i, t->desc);
|
2018-04-13 14:42:23 +07:00
|
|
|
|
|
|
|
if (t->subtest.get_nr) {
|
|
|
|
int subn = t->subtest.get_nr();
|
|
|
|
int subi;
|
|
|
|
|
|
|
|
for (subi = 0; subi < subn; subi++)
|
|
|
|
pr_info("%2d:%1d: %s\n", i, subi + 1,
|
|
|
|
t->subtest.get_desc(subi));
|
|
|
|
}
|
2011-11-29 21:52:07 +07:00
|
|
|
}
|
|
|
|
|
2017-08-04 02:49:15 +07:00
|
|
|
perf_test__list_shell(argc, argv, i);
|
|
|
|
|
2011-11-29 21:52:07 +07:00
|
|
|
return 0;
|
|
|
|
}
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 04:58:32 +07:00
|
|
|
|
2017-03-27 21:47:20 +07:00
|
|
|
int cmd_test(int argc, const char **argv)
|
2011-11-29 21:52:07 +07:00
|
|
|
{
|
2015-03-18 20:35:55 +07:00
|
|
|
const char *test_usage[] = {
|
2011-11-29 21:52:07 +07:00
|
|
|
"perf test [<options>] [{list <test-name-fragment>|[<test-name-fragments>|<test-numbers>]}]",
|
|
|
|
NULL,
|
|
|
|
};
|
2013-01-25 02:22:55 +07:00
|
|
|
const char *skip = NULL;
|
2011-11-29 21:52:07 +07:00
|
|
|
const struct option test_options[] = {
|
2013-01-25 02:22:55 +07:00
|
|
|
OPT_STRING('s', "skip", &skip, "tests", "tests to skip"),
|
2012-01-08 00:25:26 +07:00
|
|
|
OPT_INCR('v', "verbose", &verbose,
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 04:58:32 +07:00
|
|
|
"be more verbose (show symbol address, etc)"),
|
2016-06-28 18:29:01 +07:00
|
|
|
OPT_BOOLEAN('F', "dont-fork", &dont_fork,
|
|
|
|
"Do not fork for testcase"),
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 04:58:32 +07:00
|
|
|
OPT_END()
|
2011-11-29 21:52:07 +07:00
|
|
|
};
|
2015-03-18 20:35:55 +07:00
|
|
|
const char * const test_subcommands[] = { "list", NULL };
|
2013-01-25 02:22:55 +07:00
|
|
|
struct intlist *skiplist = NULL;
|
2014-10-10 02:16:00 +07:00
|
|
|
int ret = hists__init();
|
|
|
|
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 04:58:32 +07:00
|
|
|
|
2015-03-18 20:35:55 +07:00
|
|
|
argc = parse_options_subcommand(argc, argv, test_options, test_subcommands, test_usage, 0);
|
2011-11-29 21:52:07 +07:00
|
|
|
if (argc >= 1 && !strcmp(argv[0], "list"))
|
2017-08-04 21:16:40 +07:00
|
|
|
return perf_test__list(argc - 1, argv + 1);
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 04:58:32 +07:00
|
|
|
|
|
|
|
symbol_conf.priv_size = sizeof(int);
|
|
|
|
symbol_conf.sort_by_name = true;
|
|
|
|
symbol_conf.try_vmlinux_path = true;
|
|
|
|
|
2014-08-12 13:40:45 +07:00
|
|
|
if (symbol__init(NULL) < 0)
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 04:58:32 +07:00
|
|
|
return -1;
|
|
|
|
|
2013-01-25 02:22:55 +07:00
|
|
|
if (skip != NULL)
|
|
|
|
skiplist = intlist__new(skip);
|
|
|
|
|
|
|
|
return __cmd_test(argc, argv, skiplist);
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 04:58:32 +07:00
|
|
|
}
|