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 22:07:57 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2012-11-10 08:46:41 +08:00
|
|
|
#ifndef TESTS_H
|
|
|
|
#define TESTS_H
|
|
|
|
|
2015-11-17 16:32:48 +08:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2013-06-07 21:37:03 +08:00
|
|
|
#define TEST_ASSERT_VAL(text, cond) \
|
|
|
|
do { \
|
|
|
|
if (!(cond)) { \
|
|
|
|
pr_debug("FAILED %s:%d %s\n", __FILE__, __LINE__, text); \
|
|
|
|
return -1; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
2015-05-12 03:30:20 +08:00
|
|
|
#define TEST_ASSERT_EQUAL(text, val, expected) \
|
|
|
|
do { \
|
|
|
|
if (val != expected) { \
|
|
|
|
pr_debug("FAILED %s:%d %s (%d != %d)\n", \
|
|
|
|
__FILE__, __LINE__, text, val, expected); \
|
|
|
|
return -1; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
2012-12-19 22:33:39 +08:00
|
|
|
enum {
|
|
|
|
TEST_OK = 0,
|
|
|
|
TEST_FAIL = -1,
|
|
|
|
TEST_SKIP = -2,
|
|
|
|
};
|
|
|
|
|
2015-10-05 22:40:19 +08:00
|
|
|
struct test {
|
|
|
|
const char *desc;
|
2017-08-04 02:16:31 +08:00
|
|
|
int (*func)(struct test *test, int subtest);
|
2015-11-17 16:32:48 +08:00
|
|
|
struct {
|
|
|
|
bool skip_if_fail;
|
|
|
|
int (*get_nr)(void);
|
|
|
|
const char *(*get_desc)(int subtest);
|
2020-05-14 05:29:33 +08:00
|
|
|
const char *(*skip_reason)(int subtest);
|
2015-11-17 16:32:48 +08:00
|
|
|
} subtest;
|
2017-06-02 04:54:50 +08:00
|
|
|
bool (*is_supported)(void);
|
2017-08-04 03:49:15 +08:00
|
|
|
void *priv;
|
2015-10-05 22:40:19 +08:00
|
|
|
};
|
|
|
|
|
2012-11-10 08:46:42 +08:00
|
|
|
/* Tests */
|
2017-08-04 02:16:31 +08:00
|
|
|
int test__vmlinux_matches_kallsyms(struct test *test, int subtest);
|
|
|
|
int test__openat_syscall_event(struct test *test, int subtest);
|
|
|
|
int test__openat_syscall_event_on_all_cpus(struct test *test, int subtest);
|
|
|
|
int test__basic_mmap(struct test *test, int subtest);
|
|
|
|
int test__PERF_RECORD(struct test *test, int subtest);
|
|
|
|
int test__perf_evsel__roundtrip_name_test(struct test *test, int subtest);
|
|
|
|
int test__perf_evsel__tp_sched_test(struct test *test, int subtest);
|
|
|
|
int test__syscall_openat_tp_fields(struct test *test, int subtest);
|
|
|
|
int test__pmu(struct test *test, int subtest);
|
2020-03-17 19:02:16 +08:00
|
|
|
int test__pmu_events(struct test *test, int subtest);
|
perf test: Improve pmu event metric testing
Break pmu-events test into 2 and add a test to verify that all pmu
metric expressions simply parse. Try to parse all metric ids/events,
skip/warn if metrics for the current architecture fail to parse. To
support warning for a skip, and an ability for a subtest to describe why
it skips.
Tested on power9, skylakex, haswell, broadwell, westmere, sandybridge and
ivybridge.
May skip/warn on other architectures if metrics are invalid. In
particular s390 is untested, but its expressions are trivial. The
untested architectures with expressions are power8, cascadelakex,
tremontx, skylake, jaketown, ivytown and variants of haswell and
broadwell.
v3. addresses review comments from John Garry <john.garry@huawei.com>,
Jiri Olsa <jolsa@redhat.com> and Arnaldo Carvalho de Melo
<acme@kernel.org>.
v2. changes the commit message as event parsing errors no longer cause
the test to fail.
Committer notes:
Check the return value of strtod() to fix the build in systems where
that function is declared with attribute warn_unused_result.
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Clarke <pc@us.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20200513212933.41273-1-irogers@google.com
[ split from a larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2020-05-14 05:29:33 +08:00
|
|
|
const char *test__pmu_events_subtest_get_desc(int subtest);
|
|
|
|
const char *test__pmu_events_subtest_skip_reason(int subtest);
|
|
|
|
int test__pmu_events_subtest_get_nr(void);
|
2017-08-04 02:16:31 +08:00
|
|
|
int test__attr(struct test *test, int subtest);
|
|
|
|
int test__dso_data(struct test *test, int subtest);
|
|
|
|
int test__dso_data_cache(struct test *test, int subtest);
|
|
|
|
int test__dso_data_reopen(struct test *test, int subtest);
|
|
|
|
int test__parse_events(struct test *test, int subtest);
|
|
|
|
int test__hists_link(struct test *test, int subtest);
|
|
|
|
int test__python_use(struct test *test, int subtest);
|
|
|
|
int test__bp_signal(struct test *test, int subtest);
|
|
|
|
int test__bp_signal_overflow(struct test *test, int subtest);
|
2018-03-12 21:45:48 +08:00
|
|
|
int test__bp_accounting(struct test *test, int subtest);
|
2018-09-12 14:12:29 +08:00
|
|
|
int test__wp(struct test *test, int subtest);
|
|
|
|
const char *test__wp_subtest_get_desc(int subtest);
|
|
|
|
int test__wp_subtest_get_nr(void);
|
2017-08-04 02:16:31 +08:00
|
|
|
int test__task_exit(struct test *test, int subtest);
|
2017-08-17 06:21:56 +08:00
|
|
|
int test__mem(struct test *test, int subtest);
|
2017-08-04 02:16:31 +08:00
|
|
|
int test__sw_clock_freq(struct test *test, int subtest);
|
|
|
|
int test__code_reading(struct test *test, int subtest);
|
|
|
|
int test__sample_parsing(struct test *test, int subtest);
|
|
|
|
int test__keep_tracking(struct test *test, int subtest);
|
|
|
|
int test__parse_no_sample_id_all(struct test *test, int subtest);
|
|
|
|
int test__dwarf_unwind(struct test *test, int subtest);
|
|
|
|
int test__expr(struct test *test, int subtest);
|
|
|
|
int test__hists_filter(struct test *test, int subtest);
|
|
|
|
int test__mmap_thread_lookup(struct test *test, int subtest);
|
2019-11-26 09:29:18 +08:00
|
|
|
int test__thread_maps_share(struct test *test, int subtest);
|
2017-08-04 02:16:31 +08:00
|
|
|
int test__hists_output(struct test *test, int subtest);
|
|
|
|
int test__hists_cumulate(struct test *test, int subtest);
|
|
|
|
int test__switch_tracking(struct test *test, int subtest);
|
|
|
|
int test__fdarray__filter(struct test *test, int subtest);
|
|
|
|
int test__fdarray__add(struct test *test, int subtest);
|
|
|
|
int test__kmod_path__parse(struct test *test, int subtest);
|
|
|
|
int test__thread_map(struct test *test, int subtest);
|
|
|
|
int test__llvm(struct test *test, int subtest);
|
2015-11-17 16:32:48 +08:00
|
|
|
const char *test__llvm_subtest_get_desc(int subtest);
|
|
|
|
int test__llvm_subtest_get_nr(void);
|
2017-08-04 02:16:31 +08:00
|
|
|
int test__bpf(struct test *test, int subtest);
|
2015-11-17 16:32:49 +08:00
|
|
|
const char *test__bpf_subtest_get_desc(int subtest);
|
|
|
|
int test__bpf_subtest_get_nr(void);
|
2017-08-04 02:16:31 +08:00
|
|
|
int test__session_topology(struct test *test, int subtest);
|
|
|
|
int test__thread_map_synthesize(struct test *test, int subtest);
|
|
|
|
int test__thread_map_remove(struct test *test, int subtest);
|
|
|
|
int test__cpu_map_synthesize(struct test *test, int subtest);
|
|
|
|
int test__synthesize_stat_config(struct test *test, int subtest);
|
|
|
|
int test__synthesize_stat(struct test *test, int subtest);
|
|
|
|
int test__synthesize_stat_round(struct test *test, int subtest);
|
|
|
|
int test__event_update(struct test *test, int subtest);
|
|
|
|
int test__event_times(struct test *test, int subtest);
|
|
|
|
int test__backward_ring_buffer(struct test *test, int subtest);
|
|
|
|
int test__cpu_map_print(struct test *test, int subtest);
|
2019-11-21 08:15:14 +08:00
|
|
|
int test__cpu_map_merge(struct test *test, int subtest);
|
2017-08-04 02:16:31 +08:00
|
|
|
int test__sdt_event(struct test *test, int subtest);
|
|
|
|
int test__is_printable_array(struct test *test, int subtest);
|
|
|
|
int test__bitmap_print(struct test *test, int subtest);
|
|
|
|
int test__perf_hooks(struct test *test, int subtest);
|
|
|
|
int test__clang(struct test *test, int subtest);
|
2016-11-26 15:03:34 +08:00
|
|
|
const char *test__clang_subtest_get_desc(int subtest);
|
|
|
|
int test__clang_subtest_get_nr(void);
|
2017-08-04 02:16:31 +08:00
|
|
|
int test__unit_number__scnprint(struct test *test, int subtest);
|
2018-03-09 18:14:36 +08:00
|
|
|
int test__mem2node(struct test *t, int subtest);
|
2019-11-26 09:33:02 +08:00
|
|
|
int test__maps__merge_in(struct test *t, int subtest);
|
perf tests: Add a test for time-utils
Test time ranges work as expected.
Committer testing:
$ perf test "time utils"
59: time utils : Ok
$ perf test -v "time utils"
59: time utils :
--- start ---
test child forked, pid 31711
parse_nsec_time("0")
0
parse_nsec_time("1")
1000000000
parse_nsec_time("0.000000001")
1
parse_nsec_time("1.000000001")
1000000001
parse_nsec_time("123456.123456")
123456123456000
parse_nsec_time("1234567.123456789")
1234567123456789
parse_nsec_time("18446744073.709551615")
18446744073709551615
perf_time__parse_str("1234567.123456789,1234567.123456789")
start time 1234567123456789, end time 1234567123456789
perf_time__parse_str("1234567.123456789,1234567.123456790")
start time 1234567123456789, end time 1234567123456790
perf_time__parse_str("1234567.123456789,")
start time 1234567123456789, end time 0
perf_time__parse_str(",1234567.123456789")
start time 0, end time 1234567123456789
perf_time__parse_str("0,1234567.123456789")
start time 0, end time 1234567123456789
perf_time__parse_for_ranges("1234567.123456789,1234567.123456790")
start time 1234567123456789, end time 1234567123456790
perf_time__parse_for_ranges("10%/1")
first_sample_time 7654321000000000 last_sample_time 7654321000000100
start time 0: 7654321000000000, end time 0: 7654321000000009
perf_time__parse_for_ranges("10%/2")
first_sample_time 7654321000000000 last_sample_time 7654321000000100
start time 0: 7654321000000010, end time 0: 7654321000000019
perf_time__parse_for_ranges("10%/1,10%/2")
first_sample_time 11223344000000000 last_sample_time 11223344000000100
start time 0: 11223344000000000, end time 0: 11223344000000009
start time 1: 11223344000000010, end time 1: 11223344000000019
perf_time__parse_for_ranges("10%/1,10%/3,10%/10")
first_sample_time 11223344000000000 last_sample_time 11223344000000100
start time 0: 11223344000000000, end time 0: 11223344000000009
start time 1: 11223344000000020, end time 1: 11223344000000029
start time 2: 11223344000000090, end time 2: 11223344000000100
test child finished with 0
---- end ----
time utils: Ok
$
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/20190604130017.31207-19-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-06-04 21:00:16 +08:00
|
|
|
int test__time_utils(struct test *t, int subtest);
|
2019-11-27 07:59:13 +08:00
|
|
|
int test__jit_write_elf(struct test *test, int subtest);
|
2020-04-15 13:40:49 +08:00
|
|
|
int test__api_io(struct test *test, int subtest);
|
perf tests: Add test for the java demangler
Split from a larger patch that was also fixing a problem with the java
demangler, so, before applying that patch we see:
$ perf test java
65: Demangle Java : FAILED!
$ perf test -v java
65: Demangle Java :
--- start ---
test child forked, pid 307264
FAILED: Ljava/lang/StringLatin1;equals([B[B)Z: bool class java.lang.StringLatin1.equals(byte[], byte[]) != boolean java.lang.StringLatin1.equals(byte[], byte[])
FAILED: Ljava/util/zip/ZipUtils;CENSIZ([BI)J: long class java.util.zip.ZipUtils.CENSIZ(byte[], int) != long java.util.zip.ZipUtils.CENSIZ(byte[], int)
FAILED: Ljava/util/regex/Pattern$BmpCharProperty;match(Ljava/util/regex/Matcher;ILjava/lang/CharSequence;)Z: bool class java.util.regex.Pattern$BmpCharProperty.match(class java.util.regex.Matcher., int, class java.lang., charhar, shortequence) != boolean java.util.regex.Pattern$BmpCharProperty.match(java.util.regex.Matcher, int, java.lang.CharSequence)
FAILED: Ljava/lang/AbstractStringBuilder;appendChars(Ljava/lang/String;II)V: void class java.lang.AbstractStringBuilder.appendChars(class java.lang., shorttring., int, int) != void java.lang.AbstractStringBuilder.appendChars(java.lang.String, int, int)
FAILED: Ljava/lang/Object;<init>()V: void class java.lang.Object<init>() != void java.lang.Object<init>()
test child finished with -1
---- end ----
Demangle Java: FAILED!
$
Next patch should fix this.
Signed-off-by: Nick Gasson <nick.gasson@arm.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Ian Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20200427061520.24905-4-nick.gasson@arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2020-04-27 14:15:16 +08:00
|
|
|
int test__demangle_java(struct test *test, int subtest);
|
2020-05-06 02:29:43 +08:00
|
|
|
int test__pfm(struct test *test, int subtest);
|
|
|
|
const char *test__pfm_subtest_get_desc(int subtest);
|
|
|
|
int test__pfm_subtest_get_nr(void);
|
2020-06-03 05:47:40 +08:00
|
|
|
int test__parse_metric(struct test *test, int subtest);
|
2012-11-10 08:46:42 +08:00
|
|
|
|
2017-06-02 04:54:50 +08:00
|
|
|
bool test__bp_signal_is_supported(void);
|
2019-10-18 16:55:30 +08:00
|
|
|
bool test__bp_account_is_supported(void);
|
2018-09-28 18:53:35 +08:00
|
|
|
bool test__wp_is_supported(void);
|
2017-06-02 04:54:50 +08:00
|
|
|
|
2015-10-05 22:40:20 +08:00
|
|
|
#if defined(__arm__) || defined(__aarch64__)
|
2014-01-07 20:47:28 +08:00
|
|
|
#ifdef HAVE_DWARF_UNWIND_SUPPORT
|
2014-01-07 20:47:22 +08:00
|
|
|
struct thread;
|
|
|
|
struct perf_sample;
|
|
|
|
int test__arch_unwind_sample(struct perf_sample *sample,
|
|
|
|
struct thread *thread);
|
|
|
|
#endif
|
|
|
|
#endif
|
2018-12-21 11:43:37 +08:00
|
|
|
|
|
|
|
#if defined(__arm__)
|
|
|
|
int test__vectors_page(struct test *test, int subtest);
|
|
|
|
#endif
|
|
|
|
|
2012-11-10 08:46:41 +08:00
|
|
|
#endif /* TESTS_H */
|