summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrevor Gamblin <tgamblin@baylibre.com>2023-09-13 13:00:46 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-09-14 15:20:08 +0100
commit4a6f38c5327b40a45c340af49fee9a0d5cc890bd (patch)
tree669ae555ecc031990579baa207d40f38ab7e1335
parente12e6d94ecbea6e0dafc080f2f196e12228730eb (diff)
downloadpoky-4a6f38c5327b40a45c340af49fee9a0d5cc890bd.tar.gz
patchtest: Add tests from patchtest oe repo
Copy the core components of the patchtest-oe repo into meta/lib/patchtest in oe-core. (From OE-Core rev: 257f64f4e4414b78981104aec132b067beb5a92a) Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/patchtest/selftest/files/Author.test_author_valid.1.fail32
-rw-r--r--meta/lib/patchtest/selftest/files/Author.test_author_valid.1.pass31
-rw-r--r--meta/lib/patchtest/selftest/files/Author.test_author_valid.2.fail31
-rw-r--r--meta/lib/patchtest/selftest/files/Author.test_author_valid.2.pass31
-rw-r--r--meta/lib/patchtest/selftest/files/Bugzilla.test_bugzilla_entry_format.fail25
-rw-r--r--meta/lib/patchtest/selftest/files/Bugzilla.test_bugzilla_entry_format.pass25
-rw-r--r--meta/lib/patchtest/selftest/files/CVE.test_cve_presence_in_commit_message.fail72
-rw-r--r--meta/lib/patchtest/selftest/files/CVE.test_cve_presence_in_commit_message.pass74
-rw-r--r--meta/lib/patchtest/selftest/files/CVE.test_cve_tag_format.fail73
-rw-r--r--meta/lib/patchtest/selftest/files/CVE.test_cve_tag_format.pass73
-rw-r--r--meta/lib/patchtest/selftest/files/CommitMessage.test_commit_message_presence.fail22
-rw-r--r--meta/lib/patchtest/selftest/files/CommitMessage.test_commit_message_presence.pass24
-rw-r--r--meta/lib/patchtest/selftest/files/LicFilesChkSum.test_lic_files_chksum_modified_not_mentioned.fail37
-rw-r--r--meta/lib/patchtest/selftest/files/LicFilesChkSum.test_lic_files_chksum_modified_not_mentioned.pass39
-rw-r--r--meta/lib/patchtest/selftest/files/LicFilesChkSum.test_lic_files_chksum_presence.fail53
-rw-r--r--meta/lib/patchtest/selftest/files/LicFilesChkSum.test_lic_files_chksum_presence.pass54
-rw-r--r--meta/lib/patchtest/selftest/files/MboxFormat.test_mbox_format.1.fail36
-rw-r--r--meta/lib/patchtest/selftest/files/MboxFormat.test_mbox_format.2.fail35
-rw-r--r--meta/lib/patchtest/selftest/files/MboxFormat.test_mbox_format.pass33
-rw-r--r--meta/lib/patchtest/selftest/files/Merge.test_series_merge_on_head.fail41
-rw-r--r--meta/lib/patchtest/selftest/files/Merge.test_series_merge_on_head.pass35
-rw-r--r--meta/lib/patchtest/selftest/files/PatchSignedOffBy.test_signed_off_by_presence.fail71
-rw-r--r--meta/lib/patchtest/selftest/files/PatchSignedOffBy.test_signed_off_by_presence.pass72
-rw-r--r--meta/lib/patchtest/selftest/files/Shortlog.test_shortlog_format.fail73
-rw-r--r--meta/lib/patchtest/selftest/files/Shortlog.test_shortlog_format.pass73
-rw-r--r--meta/lib/patchtest/selftest/files/Shortlog.test_shortlog_length.fail73
-rw-r--r--meta/lib/patchtest/selftest/files/Shortlog.test_shortlog_length.pass73
-rw-r--r--meta/lib/patchtest/selftest/files/SignedOffBy.test_signed_off_by_presence.1.fail71
-rw-r--r--meta/lib/patchtest/selftest/files/SignedOffBy.test_signed_off_by_presence.2.fail72
-rw-r--r--meta/lib/patchtest/selftest/files/SignedOffBy.test_signed_off_by_presence.pass72
-rw-r--r--meta/lib/patchtest/selftest/files/SrcUri.test_src_uri_left_files.fail35
-rw-r--r--meta/lib/patchtest/selftest/files/SrcUri.test_src_uri_left_files.pass51
-rw-r--r--meta/lib/patchtest/selftest/files/Summary.test_summary_presence.fail46
-rw-r--r--meta/lib/patchtest/selftest/files/Summary.test_summary_presence.pass49
-rwxr-xr-xmeta/lib/patchtest/selftest/selftest91
-rw-r--r--meta/lib/patchtest/tests/__init__.py0
-rw-r--r--meta/lib/patchtest/tests/base.py239
-rw-r--r--meta/lib/patchtest/tests/pyparsing/common.py26
-rw-r--r--meta/lib/patchtest/tests/pyparsing/parse_cve_tags.py18
-rw-r--r--meta/lib/patchtest/tests/pyparsing/parse_shortlog.py14
-rw-r--r--meta/lib/patchtest/tests/pyparsing/parse_signed_off_by.py22
-rw-r--r--meta/lib/patchtest/tests/pyparsing/parse_upstream_status.py24
-rw-r--r--meta/lib/patchtest/tests/test_mbox_author.py29
-rw-r--r--meta/lib/patchtest/tests/test_mbox_bugzilla.py22
-rw-r--r--meta/lib/patchtest/tests/test_mbox_cve.py49
-rw-r--r--meta/lib/patchtest/tests/test_mbox_description.py17
-rw-r--r--meta/lib/patchtest/tests/test_mbox_format.py16
-rw-r--r--meta/lib/patchtest/tests/test_mbox_mailinglist.py64
-rw-r--r--meta/lib/patchtest/tests/test_mbox_merge.py25
-rw-r--r--meta/lib/patchtest/tests/test_mbox_shortlog.py41
-rw-r--r--meta/lib/patchtest/tests/test_mbox_signed_off_by.py28
-rw-r--r--meta/lib/patchtest/tests/test_metadata_lic_files_chksum.py82
-rw-r--r--meta/lib/patchtest/tests/test_metadata_license.py55
-rw-r--r--meta/lib/patchtest/tests/test_metadata_max_length.py26
-rw-r--r--meta/lib/patchtest/tests/test_metadata_src_uri.py75
-rw-r--r--meta/lib/patchtest/tests/test_metadata_summary.py32
-rw-r--r--meta/lib/patchtest/tests/test_patch_cve.py51
-rw-r--r--meta/lib/patchtest/tests/test_patch_signed_off_by.py43
-rw-r--r--meta/lib/patchtest/tests/test_patch_upstream_status.py64
-rw-r--r--meta/lib/patchtest/tests/test_python_pylint.py61
60 files changed, 2921 insertions, 0 deletions
diff --git a/meta/lib/patchtest/selftest/files/Author.test_author_valid.1.fail b/meta/lib/patchtest/selftest/files/Author.test_author_valid.1.fail
new file mode 100644
index 0000000000..0c40cdc1b6
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/Author.test_author_valid.1.fail
@@ -0,0 +1,32 @@
1From 1fbb446d1849b1208012cbdae5d85d228cdbe4a6 Mon Sep 17 00:00:00 2001
2From: First Last <first.last@example.com>
3Date: Tue, 29 Aug 2023 13:32:24 -0400
4Subject: [PATCH] selftest-hello: add a summary
5
6This patch should fail the selftests because the author address is from the
7invalid "example.com".
8
9Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
10---
11 .../recipes-test/selftest-hello/selftest-hello_1.0.bb | 3 ++-
12 1 file changed, 2 insertions(+), 1 deletion(-)
13
14diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
15index 547587bef4..491f0a3df7 100644
16--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
17+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
18@@ -1,3 +1,4 @@
19+SUMMARY = "A cool sample"
20 DESCRIPTION = "Simple helloworld application -- selftest variant"
21 SECTION = "examples"
22 LICENSE = "MIT"
23@@ -16,4 +17,4 @@ do_install() {
24 install -m 0755 helloworld ${D}${bindir}
25 }
26
27-BBCLASSEXTEND = "native nativesdk"
28\ No newline at end of file
29+BBCLASSEXTEND = "native nativesdk"
30--
312.41.0
32
diff --git a/meta/lib/patchtest/selftest/files/Author.test_author_valid.1.pass b/meta/lib/patchtest/selftest/files/Author.test_author_valid.1.pass
new file mode 100644
index 0000000000..cbb8ef2cef
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/Author.test_author_valid.1.pass
@@ -0,0 +1,31 @@
1From 1fbb446d1849b1208012cbdae5d85d228cdbe4a6 Mon Sep 17 00:00:00 2001
2From: First Last <first.last@address.com>
3Date: Tue, 29 Aug 2023 13:32:24 -0400
4Subject: [PATCH] selftest-hello: add a summary
5
6This patch should pass the selftests because the author address is in a valid format.
7
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9---
10 .../recipes-test/selftest-hello/selftest-hello_1.0.bb | 3 ++-
11 1 file changed, 2 insertions(+), 1 deletion(-)
12
13diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
14index 547587bef4..491f0a3df7 100644
15--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
16+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
17@@ -1,3 +1,4 @@
18+SUMMARY = "A cool sample"
19 DESCRIPTION = "Simple helloworld application -- selftest variant"
20 SECTION = "examples"
21 LICENSE = "MIT"
22@@ -16,4 +17,4 @@ do_install() {
23 install -m 0755 helloworld ${D}${bindir}
24 }
25
26-BBCLASSEXTEND = "native nativesdk"
27\ No newline at end of file
28+BBCLASSEXTEND = "native nativesdk"
29--
302.41.0
31
diff --git a/meta/lib/patchtest/selftest/files/Author.test_author_valid.2.fail b/meta/lib/patchtest/selftest/files/Author.test_author_valid.2.fail
new file mode 100644
index 0000000000..3e2b81bca1
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/Author.test_author_valid.2.fail
@@ -0,0 +1,31 @@
1From 1fbb446d1849b1208012cbdae5d85d228cdbe4a6 Mon Sep 17 00:00:00 2001
2From: Upgrade Helper <auh@auh.yoctoproject.org>
3Date: Tue, 29 Aug 2023 13:32:24 -0400
4Subject: [PATCH] selftest-hello: add a summary
5
6This patch should fail the selftests because AUH is an invalid sender.
7
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9---
10 .../recipes-test/selftest-hello/selftest-hello_1.0.bb | 3 ++-
11 1 file changed, 2 insertions(+), 1 deletion(-)
12
13diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
14index 547587bef4..491f0a3df7 100644
15--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
16+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
17@@ -1,3 +1,4 @@
18+SUMMARY = "A cool sample"
19 DESCRIPTION = "Simple helloworld application -- selftest variant"
20 SECTION = "examples"
21 LICENSE = "MIT"
22@@ -16,4 +17,4 @@ do_install() {
23 install -m 0755 helloworld ${D}${bindir}
24 }
25
26-BBCLASSEXTEND = "native nativesdk"
27\ No newline at end of file
28+BBCLASSEXTEND = "native nativesdk"
29--
302.41.0
31
diff --git a/meta/lib/patchtest/selftest/files/Author.test_author_valid.2.pass b/meta/lib/patchtest/selftest/files/Author.test_author_valid.2.pass
new file mode 100644
index 0000000000..f84e1265a7
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/Author.test_author_valid.2.pass
@@ -0,0 +1,31 @@
1From 1fbb446d1849b1208012cbdae5d85d228cdbe4a6 Mon Sep 17 00:00:00 2001
2From: First Last <averylongemailaddressthatishardtoread.from@address.com>
3Date: Tue, 29 Aug 2023 13:32:24 -0400
4Subject: [PATCH] selftest-hello: add a summary
5
6This patch should pass the selftests because the author address is in a valid format.
7
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9---
10 .../recipes-test/selftest-hello/selftest-hello_1.0.bb | 3 ++-
11 1 file changed, 2 insertions(+), 1 deletion(-)
12
13diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
14index 547587bef4..491f0a3df7 100644
15--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
16+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
17@@ -1,3 +1,4 @@
18+SUMMARY = "A cool sample"
19 DESCRIPTION = "Simple helloworld application -- selftest variant"
20 SECTION = "examples"
21 LICENSE = "MIT"
22@@ -16,4 +17,4 @@ do_install() {
23 install -m 0755 helloworld ${D}${bindir}
24 }
25
26-BBCLASSEXTEND = "native nativesdk"
27\ No newline at end of file
28+BBCLASSEXTEND = "native nativesdk"
29--
302.41.0
31
diff --git a/meta/lib/patchtest/selftest/files/Bugzilla.test_bugzilla_entry_format.fail b/meta/lib/patchtest/selftest/files/Bugzilla.test_bugzilla_entry_format.fail
new file mode 100644
index 0000000000..80f409e952
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/Bugzilla.test_bugzilla_entry_format.fail
@@ -0,0 +1,25 @@
1From fdfd605e565d874502522c4b70b786c8c5aa0bad Mon Sep 17 00:00:00 2001
2From: name@somedomain.com <email@address.com>
3Date: Fri, 17 Feb 2017 16:29:21 -0600
4Subject: [PATCH] README: adds 'foo' to the header
5
6This test patch adds 'foo' to the header
7
8[YOCTO 1234]
9
10Signed-off-by: Daniela Plascencia <daniela.plascencia@linux.intel.com>
11---
12 README | 1 +
13 1 file changed, 1 insertion(+)
14
15diff --git a/README b/README
16index 521916cd4f..cdf29dcea3 100644
17--- a/README
18+++ b/README
19@@ -1,3 +1,4 @@
20+**** FOO ****
21 OpenEmbedded-Core
22 =================
23
24--
252.11.0
diff --git a/meta/lib/patchtest/selftest/files/Bugzilla.test_bugzilla_entry_format.pass b/meta/lib/patchtest/selftest/files/Bugzilla.test_bugzilla_entry_format.pass
new file mode 100644
index 0000000000..2648b03364
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/Bugzilla.test_bugzilla_entry_format.pass
@@ -0,0 +1,25 @@
1From fdfd605e565d874502522c4b70b786c8c5aa0bad Mon Sep 17 00:00:00 2001
2From: name@somedomain.com <email@address.com>
3Date: Fri, 17 Feb 2017 16:29:21 -0600
4Subject: [PATCH] README: adds 'foo' to the header
5
6This test patch adds 'foo' to the header
7
8[YOCTO #1234]
9
10Signed-off-by: Daniela Plascencia <daniela.plascencia@linux.intel.com>
11---
12 README | 1 +
13 1 file changed, 1 insertion(+)
14
15diff --git a/README b/README
16index 521916cd4f..cdf29dcea3 100644
17--- a/README
18+++ b/README
19@@ -1,3 +1,4 @@
20+**** FOO ****
21 OpenEmbedded-Core
22 =================
23
24--
252.11.0
diff --git a/meta/lib/patchtest/selftest/files/CVE.test_cve_presence_in_commit_message.fail b/meta/lib/patchtest/selftest/files/CVE.test_cve_presence_in_commit_message.fail
new file mode 100644
index 0000000000..d40b8a936b
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/CVE.test_cve_presence_in_commit_message.fail
@@ -0,0 +1,72 @@
1From 14d72f6973270f78455a8628143f2cff90e8f41e Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Tue, 29 Aug 2023 14:12:27 -0400
4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5
6This patch should fail the test for CVE presence in the mbox commit message.
7
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9---
10 .../selftest-hello/files/CVE-1234-56789.patch | 27 +++++++++++++++++++
11 .../selftest-hello/selftest-hello_1.0.bb | 6 +++--
12 2 files changed, 31 insertions(+), 2 deletions(-)
13 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch
14
15diff --git a/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch
16new file mode 100644
17index 0000000000..869cfb6fe5
18--- /dev/null
19+++ b/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch
20@@ -0,0 +1,27 @@
21+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
22+From: Trevor Gamblin <tgamblin@baylibre.com>
23+Date: Tue, 29 Aug 2023 14:08:20 -0400
24+Subject: [PATCH] Fix CVE-NOT-REAL
25+
26+CVE: CVE-1234-56789
27+Upstream-Status: Backport(http://example.com/example)
28+
29+Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
30+---
31+ strlen.c | 1 +
32+ 1 file changed, 1 insertion(+)
33+
34+diff --git a/strlen.c b/strlen.c
35+index 1788f38..83d7918 100644
36+--- a/strlen.c
37++++ b/strlen.c
38+@@ -8,6 +8,7 @@ int main() {
39+
40+ printf("%d\n", str_len(string1));
41+ printf("%d\n", str_len(string2));
42++ printf("CVE FIXED!!!\n");
43+
44+ return 0;
45+ }
46+--
47+2.41.0
48diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
49index 547587bef4..76975a6729 100644
50--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
51+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
52@@ -3,7 +3,9 @@ SECTION = "examples"
53 LICENSE = "MIT"
54 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
55
56-SRC_URI = "file://helloworld.c"
57+SRC_URI = "file://helloworld.c \
58+ file://CVE-1234-56789.patch \
59+ "
60
61 S = "${WORKDIR}"
62
63@@ -16,4 +18,4 @@ do_install() {
64 install -m 0755 helloworld ${D}${bindir}
65 }
66
67-BBCLASSEXTEND = "native nativesdk"
68\ No newline at end of file
69+BBCLASSEXTEND = "native nativesdk"
70--
712.41.0
72
diff --git a/meta/lib/patchtest/selftest/files/CVE.test_cve_presence_in_commit_message.pass b/meta/lib/patchtest/selftest/files/CVE.test_cve_presence_in_commit_message.pass
new file mode 100644
index 0000000000..433c7a450a
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/CVE.test_cve_presence_in_commit_message.pass
@@ -0,0 +1,74 @@
1From 14d72f6973270f78455a8628143f2cff90e8f41e Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Tue, 29 Aug 2023 14:12:27 -0400
4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5
6This test should pass the mbox cve tag test.
7
8CVE: CVE-1234-56789
9
10Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
11---
12 .../selftest-hello/files/CVE-1234-56789.patch | 27 +++++++++++++++++++
13 .../selftest-hello/selftest-hello_1.0.bb | 6 +++--
14 2 files changed, 31 insertions(+), 2 deletions(-)
15 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch
16
17diff --git a/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch
18new file mode 100644
19index 0000000000..869cfb6fe5
20--- /dev/null
21+++ b/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch
22@@ -0,0 +1,27 @@
23+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
24+From: Trevor Gamblin <tgamblin@baylibre.com>
25+Date: Tue, 29 Aug 2023 14:08:20 -0400
26+Subject: [PATCH] Fix CVE-NOT-REAL
27+
28+CVE: CVE-1234-56789
29+Upstream-Status: Backport(http://example.com/example)
30+
31+Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
32+---
33+ strlen.c | 1 +
34+ 1 file changed, 1 insertion(+)
35+
36+diff --git a/strlen.c b/strlen.c
37+index 1788f38..83d7918 100644
38+--- a/strlen.c
39++++ b/strlen.c
40+@@ -8,6 +8,7 @@ int main() {
41+
42+ printf("%d\n", str_len(string1));
43+ printf("%d\n", str_len(string2));
44++ printf("CVE FIXED!!!\n");
45+
46+ return 0;
47+ }
48+--
49+2.41.0
50diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
51index 547587bef4..76975a6729 100644
52--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
53+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
54@@ -3,7 +3,9 @@ SECTION = "examples"
55 LICENSE = "MIT"
56 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
57
58-SRC_URI = "file://helloworld.c"
59+SRC_URI = "file://helloworld.c \
60+ file://CVE-1234-56789.patch \
61+ "
62
63 S = "${WORKDIR}"
64
65@@ -16,4 +18,4 @@ do_install() {
66 install -m 0755 helloworld ${D}${bindir}
67 }
68
69-BBCLASSEXTEND = "native nativesdk"
70\ No newline at end of file
71+BBCLASSEXTEND = "native nativesdk"
72--
732.41.0
74
diff --git a/meta/lib/patchtest/selftest/files/CVE.test_cve_tag_format.fail b/meta/lib/patchtest/selftest/files/CVE.test_cve_tag_format.fail
new file mode 100644
index 0000000000..c763a7506e
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/CVE.test_cve_tag_format.fail
@@ -0,0 +1,73 @@
1From 35ccee3cee96fb29514475279248078d88907231 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Tue, 29 Aug 2023 14:12:27 -0400
4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5
6CVE: CVE-BAD-FORMAT
7
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9---
10 .../files/0001-Fix-CVE-1234-56789.patch | 27 +++++++++++++++++++
11 .../selftest-hello/selftest-hello_1.0.bb | 6 +++--
12 2 files changed, 31 insertions(+), 2 deletions(-)
13 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
14
15diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
16new file mode 100644
17index 0000000000..9219b8db62
18--- /dev/null
19+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
20@@ -0,0 +1,27 @@
21+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
22+From: Trevor Gamblin <tgamblin@baylibre.com>
23+Date: Tue, 29 Aug 2023 14:08:20 -0400
24+Subject: [PATCH] Fix CVE-NOT-REAL
25+
26+CVE: CVE-BAD-FORMAT
27+Upstream-Status: Backport(http://example.com/example)
28+
29+Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
30+---
31+ strlen.c | 1 +
32+ 1 file changed, 1 insertion(+)
33+
34+diff --git a/strlen.c b/strlen.c
35+index 1788f38..83d7918 100644
36+--- a/strlen.c
37++++ b/strlen.c
38+@@ -8,6 +8,7 @@ int main() {
39+
40+ printf("%d\n", str_len(string1));
41+ printf("%d\n", str_len(string2));
42++ printf("CVE FIXED!!!\n");
43+
44+ return 0;
45+ }
46+--
47+2.41.0
48+
49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
50index 547587bef4..76975a6729 100644
51--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
52+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
53@@ -3,7 +3,9 @@ SECTION = "examples"
54 LICENSE = "MIT"
55 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
56
57-SRC_URI = "file://helloworld.c"
58+SRC_URI = "file://helloworld.c \
59+ file://CVE-1234-56789.patch \
60+ "
61
62 S = "${WORKDIR}"
63
64@@ -16,4 +18,4 @@ do_install() {
65 install -m 0755 helloworld ${D}${bindir}
66 }
67
68-BBCLASSEXTEND = "native nativesdk"
69\ No newline at end of file
70+BBCLASSEXTEND = "native nativesdk"
71--
722.41.0
73
diff --git a/meta/lib/patchtest/selftest/files/CVE.test_cve_tag_format.pass b/meta/lib/patchtest/selftest/files/CVE.test_cve_tag_format.pass
new file mode 100644
index 0000000000..ef6017037c
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/CVE.test_cve_tag_format.pass
@@ -0,0 +1,73 @@
1From 35ccee3cee96fb29514475279248078d88907231 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Tue, 29 Aug 2023 14:12:27 -0400
4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5
6CVE: CVE-1234-56789
7
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9---
10 .../files/0001-Fix-CVE-1234-56789.patch | 27 +++++++++++++++++++
11 .../selftest-hello/selftest-hello_1.0.bb | 6 +++--
12 2 files changed, 31 insertions(+), 2 deletions(-)
13 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
14
15diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
16new file mode 100644
17index 0000000000..9219b8db62
18--- /dev/null
19+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
20@@ -0,0 +1,27 @@
21+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
22+From: Trevor Gamblin <tgamblin@baylibre.com>
23+Date: Tue, 29 Aug 2023 14:08:20 -0400
24+Subject: [PATCH] Fix CVE-NOT-REAL
25+
26+CVE: CVE-1234-56789
27+Upstream-Status: Backport(http://example.com/example)
28+
29+Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
30+---
31+ strlen.c | 1 +
32+ 1 file changed, 1 insertion(+)
33+
34+diff --git a/strlen.c b/strlen.c
35+index 1788f38..83d7918 100644
36+--- a/strlen.c
37++++ b/strlen.c
38+@@ -8,6 +8,7 @@ int main() {
39+
40+ printf("%d\n", str_len(string1));
41+ printf("%d\n", str_len(string2));
42++ printf("CVE FIXED!!!\n");
43+
44+ return 0;
45+ }
46+--
47+2.41.0
48+
49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
50index 547587bef4..76975a6729 100644
51--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
52+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
53@@ -3,7 +3,9 @@ SECTION = "examples"
54 LICENSE = "MIT"
55 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
56
57-SRC_URI = "file://helloworld.c"
58+SRC_URI = "file://helloworld.c \
59+ file://CVE-1234-56789.patch \
60+ "
61
62 S = "${WORKDIR}"
63
64@@ -16,4 +18,4 @@ do_install() {
65 install -m 0755 helloworld ${D}${bindir}
66 }
67
68-BBCLASSEXTEND = "native nativesdk"
69\ No newline at end of file
70+BBCLASSEXTEND = "native nativesdk"
71--
722.41.0
73
diff --git a/meta/lib/patchtest/selftest/files/CommitMessage.test_commit_message_presence.fail b/meta/lib/patchtest/selftest/files/CommitMessage.test_commit_message_presence.fail
new file mode 100644
index 0000000000..93ca0f9119
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/CommitMessage.test_commit_message_presence.fail
@@ -0,0 +1,22 @@
1From 0a52a62c9430c05d22cb7f46380488f2280b69bb Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Fri, 1 Sep 2023 08:56:14 -0400
4Subject: [PATCH] README.OE-Core.md: add foo
5
6Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
7---
8 README.OE-Core.md | 1 +
9 1 file changed, 1 insertion(+)
10
11diff --git a/README.OE-Core.md b/README.OE-Core.md
12index 2f2127fb03..48464252c8 100644
13--- a/README.OE-Core.md
14+++ b/README.OE-Core.md
15@@ -1,3 +1,4 @@
16+** FOO **
17 OpenEmbedded-Core
18 =================
19
20--
212.41.0
22
diff --git a/meta/lib/patchtest/selftest/files/CommitMessage.test_commit_message_presence.pass b/meta/lib/patchtest/selftest/files/CommitMessage.test_commit_message_presence.pass
new file mode 100644
index 0000000000..5e3dcbd58b
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/CommitMessage.test_commit_message_presence.pass
@@ -0,0 +1,24 @@
1From 0a52a62c9430c05d22cb7f46380488f2280b69bb Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Fri, 1 Sep 2023 08:56:14 -0400
4Subject: [PATCH] README.OE-Core.md: add foo
5
6This is a commit message
7
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9---
10 README.OE-Core.md | 1 +
11 1 file changed, 1 insertion(+)
12
13diff --git a/README.OE-Core.md b/README.OE-Core.md
14index 2f2127fb03..48464252c8 100644
15--- a/README.OE-Core.md
16+++ b/README.OE-Core.md
17@@ -1,3 +1,4 @@
18+** FOO **
19 OpenEmbedded-Core
20 =================
21
22--
232.41.0
24
diff --git a/meta/lib/patchtest/selftest/files/LicFilesChkSum.test_lic_files_chksum_modified_not_mentioned.fail b/meta/lib/patchtest/selftest/files/LicFilesChkSum.test_lic_files_chksum_modified_not_mentioned.fail
new file mode 100644
index 0000000000..ab6c52c374
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/LicFilesChkSum.test_lic_files_chksum_modified_not_mentioned.fail
@@ -0,0 +1,37 @@
1From f89919ea86d38404dd621521680a0162367bb965 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Wed, 6 Sep 2023 09:09:27 -0400
4Subject: [PATCH] selftest-hello: update LIC_FILES_CHKSUM
5
6This test should fail the
7test_metadata_lic_files_chksum.LicFilesChkSum.test_lic_files_chksum_modified_not_mentioned
8test.
9
10Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
11---
12 .../recipes-test/selftest-hello/selftest-hello_1.0.bb | 4 ++--
13 1 file changed, 2 insertions(+), 2 deletions(-)
14
15diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
16index 547587bef4..65dda40aba 100644
17--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
18+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
19@@ -1,7 +1,7 @@
20 DESCRIPTION = "Simple helloworld application -- selftest variant"
21 SECTION = "examples"
22 LICENSE = "MIT"
23-LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
24+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f303"
25
26 SRC_URI = "file://helloworld.c"
27
28@@ -16,4 +16,4 @@ do_install() {
29 install -m 0755 helloworld ${D}${bindir}
30 }
31
32-BBCLASSEXTEND = "native nativesdk"
33\ No newline at end of file
34+BBCLASSEXTEND = "native nativesdk"
35--
362.41.0
37
diff --git a/meta/lib/patchtest/selftest/files/LicFilesChkSum.test_lic_files_chksum_modified_not_mentioned.pass b/meta/lib/patchtest/selftest/files/LicFilesChkSum.test_lic_files_chksum_modified_not_mentioned.pass
new file mode 100644
index 0000000000..99d9f144da
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/LicFilesChkSum.test_lic_files_chksum_modified_not_mentioned.pass
@@ -0,0 +1,39 @@
1From f89919ea86d38404dd621521680a0162367bb965 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Wed, 6 Sep 2023 09:09:27 -0400
4Subject: [PATCH] selftest-hello: update LIC_FILES_CHKSUM
5
6License-Update: Fix checksum
7
8This test should pass the
9test_metadata_lic_files_chksum.LicFilesChkSum.test_lic_files_chksum_modified_not_mentioned
10test.
11
12Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
13---
14 .../recipes-test/selftest-hello/selftest-hello_1.0.bb | 4 ++--
15 1 file changed, 2 insertions(+), 2 deletions(-)
16
17diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
18index 547587bef4..65dda40aba 100644
19--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
20+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
21@@ -1,7 +1,7 @@
22 DESCRIPTION = "Simple helloworld application -- selftest variant"
23 SECTION = "examples"
24 LICENSE = "MIT"
25-LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
26+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f303"
27
28 SRC_URI = "file://helloworld.c"
29
30@@ -16,4 +16,4 @@ do_install() {
31 install -m 0755 helloworld ${D}${bindir}
32 }
33
34-BBCLASSEXTEND = "native nativesdk"
35\ No newline at end of file
36+BBCLASSEXTEND = "native nativesdk"
37--
382.41.0
39
diff --git a/meta/lib/patchtest/selftest/files/LicFilesChkSum.test_lic_files_chksum_presence.fail b/meta/lib/patchtest/selftest/files/LicFilesChkSum.test_lic_files_chksum_presence.fail
new file mode 100644
index 0000000000..e14d644bb2
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/LicFilesChkSum.test_lic_files_chksum_presence.fail
@@ -0,0 +1,53 @@
1From 66430e7c6fbd5187b66560909a510e136fed91c0 Mon Sep 17 00:00:00 2001
2From: Daniela Plascencia <daniela.plascencia@linux.intel.com>
3Date: Thu, 23 Feb 2017 10:34:27 -0600
4Subject: [PATCH] meta: adding hello-yocto recipe
5
6This is a sample recipe
7
8Signed-off-by: Daniela Plascencia <daniela.plascencia@linux.intel.com>
9---
10 .../hello-world/hello-world/hello_world.c | 5 +++++
11 .../hello-world/hello-world_1.0.bb | 18 ++++++++++++++++++
12 2 files changed, 23 insertions(+)
13 create mode 100644 meta/recipes-devtools/hello-world/hello-world/hello_world.c
14 create mode 100644 meta/recipes-devtools/hello-world/hello-world_1.0.bb
15
16diff --git a/meta/recipes-devtools/hello-world/hello-world/hello_world.c b/meta/recipes-devtools/hello-world/hello-world/hello_world.c
17new file mode 100644
18index 0000000000..0d59f57d4c
19--- /dev/null
20+++ b/meta/recipes-devtools/hello-world/hello-world/hello_world.c
21@@ -0,0 +1,5 @@
22+#include <stdio.h>
23+
24+int main(){
25+ printf("Hello World\n");
26+}
27diff --git a/meta/recipes-devtools/hello-world/hello-world_1.0.bb b/meta/recipes-devtools/hello-world/hello-world_1.0.bb
28new file mode 100644
29index 0000000000..3c990c108a
30--- /dev/null
31+++ b/meta/recipes-devtools/hello-world/hello-world_1.0.bb
32@@ -0,0 +1,18 @@
33+SUMMARY = "This is a sample summary"
34+DESCRIPTION = "This is a sample description"
35+HOMEPAGE = "https://sample.com/this-is-a-sample"
36+LICENSE = "MIT"
37+
38+SRC_URI += "file://hello_world.c"
39+
40+SRC_URI[md5sum] = "4ee21e9dcc9b5b6012c23038734e1632"
41+SRC_URI[sha256sum] = "edef2bbde0fbf0d88232782a0eded323f483a0519d6fde9a3b1809056fd35f3e"
42+
43+do_compile(){
44+ ${CC} -o hello_world ../hello_world.c
45+}
46+
47+do_install(){
48+ install -d ${D}${bindir}
49+ install -m +x hello_world ${D}${bindir}/hello_world
50+}
51--
522.41.0
53
diff --git a/meta/lib/patchtest/selftest/files/LicFilesChkSum.test_lic_files_chksum_presence.pass b/meta/lib/patchtest/selftest/files/LicFilesChkSum.test_lic_files_chksum_presence.pass
new file mode 100644
index 0000000000..b8da16dfe5
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/LicFilesChkSum.test_lic_files_chksum_presence.pass
@@ -0,0 +1,54 @@
1From 5144d2ba1aa763312c047dd5f8901368cff79da6 Mon Sep 17 00:00:00 2001
2From: Daniela Plascencia <daniela.plascencia@linux.intel.com>
3Date: Thu, 23 Feb 2017 10:34:27 -0600
4Subject: [PATCH] meta: adding hello-yocto recipe
5
6This is a sample recipe
7
8Signed-off-by: Daniela Plascencia <daniela.plascencia@linux.intel.com>
9---
10 .../hello-world/hello-world/hello_world.c | 5 +++++
11 .../hello-world/hello-world_1.0.bb | 19 +++++++++++++++++++
12 2 files changed, 24 insertions(+)
13 create mode 100644 meta/recipes-devtools/hello-world/hello-world/hello_world.c
14 create mode 100644 meta/recipes-devtools/hello-world/hello-world_1.0.bb
15
16diff --git a/meta/recipes-devtools/hello-world/hello-world/hello_world.c b/meta/recipes-devtools/hello-world/hello-world/hello_world.c
17new file mode 100644
18index 0000000000..0d59f57d4c
19--- /dev/null
20+++ b/meta/recipes-devtools/hello-world/hello-world/hello_world.c
21@@ -0,0 +1,5 @@
22+#include <stdio.h>
23+
24+int main(){
25+ printf("Hello World\n");
26+}
27diff --git a/meta/recipes-devtools/hello-world/hello-world_1.0.bb b/meta/recipes-devtools/hello-world/hello-world_1.0.bb
28new file mode 100644
29index 0000000000..44d888c82a
30--- /dev/null
31+++ b/meta/recipes-devtools/hello-world/hello-world_1.0.bb
32@@ -0,0 +1,19 @@
33+SUMMARY = "This is a sample summary"
34+DESCRIPTION = "This is a sample description"
35+HOMEPAGE = "https://sample.com/this-is-a-sample"
36+LICENSE = "MIT"
37+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
38+
39+SRC_URI += "file://hello_world.c"
40+
41+SRC_URI[md5sum] = "4ee21e9dcc9b5b6012c23038734e1632"
42+SRC_URI[sha256sum] = "edef2bbde0fbf0d88232782a0eded323f483a0519d6fde9a3b1809056fd35f3e"
43+
44+do_compile(){
45+ ${CC} -o hello_world ../hello_world.c
46+}
47+
48+do_install(){
49+ install -d ${D}${bindir}
50+ install -m +x hello_world ${D}${bindir}/hello_world
51+}
52--
532.41.0
54
diff --git a/meta/lib/patchtest/selftest/files/MboxFormat.test_mbox_format.1.fail b/meta/lib/patchtest/selftest/files/MboxFormat.test_mbox_format.1.fail
new file mode 100644
index 0000000000..9cc4aab38a
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/MboxFormat.test_mbox_format.1.fail
@@ -0,0 +1,36 @@
1From d12db4cfa913b0e7a4b5bd858d3019acc53ce426 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Wed, 30 Aug 2023 12:15:00 -0400
4Subject: [PATCH] selftest-hello: upgrade 1.0 -> 1.1
5
6This test should fail the mbox formatting test and the merge on head
7test.
8
9Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
10---
11 .../{selftest-hello_1.0.bb => selftest-hello_1.1.bb} | 3 ++-
12 1 file changed, 2 insertions(+), 1 deletion(-)
13 rename meta-selftest/recipes-test/selftest-hello/{selftest-hello_1.0.bb => selftest-hello_1.1.bb} (88%)
14
15diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb
16similarity index 88%
17rename from meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
18rename to meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb
19index 547587bef4..acc388ec2c 100644
20--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
21+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb
22@@ -1,3 +1,4 @@
23%+SUMMARY = "Hello!"
24 DESCRIPTION = "Simple helloworld application -- selftest variant"
25 SECTION = "examples"
26 LICENSE = "MIT"
27@@ -16,4 +17,4 @@ do_install() {
28 install -m 0755 helloworld ${D}${bindir}
29 }
30
31-BBCLASSEXTEND = "native nativesdk"
32\ No newline at end of file
33+BBCLASSEXTEND = "native nativesdk"
34--
352.41.0
36
diff --git a/meta/lib/patchtest/selftest/files/MboxFormat.test_mbox_format.2.fail b/meta/lib/patchtest/selftest/files/MboxFormat.test_mbox_format.2.fail
new file mode 100644
index 0000000000..eca1c60085
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/MboxFormat.test_mbox_format.2.fail
@@ -0,0 +1,35 @@
1From d12db4cfa913b0e7a4b5bd858d3019acc53ce426 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Wed, 30 Aug 2023 12:15:00 -0400
4Subject: [PATCH] selftest-hello: upgrade 1.0 -> 1.1
5
6This test should fail the merge-on-head and mbox formatting tests.
7
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9---
10 .../{selftest-hello_1.0.bb => selftest-hello_1.1.bb} | 3 ++-
11 1 file changed, 2 insertions(+), 1 deletion(-)
12 rename meta-selftest/recipes-test/selftest-hello/{selftest-hello_1.0.bb => selftest-hello_1.1.bb} (88%)
13
14diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb
15similarity index 88%
16rename from meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
17rename to meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb
18index 547587bef4..acc388ec2c 100644
19--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
20+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb
21@@ -1,3 +1,4 @@
22%+SUMMARY = "Hello!"
23 DESCRIPTION = "Simple helloworld application -- selftest variant"
24 SECTION = "examples"
25 LICENSE = "MIT"
26@@ -16,4 +17,4 @@ do_install() {
27 install -m 0755 helloworld ${D}${bindir}
28 }
29
30-BBCLASSEXTEND = "native nativesdk"
31\ No newline at end of file
32+BBCLASSEXTEND = "native nativesdk"
33--
342.41.0
35
diff --git a/meta/lib/patchtest/selftest/files/MboxFormat.test_mbox_format.pass b/meta/lib/patchtest/selftest/files/MboxFormat.test_mbox_format.pass
new file mode 100644
index 0000000000..33940adffc
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/MboxFormat.test_mbox_format.pass
@@ -0,0 +1,33 @@
1From d12db4cfa913b0e7a4b5bd858d3019acc53ce426 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Wed, 30 Aug 2023 12:15:00 -0400
4Subject: [PATCH] selftest-hello: upgrade 1.0 -> 1.1
5
6Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
7---
8 .../{selftest-hello_1.0.bb => selftest-hello_1.1.bb} | 3 ++-
9 1 file changed, 2 insertions(+), 1 deletion(-)
10 rename meta-selftest/recipes-test/selftest-hello/{selftest-hello_1.0.bb => selftest-hello_1.1.bb} (88%)
11
12diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb
13similarity index 88%
14rename from meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
15rename to meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb
16index 547587bef4..acc388ec2c 100644
17--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
18+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb
19@@ -1,3 +1,4 @@
20+SUMMARY = "Hello!"
21 DESCRIPTION = "Simple helloworld application -- selftest variant"
22 SECTION = "examples"
23 LICENSE = "MIT"
24@@ -16,4 +17,4 @@ do_install() {
25 install -m 0755 helloworld ${D}${bindir}
26 }
27
28-BBCLASSEXTEND = "native nativesdk"
29\ No newline at end of file
30+BBCLASSEXTEND = "native nativesdk"
31--
322.41.0
33
diff --git a/meta/lib/patchtest/selftest/files/Merge.test_series_merge_on_head.fail b/meta/lib/patchtest/selftest/files/Merge.test_series_merge_on_head.fail
new file mode 100644
index 0000000000..49bd1f8ede
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/Merge.test_series_merge_on_head.fail
@@ -0,0 +1,41 @@
1From 55208224f492af0ad929555ffc9b95ff1d301c5f Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Thu, 17 Aug 2023 15:02:38 -0400
4Subject: [PATCH] python3-dtc: upgrade 1.6.1 -> 1.7.0
5
6Changelog: https://kernel.googlesource.com/pub/scm/utils/dtc/dtc/+log/039a99414e778332d8f9c04cbd3072e1dcc62798
7
8Remove custom PV from the recipe since the relevant functionality is in
91.7.0:
10
11[tgamblin@megalith dtc]$ git tag --contains c001fc01a43e7a06447c06ea3d50bd60641322b8
12v1.7.0
13
14Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
15Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
16---
17 .../python/{python3-dtc_1.6.1.bb => python3-dtc_1.7.0.bb} | 3 +--
18 1 file changed, 1 insertion(+), 2 deletions(-)
19 rename meta/recipes-devtools/python/{python3-dtc_1.6.1.bb => python3-dtc_1.7.0.bb} (92%)
20
21diff --git a/meta/recipes-devtools/python/python3-dtc_1.6.1.bb b/meta/recipes-devtools/python/python3-dtc_1.7.0.bb
22similarity index 92%
23rename from meta/recipes-devtools/python/python3-dtc_1.6.1.bb
24rename to meta/recipes-devtools/python/python3-dtc_1.7.0.bb
25index 95ab0be474..85e48d4694 100644
26--- a/meta/recipes-devtools/python/python3-dtc_1.6.1.bb
27+++ b/meta/recipes-devtools/python/python3-dtc_1.7.0.bb
28@@ -14,9 +14,8 @@ UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)"
29
30 LIC_FILES_CHKSUM = "file://pylibfdt/libfdt.i;beginline=1;endline=6;md5=afda088c974174a29108c8d80b5dce90"
31
32-SRCREV = "c001fc01a43e7a06447c06ea3d50bd60641322b8"
33+SRCREV = "039a99414e778332d8f9c04cbd3072e1dcc62798"
34
35-PV = "1.6.1+git"
36 S = "${WORKDIR}/git"
37
38 PYPA_WHEEL = "${S}/dist/libfdt-1.6.2*.whl"
39--
402.41.0
41
diff --git a/meta/lib/patchtest/selftest/files/Merge.test_series_merge_on_head.pass b/meta/lib/patchtest/selftest/files/Merge.test_series_merge_on_head.pass
new file mode 100644
index 0000000000..2a72457878
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/Merge.test_series_merge_on_head.pass
@@ -0,0 +1,35 @@
1From d12db4cfa913b0e7a4b5bd858d3019acc53ce426 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Wed, 30 Aug 2023 12:15:00 -0400
4Subject: [PATCH] selftest-hello: upgrade 1.0 -> 1.1
5
6This file should pass the test_series_merge_on_head test.
7
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9---
10 .../{selftest-hello_1.0.bb => selftest-hello_1.1.bb} | 3 ++-
11 1 file changed, 2 insertions(+), 1 deletion(-)
12 rename meta-selftest/recipes-test/selftest-hello/{selftest-hello_1.0.bb => selftest-hello_1.1.bb} (88%)
13
14diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb
15similarity index 88%
16rename from meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
17rename to meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb
18index 547587bef4..acc388ec2c 100644
19--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
20+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb
21@@ -1,3 +1,4 @@
22+SUMMARY = "Hello!"
23 DESCRIPTION = "Simple helloworld application -- selftest variant"
24 SECTION = "examples"
25 LICENSE = "MIT"
26@@ -16,4 +17,4 @@ do_install() {
27 install -m 0755 helloworld ${D}${bindir}
28 }
29
30-BBCLASSEXTEND = "native nativesdk"
31\ No newline at end of file
32+BBCLASSEXTEND = "native nativesdk"
33--
342.41.0
35
diff --git a/meta/lib/patchtest/selftest/files/PatchSignedOffBy.test_signed_off_by_presence.fail b/meta/lib/patchtest/selftest/files/PatchSignedOffBy.test_signed_off_by_presence.fail
new file mode 100644
index 0000000000..ce8bf7b7d1
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/PatchSignedOffBy.test_signed_off_by_presence.fail
@@ -0,0 +1,71 @@
1From 5a2d0ac780a0f4c046fb1a3c3463d3e726f191cb Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Tue, 29 Aug 2023 14:12:27 -0400
4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5
6CVE: CVE-1234-56789
7
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9---
10 .../selftest-hello/files/CVE-1234-56789.patch | 26 +++++++++++++++++++
11 .../selftest-hello/selftest-hello_1.0.bb | 6 +++--
12 2 files changed, 30 insertions(+), 2 deletions(-)
13 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch
14
15diff --git a/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch
16new file mode 100644
17index 0000000000..92a5b65a53
18--- /dev/null
19+++ b/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch
20@@ -0,0 +1,26 @@
21+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
22+From: Trevor Gamblin <tgamblin@baylibre.com>
23+Date: Tue, 29 Aug 2023 14:08:20 -0400
24+Subject: [PATCH] Fix CVE-NOT-REAL
25+
26+CVE: CVE-1234-56789
27+Upstream-Status: Backport(http://example.com/example)
28+
29+---
30+ strlen.c | 1 +
31+ 1 file changed, 1 insertion(+)
32+
33+diff --git a/strlen.c b/strlen.c
34+index 1788f38..83d7918 100644
35+--- a/strlen.c
36++++ b/strlen.c
37+@@ -8,6 +8,7 @@ int main() {
38+
39+ printf("%d\n", str_len(string1));
40+ printf("%d\n", str_len(string2));
41++ printf("CVE FIXED!!!\n");
42+
43+ return 0;
44+ }
45+--
46+2.41.0
47diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
48index 547587bef4..76975a6729 100644
49--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
50+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
51@@ -3,7 +3,9 @@ SECTION = "examples"
52 LICENSE = "MIT"
53 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
54
55-SRC_URI = "file://helloworld.c"
56+SRC_URI = "file://helloworld.c \
57+ file://CVE-1234-56789.patch \
58+ "
59
60 S = "${WORKDIR}"
61
62@@ -16,4 +18,4 @@ do_install() {
63 install -m 0755 helloworld ${D}${bindir}
64 }
65
66-BBCLASSEXTEND = "native nativesdk"
67\ No newline at end of file
68+BBCLASSEXTEND = "native nativesdk"
69--
702.41.0
71
diff --git a/meta/lib/patchtest/selftest/files/PatchSignedOffBy.test_signed_off_by_presence.pass b/meta/lib/patchtest/selftest/files/PatchSignedOffBy.test_signed_off_by_presence.pass
new file mode 100644
index 0000000000..ea34c76f0d
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/PatchSignedOffBy.test_signed_off_by_presence.pass
@@ -0,0 +1,72 @@
1From 14d72f6973270f78455a8628143f2cff90e8f41e Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Tue, 29 Aug 2023 14:12:27 -0400
4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5
6CVE: CVE-1234-56789
7
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9---
10 .../selftest-hello/files/CVE-1234-56789.patch | 27 +++++++++++++++++++
11 .../selftest-hello/selftest-hello_1.0.bb | 6 +++--
12 2 files changed, 31 insertions(+), 2 deletions(-)
13 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch
14
15diff --git a/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch
16new file mode 100644
17index 0000000000..869cfb6fe5
18--- /dev/null
19+++ b/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch
20@@ -0,0 +1,27 @@
21+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
22+From: Trevor Gamblin <tgamblin@baylibre.com>
23+Date: Tue, 29 Aug 2023 14:08:20 -0400
24+Subject: [PATCH] Fix CVE-NOT-REAL
25+
26+CVE: CVE-1234-56789
27+Upstream-Status: Backport(http://example.com/example)
28+
29+Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
30+---
31+ strlen.c | 1 +
32+ 1 file changed, 1 insertion(+)
33+
34+diff --git a/strlen.c b/strlen.c
35+index 1788f38..83d7918 100644
36+--- a/strlen.c
37++++ b/strlen.c
38+@@ -8,6 +8,7 @@ int main() {
39+
40+ printf("%d\n", str_len(string1));
41+ printf("%d\n", str_len(string2));
42++ printf("CVE FIXED!!!\n");
43+
44+ return 0;
45+ }
46+--
47+2.41.0
48diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
49index 547587bef4..76975a6729 100644
50--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
51+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
52@@ -3,7 +3,9 @@ SECTION = "examples"
53 LICENSE = "MIT"
54 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
55
56-SRC_URI = "file://helloworld.c"
57+SRC_URI = "file://helloworld.c \
58+ file://CVE-1234-56789.patch \
59+ "
60
61 S = "${WORKDIR}"
62
63@@ -16,4 +18,4 @@ do_install() {
64 install -m 0755 helloworld ${D}${bindir}
65 }
66
67-BBCLASSEXTEND = "native nativesdk"
68\ No newline at end of file
69+BBCLASSEXTEND = "native nativesdk"
70--
712.41.0
72
diff --git a/meta/lib/patchtest/selftest/files/Shortlog.test_shortlog_format.fail b/meta/lib/patchtest/selftest/files/Shortlog.test_shortlog_format.fail
new file mode 100644
index 0000000000..cdbbc61b61
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/Shortlog.test_shortlog_format.fail
@@ -0,0 +1,73 @@
1From 35ccee3cee96fb29514475279248078d88907231 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Tue, 29 Aug 2023 14:12:27 -0400
4Subject: [PATCH] selftest-hello% fix CVE-1234-56789
5
6CVE: CVE-1234-56789
7
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9---
10 .../files/0001-Fix-CVE-1234-56789.patch | 27 +++++++++++++++++++
11 .../selftest-hello/selftest-hello_1.0.bb | 6 +++--
12 2 files changed, 31 insertions(+), 2 deletions(-)
13 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
14
15diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
16new file mode 100644
17index 0000000000..9219b8db62
18--- /dev/null
19+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
20@@ -0,0 +1,27 @@
21+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
22+From: Trevor Gamblin <tgamblin@baylibre.com>
23+Date: Tue, 29 Aug 2023 14:08:20 -0400
24+Subject: [PATCH] Fix CVE-NOT-REAL
25+
26+CVE: CVE-1234-56789
27+Upstream-Status: Backport(http://example.com/example)
28+
29+Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
30+---
31+ strlen.c | 1 +
32+ 1 file changed, 1 insertion(+)
33+
34+diff --git a/strlen.c b/strlen.c
35+index 1788f38..83d7918 100644
36+--- a/strlen.c
37++++ b/strlen.c
38+@@ -8,6 +8,7 @@ int main() {
39+
40+ printf("%d\n", str_len(string1));
41+ printf("%d\n", str_len(string2));
42++ printf("CVE FIXED!!!\n");
43+
44+ return 0;
45+ }
46+--
47+2.41.0
48+
49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
50index 547587bef4..76975a6729 100644
51--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
52+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
53@@ -3,7 +3,9 @@ SECTION = "examples"
54 LICENSE = "MIT"
55 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
56
57-SRC_URI = "file://helloworld.c"
58+SRC_URI = "file://helloworld.c \
59+ file://CVE-1234-56789.patch \
60+ "
61
62 S = "${WORKDIR}"
63
64@@ -16,4 +18,4 @@ do_install() {
65 install -m 0755 helloworld ${D}${bindir}
66 }
67
68-BBCLASSEXTEND = "native nativesdk"
69\ No newline at end of file
70+BBCLASSEXTEND = "native nativesdk"
71--
722.41.0
73
diff --git a/meta/lib/patchtest/selftest/files/Shortlog.test_shortlog_format.pass b/meta/lib/patchtest/selftest/files/Shortlog.test_shortlog_format.pass
new file mode 100644
index 0000000000..ef6017037c
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/Shortlog.test_shortlog_format.pass
@@ -0,0 +1,73 @@
1From 35ccee3cee96fb29514475279248078d88907231 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Tue, 29 Aug 2023 14:12:27 -0400
4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5
6CVE: CVE-1234-56789
7
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9---
10 .../files/0001-Fix-CVE-1234-56789.patch | 27 +++++++++++++++++++
11 .../selftest-hello/selftest-hello_1.0.bb | 6 +++--
12 2 files changed, 31 insertions(+), 2 deletions(-)
13 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
14
15diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
16new file mode 100644
17index 0000000000..9219b8db62
18--- /dev/null
19+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
20@@ -0,0 +1,27 @@
21+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
22+From: Trevor Gamblin <tgamblin@baylibre.com>
23+Date: Tue, 29 Aug 2023 14:08:20 -0400
24+Subject: [PATCH] Fix CVE-NOT-REAL
25+
26+CVE: CVE-1234-56789
27+Upstream-Status: Backport(http://example.com/example)
28+
29+Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
30+---
31+ strlen.c | 1 +
32+ 1 file changed, 1 insertion(+)
33+
34+diff --git a/strlen.c b/strlen.c
35+index 1788f38..83d7918 100644
36+--- a/strlen.c
37++++ b/strlen.c
38+@@ -8,6 +8,7 @@ int main() {
39+
40+ printf("%d\n", str_len(string1));
41+ printf("%d\n", str_len(string2));
42++ printf("CVE FIXED!!!\n");
43+
44+ return 0;
45+ }
46+--
47+2.41.0
48+
49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
50index 547587bef4..76975a6729 100644
51--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
52+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
53@@ -3,7 +3,9 @@ SECTION = "examples"
54 LICENSE = "MIT"
55 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
56
57-SRC_URI = "file://helloworld.c"
58+SRC_URI = "file://helloworld.c \
59+ file://CVE-1234-56789.patch \
60+ "
61
62 S = "${WORKDIR}"
63
64@@ -16,4 +18,4 @@ do_install() {
65 install -m 0755 helloworld ${D}${bindir}
66 }
67
68-BBCLASSEXTEND = "native nativesdk"
69\ No newline at end of file
70+BBCLASSEXTEND = "native nativesdk"
71--
722.41.0
73
diff --git a/meta/lib/patchtest/selftest/files/Shortlog.test_shortlog_length.fail b/meta/lib/patchtest/selftest/files/Shortlog.test_shortlog_length.fail
new file mode 100644
index 0000000000..247b2a8a80
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/Shortlog.test_shortlog_length.fail
@@ -0,0 +1,73 @@
1From 35ccee3cee96fb29514475279248078d88907231 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Tue, 29 Aug 2023 14:12:27 -0400
4Subject: [PATCH] selftest-hello: this is a very long commit shortlog with way too many words included in it to pass the test
5
6CVE: CVE-1234-56789
7
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9---
10 .../files/0001-Fix-CVE-1234-56789.patch | 27 +++++++++++++++++++
11 .../selftest-hello/selftest-hello_1.0.bb | 6 +++--
12 2 files changed, 31 insertions(+), 2 deletions(-)
13 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
14
15diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
16new file mode 100644
17index 0000000000..9219b8db62
18--- /dev/null
19+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
20@@ -0,0 +1,27 @@
21+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
22+From: Trevor Gamblin <tgamblin@baylibre.com>
23+Date: Tue, 29 Aug 2023 14:08:20 -0400
24+Subject: [PATCH] Fix CVE-NOT-REAL
25+
26+CVE: CVE-1234-56789
27+Upstream-Status: Backport(http://example.com/example)
28+
29+Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
30+---
31+ strlen.c | 1 +
32+ 1 file changed, 1 insertion(+)
33+
34+diff --git a/strlen.c b/strlen.c
35+index 1788f38..83d7918 100644
36+--- a/strlen.c
37++++ b/strlen.c
38+@@ -8,6 +8,7 @@ int main() {
39+
40+ printf("%d\n", str_len(string1));
41+ printf("%d\n", str_len(string2));
42++ printf("CVE FIXED!!!\n");
43+
44+ return 0;
45+ }
46+--
47+2.41.0
48+
49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
50index 547587bef4..76975a6729 100644
51--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
52+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
53@@ -3,7 +3,9 @@ SECTION = "examples"
54 LICENSE = "MIT"
55 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
56
57-SRC_URI = "file://helloworld.c"
58+SRC_URI = "file://helloworld.c \
59+ file://CVE-1234-56789.patch \
60+ "
61
62 S = "${WORKDIR}"
63
64@@ -16,4 +18,4 @@ do_install() {
65 install -m 0755 helloworld ${D}${bindir}
66 }
67
68-BBCLASSEXTEND = "native nativesdk"
69\ No newline at end of file
70+BBCLASSEXTEND = "native nativesdk"
71--
722.41.0
73
diff --git a/meta/lib/patchtest/selftest/files/Shortlog.test_shortlog_length.pass b/meta/lib/patchtest/selftest/files/Shortlog.test_shortlog_length.pass
new file mode 100644
index 0000000000..ef6017037c
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/Shortlog.test_shortlog_length.pass
@@ -0,0 +1,73 @@
1From 35ccee3cee96fb29514475279248078d88907231 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Tue, 29 Aug 2023 14:12:27 -0400
4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5
6CVE: CVE-1234-56789
7
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9---
10 .../files/0001-Fix-CVE-1234-56789.patch | 27 +++++++++++++++++++
11 .../selftest-hello/selftest-hello_1.0.bb | 6 +++--
12 2 files changed, 31 insertions(+), 2 deletions(-)
13 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
14
15diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
16new file mode 100644
17index 0000000000..9219b8db62
18--- /dev/null
19+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
20@@ -0,0 +1,27 @@
21+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
22+From: Trevor Gamblin <tgamblin@baylibre.com>
23+Date: Tue, 29 Aug 2023 14:08:20 -0400
24+Subject: [PATCH] Fix CVE-NOT-REAL
25+
26+CVE: CVE-1234-56789
27+Upstream-Status: Backport(http://example.com/example)
28+
29+Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
30+---
31+ strlen.c | 1 +
32+ 1 file changed, 1 insertion(+)
33+
34+diff --git a/strlen.c b/strlen.c
35+index 1788f38..83d7918 100644
36+--- a/strlen.c
37++++ b/strlen.c
38+@@ -8,6 +8,7 @@ int main() {
39+
40+ printf("%d\n", str_len(string1));
41+ printf("%d\n", str_len(string2));
42++ printf("CVE FIXED!!!\n");
43+
44+ return 0;
45+ }
46+--
47+2.41.0
48+
49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
50index 547587bef4..76975a6729 100644
51--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
52+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
53@@ -3,7 +3,9 @@ SECTION = "examples"
54 LICENSE = "MIT"
55 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
56
57-SRC_URI = "file://helloworld.c"
58+SRC_URI = "file://helloworld.c \
59+ file://CVE-1234-56789.patch \
60+ "
61
62 S = "${WORKDIR}"
63
64@@ -16,4 +18,4 @@ do_install() {
65 install -m 0755 helloworld ${D}${bindir}
66 }
67
68-BBCLASSEXTEND = "native nativesdk"
69\ No newline at end of file
70+BBCLASSEXTEND = "native nativesdk"
71--
722.41.0
73
diff --git a/meta/lib/patchtest/selftest/files/SignedOffBy.test_signed_off_by_presence.1.fail b/meta/lib/patchtest/selftest/files/SignedOffBy.test_signed_off_by_presence.1.fail
new file mode 100644
index 0000000000..35d92aeed7
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/SignedOffBy.test_signed_off_by_presence.1.fail
@@ -0,0 +1,71 @@
1From 14d72f6973270f78455a8628143f2cff90e8f41e Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Tue, 29 Aug 2023 14:12:27 -0400
4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5
6CVE: CVE-1234-56789
7
8---
9 .../selftest-hello/files/CVE-1234-56789.patch | 27 +++++++++++++++++++
10 .../selftest-hello/selftest-hello_1.0.bb | 6 +++--
11 2 files changed, 31 insertions(+), 2 deletions(-)
12 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch
13
14diff --git a/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch
15new file mode 100644
16index 0000000000..869cfb6fe5
17--- /dev/null
18+++ b/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch
19@@ -0,0 +1,27 @@
20+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
21+From: Trevor Gamblin <tgamblin@baylibre.com>
22+Date: Tue, 29 Aug 2023 14:08:20 -0400
23+Subject: [PATCH] Fix CVE-NOT-REAL
24+
25+CVE: CVE-1234-56789
26+Upstream-Status: Backport(http://example.com/example)
27+
28+Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
29+---
30+ strlen.c | 1 +
31+ 1 file changed, 1 insertion(+)
32+
33+diff --git a/strlen.c b/strlen.c
34+index 1788f38..83d7918 100644
35+--- a/strlen.c
36++++ b/strlen.c
37+@@ -8,6 +8,7 @@ int main() {
38+
39+ printf("%d\n", str_len(string1));
40+ printf("%d\n", str_len(string2));
41++ printf("CVE FIXED!!!\n");
42+
43+ return 0;
44+ }
45+--
46+2.41.0
47diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
48index 547587bef4..76975a6729 100644
49--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
50+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
51@@ -3,7 +3,9 @@ SECTION = "examples"
52 LICENSE = "MIT"
53 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
54
55-SRC_URI = "file://helloworld.c"
56+SRC_URI = "file://helloworld.c \
57+ file://CVE-1234-56789.patch \
58+ "
59
60 S = "${WORKDIR}"
61
62@@ -16,4 +18,4 @@ do_install() {
63 install -m 0755 helloworld ${D}${bindir}
64 }
65
66-BBCLASSEXTEND = "native nativesdk"
67\ No newline at end of file
68+BBCLASSEXTEND = "native nativesdk"
69--
702.41.0
71
diff --git a/meta/lib/patchtest/selftest/files/SignedOffBy.test_signed_off_by_presence.2.fail b/meta/lib/patchtest/selftest/files/SignedOffBy.test_signed_off_by_presence.2.fail
new file mode 100644
index 0000000000..68f38dee06
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/SignedOffBy.test_signed_off_by_presence.2.fail
@@ -0,0 +1,72 @@
1From 14d72f6973270f78455a8628143f2cff90e8f41e Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Tue, 29 Aug 2023 14:12:27 -0400
4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5
6CVE: CVE-1234-56789
7
8Approved: Trevor Gamblin <tgamblin@baylibre.com>
9---
10 .../selftest-hello/files/CVE-1234-56789.patch | 27 +++++++++++++++++++
11 .../selftest-hello/selftest-hello_1.0.bb | 6 +++--
12 2 files changed, 31 insertions(+), 2 deletions(-)
13 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch
14
15diff --git a/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch
16new file mode 100644
17index 0000000000..869cfb6fe5
18--- /dev/null
19+++ b/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch
20@@ -0,0 +1,27 @@
21+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
22+From: Trevor Gamblin <tgamblin@baylibre.com>
23+Date: Tue, 29 Aug 2023 14:08:20 -0400
24+Subject: [PATCH] Fix CVE-NOT-REAL
25+
26+CVE: CVE-1234-56789
27+Upstream-Status: Backport(http://example.com/example)
28+
29+Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
30+---
31+ strlen.c | 1 +
32+ 1 file changed, 1 insertion(+)
33+
34+diff --git a/strlen.c b/strlen.c
35+index 1788f38..83d7918 100644
36+--- a/strlen.c
37++++ b/strlen.c
38+@@ -8,6 +8,7 @@ int main() {
39+
40+ printf("%d\n", str_len(string1));
41+ printf("%d\n", str_len(string2));
42++ printf("CVE FIXED!!!\n");
43+
44+ return 0;
45+ }
46+--
47+2.41.0
48diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
49index 547587bef4..76975a6729 100644
50--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
51+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
52@@ -3,7 +3,9 @@ SECTION = "examples"
53 LICENSE = "MIT"
54 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
55
56-SRC_URI = "file://helloworld.c"
57+SRC_URI = "file://helloworld.c \
58+ file://CVE-1234-56789.patch \
59+ "
60
61 S = "${WORKDIR}"
62
63@@ -16,4 +18,4 @@ do_install() {
64 install -m 0755 helloworld ${D}${bindir}
65 }
66
67-BBCLASSEXTEND = "native nativesdk"
68\ No newline at end of file
69+BBCLASSEXTEND = "native nativesdk"
70--
712.41.0
72
diff --git a/meta/lib/patchtest/selftest/files/SignedOffBy.test_signed_off_by_presence.pass b/meta/lib/patchtest/selftest/files/SignedOffBy.test_signed_off_by_presence.pass
new file mode 100644
index 0000000000..ea34c76f0d
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/SignedOffBy.test_signed_off_by_presence.pass
@@ -0,0 +1,72 @@
1From 14d72f6973270f78455a8628143f2cff90e8f41e Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Tue, 29 Aug 2023 14:12:27 -0400
4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5
6CVE: CVE-1234-56789
7
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9---
10 .../selftest-hello/files/CVE-1234-56789.patch | 27 +++++++++++++++++++
11 .../selftest-hello/selftest-hello_1.0.bb | 6 +++--
12 2 files changed, 31 insertions(+), 2 deletions(-)
13 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch
14
15diff --git a/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch
16new file mode 100644
17index 0000000000..869cfb6fe5
18--- /dev/null
19+++ b/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch
20@@ -0,0 +1,27 @@
21+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
22+From: Trevor Gamblin <tgamblin@baylibre.com>
23+Date: Tue, 29 Aug 2023 14:08:20 -0400
24+Subject: [PATCH] Fix CVE-NOT-REAL
25+
26+CVE: CVE-1234-56789
27+Upstream-Status: Backport(http://example.com/example)
28+
29+Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
30+---
31+ strlen.c | 1 +
32+ 1 file changed, 1 insertion(+)
33+
34+diff --git a/strlen.c b/strlen.c
35+index 1788f38..83d7918 100644
36+--- a/strlen.c
37++++ b/strlen.c
38+@@ -8,6 +8,7 @@ int main() {
39+
40+ printf("%d\n", str_len(string1));
41+ printf("%d\n", str_len(string2));
42++ printf("CVE FIXED!!!\n");
43+
44+ return 0;
45+ }
46+--
47+2.41.0
48diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
49index 547587bef4..76975a6729 100644
50--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
51+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
52@@ -3,7 +3,9 @@ SECTION = "examples"
53 LICENSE = "MIT"
54 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
55
56-SRC_URI = "file://helloworld.c"
57+SRC_URI = "file://helloworld.c \
58+ file://CVE-1234-56789.patch \
59+ "
60
61 S = "${WORKDIR}"
62
63@@ -16,4 +18,4 @@ do_install() {
64 install -m 0755 helloworld ${D}${bindir}
65 }
66
67-BBCLASSEXTEND = "native nativesdk"
68\ No newline at end of file
69+BBCLASSEXTEND = "native nativesdk"
70--
712.41.0
72
diff --git a/meta/lib/patchtest/selftest/files/SrcUri.test_src_uri_left_files.fail b/meta/lib/patchtest/selftest/files/SrcUri.test_src_uri_left_files.fail
new file mode 100644
index 0000000000..983b6e0c2b
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/SrcUri.test_src_uri_left_files.fail
@@ -0,0 +1,35 @@
1From 4ab06b5f81455249cd5e89d2cce9863803b5ecb5 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Fri, 8 Sep 2023 14:41:00 -0400
4Subject: [PATCH] selftest-hello: remove helloworld.c
5
6This should fail the test_src_uri_left_files selftest.
7
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9---
10 .../recipes-test/selftest-hello/selftest-hello_1.0.bb | 4 +---
11 1 file changed, 1 insertion(+), 3 deletions(-)
12
13diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
14index 547587bef4..f6817f05bc 100644
15--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
16+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
17@@ -3,8 +3,6 @@ SECTION = "examples"
18 LICENSE = "MIT"
19 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
20
21-SRC_URI = "file://helloworld.c"
22-
23 S = "${WORKDIR}"
24
25 do_compile() {
26@@ -16,4 +14,4 @@ do_install() {
27 install -m 0755 helloworld ${D}${bindir}
28 }
29
30-BBCLASSEXTEND = "native nativesdk"
31\ No newline at end of file
32+BBCLASSEXTEND = "native nativesdk"
33--
342.41.0
35
diff --git a/meta/lib/patchtest/selftest/files/SrcUri.test_src_uri_left_files.pass b/meta/lib/patchtest/selftest/files/SrcUri.test_src_uri_left_files.pass
new file mode 100644
index 0000000000..1f1a77e581
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/SrcUri.test_src_uri_left_files.pass
@@ -0,0 +1,51 @@
1From 6c7ac367a873bf827c19b81085c943eace917a99 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Fri, 8 Sep 2023 14:41:00 -0400
4Subject: [PATCH] selftest-hello: remove helloworld.c
5
6This should pass the test_src_uri_left_files selftest.
7
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9---
10 .../recipes-test/selftest-hello/files/helloworld.c | 8 --------
11 .../recipes-test/selftest-hello/selftest-hello_1.0.bb | 4 +---
12 2 files changed, 1 insertion(+), 11 deletions(-)
13 delete mode 100644 meta-selftest/recipes-test/selftest-hello/files/helloworld.c
14
15diff --git a/meta-selftest/recipes-test/selftest-hello/files/helloworld.c b/meta-selftest/recipes-test/selftest-hello/files/helloworld.c
16deleted file mode 100644
17index fc7169b7b8..0000000000
18--- a/meta-selftest/recipes-test/selftest-hello/files/helloworld.c
19+++ /dev/null
20@@ -1,8 +0,0 @@
21-#include <stdio.h>
22-
23-int main(void)
24-{
25- printf("Hello world!\n");
26-
27- return 0;
28-}
29diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
30index 547587bef4..f6817f05bc 100644
31--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
32+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
33@@ -3,8 +3,6 @@ SECTION = "examples"
34 LICENSE = "MIT"
35 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
36
37-SRC_URI = "file://helloworld.c"
38-
39 S = "${WORKDIR}"
40
41 do_compile() {
42@@ -16,4 +14,4 @@ do_install() {
43 install -m 0755 helloworld ${D}${bindir}
44 }
45
46-BBCLASSEXTEND = "native nativesdk"
47\ No newline at end of file
48+BBCLASSEXTEND = "native nativesdk"
49--
502.41.0
51
diff --git a/meta/lib/patchtest/selftest/files/Summary.test_summary_presence.fail b/meta/lib/patchtest/selftest/files/Summary.test_summary_presence.fail
new file mode 100644
index 0000000000..2d2b4e683d
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/Summary.test_summary_presence.fail
@@ -0,0 +1,46 @@
1From e29da5faa74409be394caa09d9f3b7b60f8592b9 Mon Sep 17 00:00:00 2001
2From: Daniela Plascencia <daniela.plascencia@linux.intel.com>
3Date: Thu, 23 Feb 2017 10:34:27 -0600
4Subject: [PATCH] meta: adding hello-yocto recipe
5
6This is a sample recipe
7
8Signed-off-by: Daniela Plascencia <daniela.plascencia@linux.intel.com>
9---
10 meta/recipes-devtools/hello-world/hello-world/hello_world.c | 5 +++++
11 meta/recipes-devtools/hello-world/hello-world_1.0.bb | 12 ++++++++++++
12 2 files changed, 17 insertions(+)
13 create mode 100644 meta/recipes-devtools/hello-world/hello-world/hello_world.c
14 create mode 100644 meta/recipes-devtools/hello-world/hello-world_1.0.bb
15
16diff --git a/meta/recipes-devtools/hello-world/hello-world/hello_world.c b/meta/recipes-devtools/hello-world/hello-world/hello_world.c
17new file mode 100644
18index 0000000000..0d59f57d4c
19--- /dev/null
20+++ b/meta/recipes-devtools/hello-world/hello-world/hello_world.c
21@@ -0,0 +1,5 @@
22+#include <stdio.h>
23+
24+int main(){
25+ printf("Hello World\n");
26+}
27diff --git a/meta/recipes-devtools/hello-world/hello-world_1.0.bb b/meta/recipes-devtools/hello-world/hello-world_1.0.bb
28new file mode 100644
29index 0000000000..c4e1359217
30--- /dev/null
31+++ b/meta/recipes-devtools/hello-world/hello-world_1.0.bb
32@@ -0,0 +1,12 @@
33+LICENSE = "CLOSED"
34+
35+SRC_URI += "file://hello_world.c"
36+
37+do_compile(){
38+ ${CC} -o hello_world ../hello_world.c
39+}
40+
41+do_install(){
42+ install -d ${D}${bindir}
43+ install -m +x hello_world ${D}${bindir}/hello_world
44+}
45--
462.11.0
diff --git a/meta/lib/patchtest/selftest/files/Summary.test_summary_presence.pass b/meta/lib/patchtest/selftest/files/Summary.test_summary_presence.pass
new file mode 100644
index 0000000000..55f0309b3f
--- /dev/null
+++ b/meta/lib/patchtest/selftest/files/Summary.test_summary_presence.pass
@@ -0,0 +1,49 @@
1From 0cd2fed12ce4b7b071edde12aec4481ad7a6f107 Mon Sep 17 00:00:00 2001
2From: Daniela Plascencia <daniela.plascencia@linux.intel.com>
3Date: Thu, 23 Feb 2017 10:34:27 -0600
4Subject: [PATCH] meta: adding hello-yocto recipe
5
6This is a sample recipe
7
8Signed-off-by: Daniela Plascencia <daniela.plascencia@linux.intel.com>
9---
10 .../hello-world/hello-world/hello_world.c | 5 +++++
11 meta/recipes-devtools/hello-world/hello-world_1.0.bb | 15 +++++++++++++++
12 2 files changed, 20 insertions(+)
13 create mode 100644 meta/recipes-devtools/hello-world/hello-world/hello_world.c
14 create mode 100644 meta/recipes-devtools/hello-world/hello-world_1.0.bb
15
16diff --git a/meta/recipes-devtools/hello-world/hello-world/hello_world.c b/meta/recipes-devtools/hello-world/hello-world/hello_world.c
17new file mode 100644
18index 0000000000..0d59f57d4c
19--- /dev/null
20+++ b/meta/recipes-devtools/hello-world/hello-world/hello_world.c
21@@ -0,0 +1,5 @@
22+#include <stdio.h>
23+
24+int main(){
25+ printf("Hello World\n");
26+}
27diff --git a/meta/recipes-devtools/hello-world/hello-world_1.0.bb b/meta/recipes-devtools/hello-world/hello-world_1.0.bb
28new file mode 100644
29index 0000000000..c54283eece
30--- /dev/null
31+++ b/meta/recipes-devtools/hello-world/hello-world_1.0.bb
32@@ -0,0 +1,15 @@
33+SUMMARY = "This is a sample summary"
34+DESCRIPTION = "This is a sample description"
35+HOMEPAGE = "https://sample.com/this-is-a-sample"
36+LICENSE = "CLOSED"
37+
38+SRC_URI += "file://hello_world.c"
39+
40+do_compile(){
41+ ${CC} -o hello_world ../hello_world.c
42+}
43+
44+do_install(){
45+ install -d ${D}${bindir}
46+ install -m +x hello_world ${D}${bindir}/hello_world
47+}
48--
492.11.0
diff --git a/meta/lib/patchtest/selftest/selftest b/meta/lib/patchtest/selftest/selftest
new file mode 100755
index 0000000000..c2e6b4863d
--- /dev/null
+++ b/meta/lib/patchtest/selftest/selftest
@@ -0,0 +1,91 @@
1#!/usr/bin/env python3
2
3# Test every patch from files folder and output error on failure
4#
5# Copyright (C) 2016 Intel Corporation
6#
7# SPDX-License-Identifier: GPL-2.0
8
9import os
10import subprocess
11import sys
12
13currentdir = os.path.dirname(os.path.abspath(__file__))
14patchesdir = os.path.join(currentdir, 'files')
15topdir = os.path.dirname(currentdir)
16parentdir = os.path.dirname(topdir)
17
18def print_results(passcount, skipcount, failcount, xpasscount, xfailcount, errorcount):
19 total = passcount + skipcount + failcount + xpasscount + xfailcount + errorcount
20 print("============================================================================")
21 print("Testsuite summary for %s" % os.path.basename(topdir))
22 print("============================================================================")
23 print("# TOTAL: %s" % str(total))
24 print("# XPASS: %s" % str(xpasscount))
25 print("# XFAIL: %s" % str(xfailcount))
26 print("# PASS: %s" % str(passcount))
27 print("# FAIL: %s" % str(failcount))
28 print("# SKIP: %s" % str(skipcount))
29 print("# ERROR: %s" % str(errorcount))
30 print("============================================================================")
31
32# Once the tests are in oe-core, we can remove the testdir param and use os.path.dirname to get relative paths
33def test(root, patch, testdir):
34 res = True
35 patchpath = os.path.abspath(os.path.join(root, patch))
36
37
38 cmd = 'patchtest %s %s/tests --patch %s' % (testdir, topdir, patchpath)
39 results = subprocess.check_output(cmd, stderr=subprocess.STDOUT, universal_newlines=True, shell=True)
40
41 return results
42
43if __name__ == '__main__':
44 # sys.argv[1] should be the repo to target for selftest, i.e. oe-core
45 if len(sys.argv) == 1:
46 sys.exit("Error: Must provide the path to openembedded-core, e.g. \"selftest /workspace/yocto/openembedded-core\"")
47
48 passcount = 0
49 failcount = 0
50 skipcount = 0
51 xpasscount = 0
52 xfailcount = 0
53 errorcount = 0
54
55 results = None
56
57 for root, dirs, patches in os.walk(patchesdir):
58 for patch in patches:
59 results = test(root, patch, sys.argv[1])
60
61 a = patch.split('.')
62 klass, testname = a[0], a[1]
63 expected_result = a[-1]
64 testid = ".%s.%s" % (klass,testname)
65
66 for resultline in results.splitlines():
67 if testid in resultline:
68 result, _ = resultline.split()
69
70 if expected_result.upper() == "FAIL" and result.upper() == "FAIL":
71 xfailcount = xfailcount + 1
72 print("XFAIL: %s (file: %s)" % (testid.strip("."), os.path.basename(patch)))
73 elif expected_result.upper() == "PASS" and result.upper() == "PASS":
74 xpasscount = xpasscount + 1
75 print("XPASS: %s (file: %s)" % (testid.strip("."), os.path.basename(patch)))
76 else:
77 print("%s: %s (%s)" % (result.upper(), testid.strip("."), os.path.basename(patch)))
78 if result.upper() == "PASS":
79 passcount = passcount + 1
80 elif result.upper() == "FAIL":
81 failcount = failcount + 1
82 elif result.upper() == "SKIP":
83 skipcount = skipcount + 1
84 else:
85 print("Bad result on test %s against %s" % (testid.strip("."), os.path.basename(patch)))
86 errorcount = errorcount + 1
87 break
88 else:
89 print ("No test for=%s" % patch)
90
91 print_results(passcount, skipcount, failcount, xpasscount, xfailcount, errorcount)
diff --git a/meta/lib/patchtest/tests/__init__.py b/meta/lib/patchtest/tests/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/meta/lib/patchtest/tests/__init__.py
diff --git a/meta/lib/patchtest/tests/base.py b/meta/lib/patchtest/tests/base.py
new file mode 100644
index 0000000000..27db380353
--- /dev/null
+++ b/meta/lib/patchtest/tests/base.py
@@ -0,0 +1,239 @@
1# Base class to be used by all test cases defined in the suite
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0
6
7import unittest
8import logging
9import json
10import unidiff
11from data import PatchTestInput
12import mailbox
13import collections
14import sys
15import os
16import re
17
18sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'pyparsing'))
19
20logger = logging.getLogger('patchtest')
21debug=logger.debug
22info=logger.info
23warn=logger.warn
24error=logger.error
25
26Commit = collections.namedtuple('Commit', ['author', 'subject', 'commit_message', 'shortlog', 'payload'])
27
28class PatchtestOEError(Exception):
29 """Exception for handling patchtest-oe errors"""
30 def __init__(self, message, exitcode=1):
31 super().__init__(message)
32 self.exitcode = exitcode
33
34class Base(unittest.TestCase):
35 # if unit test fails, fail message will throw at least the following JSON: {"id": <testid>}
36
37 endcommit_messages_regex = re.compile('\(From \w+-\w+ rev:|(?<!\S)Signed-off-by|(?<!\S)---\n')
38 patchmetadata_regex = re.compile('-{3} \S+|\+{3} \S+|@{2} -\d+,\d+ \+\d+,\d+ @{2} \S+')
39
40
41 @staticmethod
42 def msg_to_commit(msg):
43 payload = msg.get_payload()
44 return Commit(subject=msg['subject'].replace('\n', ' ').replace(' ', ' '),
45 author=msg.get('From'),
46 shortlog=Base.shortlog(msg['subject']),
47 commit_message=Base.commit_message(payload),
48 payload=payload)
49
50 @staticmethod
51 def commit_message(payload):
52 commit_message = payload.__str__()
53 match = Base.endcommit_messages_regex.search(payload)
54 if match:
55 commit_message = payload[:match.start()]
56 return commit_message
57
58 @staticmethod
59 def shortlog(shlog):
60 # remove possible prefix (between brackets) before colon
61 start = shlog.find(']', 0, shlog.find(':'))
62 # remove also newlines and spaces at both sides
63 return shlog[start + 1:].replace('\n', '').strip()
64
65 @classmethod
66 def setUpClass(cls):
67
68 # General objects: mailbox.mbox and patchset
69 cls.mbox = mailbox.mbox(PatchTestInput.repo.patch)
70
71 # Patch may be malformed, so try parsing it
72 cls.unidiff_parse_error = ''
73 cls.patchset = None
74 try:
75 cls.patchset = unidiff.PatchSet.from_filename(PatchTestInput.repo.patch, encoding=u'UTF-8')
76 except unidiff.UnidiffParseError as upe:
77 cls.patchset = []
78 cls.unidiff_parse_error = str(upe)
79
80 # Easy to iterate list of commits
81 cls.commits = []
82 for msg in cls.mbox:
83 if msg['subject'] and msg.get_payload():
84 cls.commits.append(Base.msg_to_commit(msg))
85
86 cls.setUpClassLocal()
87
88 @classmethod
89 def tearDownClass(cls):
90 cls.tearDownClassLocal()
91
92 @classmethod
93 def setUpClassLocal(cls):
94 pass
95
96 @classmethod
97 def tearDownClassLocal(cls):
98 pass
99
100 def fail(self, issue, fix=None, commit=None, data=None):
101 """ Convert to a JSON string failure data"""
102 value = {'id': self.id(),
103 'issue': issue}
104
105 if fix:
106 value['fix'] = fix
107 if commit:
108 value['commit'] = {'subject': commit.subject,
109 'shortlog': commit.shortlog}
110
111 # extend return value with other useful info
112 if data:
113 value['data'] = data
114
115 return super(Base, self).fail(json.dumps(value))
116
117 def skip(self, issue, data=None):
118 """ Convert the skip string to JSON"""
119 value = {'id': self.id(),
120 'issue': issue}
121
122 # extend return value with other useful info
123 if data:
124 value['data'] = data
125
126 return super(Base, self).skipTest(json.dumps(value))
127
128 def shortid(self):
129 return self.id().split('.')[-1]
130
131 def __str__(self):
132 return json.dumps({'id': self.id()})
133
134class Metadata(Base):
135 @classmethod
136 def setUpClassLocal(cls):
137 cls.tinfoil = cls.setup_tinfoil()
138
139 # get info about added/modified/remove recipes
140 cls.added, cls.modified, cls.removed = cls.get_metadata_stats(cls.patchset)
141
142 @classmethod
143 def tearDownClassLocal(cls):
144 cls.tinfoil.shutdown()
145
146 @classmethod
147 def setup_tinfoil(cls, config_only=False):
148 """Initialize tinfoil api from bitbake"""
149
150 # import relevant libraries
151 try:
152 scripts_path = os.path.join(PatchTestInput.repodir, 'scripts', 'lib')
153 if scripts_path not in sys.path:
154 sys.path.insert(0, scripts_path)
155 import scriptpath
156 scriptpath.add_bitbake_lib_path()
157 import bb.tinfoil
158 except ImportError:
159 raise PatchtestOEError('Could not import tinfoil module')
160
161 orig_cwd = os.path.abspath(os.curdir)
162
163 # Load tinfoil
164 tinfoil = None
165 try:
166 builddir = os.environ.get('BUILDDIR')
167 if not builddir:
168 logger.warn('Bitbake environment not loaded?')
169 return tinfoil
170 os.chdir(builddir)
171 tinfoil = bb.tinfoil.Tinfoil()
172 tinfoil.prepare(config_only=config_only)
173 except bb.tinfoil.TinfoilUIException as te:
174 if tinfoil:
175 tinfoil.shutdown()
176 raise PatchtestOEError('Could not prepare properly tinfoil (TinfoilUIException)')
177 except Exception as e:
178 if tinfoil:
179 tinfoil.shutdown()
180 raise e
181 finally:
182 os.chdir(orig_cwd)
183
184 return tinfoil
185
186 @classmethod
187 def get_metadata_stats(cls, patchset):
188 """Get lists of added, modified and removed metadata files"""
189
190 def find_pn(data, path):
191 """Find the PN from data"""
192 pn = None
193 pn_native = None
194 for _path, _pn in data:
195 if path in _path:
196 if 'native' in _pn:
197 # store the native PN but look for the non-native one first
198 pn_native = _pn
199 else:
200 pn = _pn
201 break
202 else:
203 # sent the native PN if found previously
204 if pn_native:
205 return pn_native
206
207 # on renames (usually upgrades), we need to check (FILE) base names
208 # because the unidiff library does not provided the new filename, just the modified one
209 # and tinfoil datastore, once the patch is merged, will contain the new filename
210 path_basename = path.split('_')[0]
211 for _path, _pn in data:
212 _path_basename = _path.split('_')[0]
213 if path_basename == _path_basename:
214 pn = _pn
215 return pn
216
217 if not cls.tinfoil:
218 cls.tinfoil = cls.setup_tinfoil()
219
220 added_paths, modified_paths, removed_paths = [], [], []
221 added, modified, removed = [], [], []
222
223 # get metadata filename additions, modification and removals
224 for patch in patchset:
225 if patch.path.endswith('.bb') or patch.path.endswith('.bbappend') or patch.path.endswith('.inc'):
226 if patch.is_added_file:
227 added_paths.append(os.path.join(os.path.abspath(PatchTestInput.repodir), patch.path))
228 elif patch.is_modified_file:
229 modified_paths.append(os.path.join(os.path.abspath(PatchTestInput.repodir), patch.path))
230 elif patch.is_removed_file:
231 removed_paths.append(os.path.join(os.path.abspath(PatchTestInput.repodir), patch.path))
232
233 data = cls.tinfoil.cooker.recipecaches[''].pkg_fn.items()
234
235 added = [find_pn(data,path) for path in added_paths]
236 modified = [find_pn(data,path) for path in modified_paths]
237 removed = [find_pn(data,path) for path in removed_paths]
238
239 return [a for a in added if a], [m for m in modified if m], [r for r in removed if r]
diff --git a/meta/lib/patchtest/tests/pyparsing/common.py b/meta/lib/patchtest/tests/pyparsing/common.py
new file mode 100644
index 0000000000..9d37b0403d
--- /dev/null
+++ b/meta/lib/patchtest/tests/pyparsing/common.py
@@ -0,0 +1,26 @@
1# common pyparsing variables
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0
6
7import pyparsing
8
9# general
10colon = pyparsing.Literal(":")
11start = pyparsing.LineStart()
12end = pyparsing.LineEnd()
13at = pyparsing.Literal("@")
14lessthan = pyparsing.Literal("<")
15greaterthan = pyparsing.Literal(">")
16opensquare = pyparsing.Literal("[")
17closesquare = pyparsing.Literal("]")
18inappropriate = pyparsing.CaselessLiteral("Inappropriate")
19submitted = pyparsing.CaselessLiteral("Submitted")
20
21# word related
22nestexpr = pyparsing.nestedExpr(opener='[', closer=']')
23inappropriateinfo = pyparsing.Literal("Inappropriate") + nestexpr
24submittedinfo = pyparsing.Literal("Submitted") + nestexpr
25word = pyparsing.Word(pyparsing.alphas)
26worddot = pyparsing.Word(pyparsing.alphas+".")
diff --git a/meta/lib/patchtest/tests/pyparsing/parse_cve_tags.py b/meta/lib/patchtest/tests/pyparsing/parse_cve_tags.py
new file mode 100644
index 0000000000..dd7131a650
--- /dev/null
+++ b/meta/lib/patchtest/tests/pyparsing/parse_cve_tags.py
@@ -0,0 +1,18 @@
1# signed-off-by pyparsing definition
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0
6
7
8import pyparsing
9import common
10
11name = pyparsing.Regex('\S+.*(?= <)')
12username = pyparsing.OneOrMore(common.worddot)
13domain = pyparsing.OneOrMore(common.worddot)
14cve = pyparsing.Regex('CVE\-\d{4}\-\d+')
15cve_mark = pyparsing.Literal("CVE:")
16
17cve_tag = pyparsing.AtLineStart(cve_mark + cve)
18patch_cve_tag = pyparsing.AtLineStart("+" + cve_mark + cve)
diff --git a/meta/lib/patchtest/tests/pyparsing/parse_shortlog.py b/meta/lib/patchtest/tests/pyparsing/parse_shortlog.py
new file mode 100644
index 0000000000..26e9612c4a
--- /dev/null
+++ b/meta/lib/patchtest/tests/pyparsing/parse_shortlog.py
@@ -0,0 +1,14 @@
1# subject pyparsing definition
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0
6
7# NOTE:This is an oversimplified syntax of the mbox's summary
8
9import pyparsing
10import common
11
12target = pyparsing.OneOrMore(pyparsing.Word(pyparsing.printables.replace(':','')))
13summary = pyparsing.OneOrMore(pyparsing.Word(pyparsing.printables))
14shortlog = common.start + target + common.colon + summary + common.end
diff --git a/meta/lib/patchtest/tests/pyparsing/parse_signed_off_by.py b/meta/lib/patchtest/tests/pyparsing/parse_signed_off_by.py
new file mode 100644
index 0000000000..c8a4351551
--- /dev/null
+++ b/meta/lib/patchtest/tests/pyparsing/parse_signed_off_by.py
@@ -0,0 +1,22 @@
1# signed-off-by pyparsing definition
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0
6
7
8import pyparsing
9import common
10
11name = pyparsing.Regex('\S+.*(?= <)')
12username = pyparsing.OneOrMore(common.worddot)
13domain = pyparsing.OneOrMore(common.worddot)
14
15# taken from https://pyparsing-public.wikispaces.com/Helpful+Expressions
16email = pyparsing.Regex(r"(?P<user>[A-Za-z0-9._%+-]+)@(?P<hostname>[A-Za-z0-9.-]+)\.(?P<domain>[A-Za-z]{2,})")
17
18email_enclosed = common.lessthan + email + common.greaterthan
19
20signed_off_by_mark = pyparsing.Literal("Signed-off-by:")
21signed_off_by = pyparsing.AtLineStart(signed_off_by_mark + name + email_enclosed)
22patch_signed_off_by = pyparsing.AtLineStart("+" + signed_off_by_mark + name + email_enclosed)
diff --git a/meta/lib/patchtest/tests/pyparsing/parse_upstream_status.py b/meta/lib/patchtest/tests/pyparsing/parse_upstream_status.py
new file mode 100644
index 0000000000..511b36d033
--- /dev/null
+++ b/meta/lib/patchtest/tests/pyparsing/parse_upstream_status.py
@@ -0,0 +1,24 @@
1# upstream-status pyparsing definition
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0
6
7
8import common
9import pyparsing
10
11upstream_status_literal_valid_status = ["Pending", "Accepted", "Backport", "Denied", "Inappropriate", "Submitted"]
12upstream_status_nonliteral_valid_status = ["Pending", "Accepted", "Backport", "Denied", "Inappropriate [reason]", "Submitted [where]"]
13
14upstream_status_valid_status = pyparsing.Or(
15 [pyparsing.Literal(status) for status in upstream_status_literal_valid_status]
16)
17
18upstream_status_mark = pyparsing.Literal("Upstream-Status")
19inappropriate_status_mark = common.inappropriate
20submitted_status_mark = common.submitted
21
22upstream_status = common.start + upstream_status_mark + common.colon + upstream_status_valid_status
23upstream_status_inappropriate_info = common.start + upstream_status_mark + common.colon + common.inappropriateinfo
24upstream_status_submitted_info = common.start + upstream_status_mark + common.colon + common.submittedinfo
diff --git a/meta/lib/patchtest/tests/test_mbox_author.py b/meta/lib/patchtest/tests/test_mbox_author.py
new file mode 100644
index 0000000000..6c79f164d4
--- /dev/null
+++ b/meta/lib/patchtest/tests/test_mbox_author.py
@@ -0,0 +1,29 @@
1# Checks related to the patch's author
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0
6
7import base
8import re
9
10class Author(base.Base):
11
12 auh_email = '<auh@auh.yoctoproject.org>'
13
14 invalids = [re.compile("^Upgrade Helper.+"),
15 re.compile(re.escape(auh_email)),
16 re.compile("uh@not\.set"),
17 re.compile("\S+@example\.com")]
18
19
20 def test_author_valid(self):
21 for commit in self.commits:
22 for invalid in self.invalids:
23 if invalid.search(commit.author):
24 self.fail('Invalid author %s' % commit.author, 'Resend the series with a valid patch\'s author', commit)
25
26 def test_non_auh_upgrade(self):
27 for commit in self.commits:
28 if self.auh_email in commit.payload:
29 self.fail('Invalid author %s in commit message' % self.auh_email, 'Resend the series with a valid patch\'s author', commit)
diff --git a/meta/lib/patchtest/tests/test_mbox_bugzilla.py b/meta/lib/patchtest/tests/test_mbox_bugzilla.py
new file mode 100644
index 0000000000..e8de48bb8d
--- /dev/null
+++ b/meta/lib/patchtest/tests/test_mbox_bugzilla.py
@@ -0,0 +1,22 @@
1# Checks related to the patch's bugzilla tag
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0
6
7import re
8import base
9
10class Bugzilla(base.Base):
11 rexp_detect = re.compile("\[\s?YOCTO.*\]", re.IGNORECASE)
12 rexp_validation = re.compile("\[(\s?YOCTO\s?#\s?(\d+)\s?,?)+\]", re.IGNORECASE)
13
14 def test_bugzilla_entry_format(self):
15 for commit in Bugzilla.commits:
16 for line in commit.commit_message.splitlines():
17 if self.rexp_detect.match(line):
18 if not self.rexp_validation.match(line):
19 self.fail('Yocto Project bugzilla tag is not correctly formatted',
20 'Specify bugzilla ID in commit description with format: "[YOCTO #<bugzilla ID>]"',
21 commit)
22
diff --git a/meta/lib/patchtest/tests/test_mbox_cve.py b/meta/lib/patchtest/tests/test_mbox_cve.py
new file mode 100644
index 0000000000..f99194c094
--- /dev/null
+++ b/meta/lib/patchtest/tests/test_mbox_cve.py
@@ -0,0 +1,49 @@
1# Checks related to the patch's CVE lines
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License version 2 as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License along
15# with this program; if not, write to the Free Software Foundation, Inc.,
16# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18# SPDX-License-Identifier: GPL-2.0-or-later
19
20import base
21import os
22import parse_cve_tags
23import re
24
25class CVE(base.Base):
26
27 revert_shortlog_regex = re.compile('Revert\s+".*"')
28 prog = parse_cve_tags.cve_tag
29
30 def setUp(self):
31 if self.unidiff_parse_error:
32 self.skip('Parse error %s' % self.unidiff_parse_error)
33
34 # we are just interested in series that introduce CVE patches, thus discard other
35 # possibilities: modification to current CVEs, patch directly introduced into the
36 # recipe, upgrades already including the CVE, etc.
37 new_cves = [p for p in self.patchset if p.path.endswith('.patch') and p.is_added_file]
38 if not new_cves:
39 self.skip('No new CVE patches introduced')
40
41 def test_cve_presence_in_commit_message(self):
42 for commit in CVE.commits:
43 # skip those patches that revert older commits, these do not required the tag presence
44 if self.revert_shortlog_regex.match(commit.shortlog):
45 continue
46 if not self.prog.search_string(commit.payload):
47 self.fail('Missing or incorrectly formatted CVE tag in mbox',
48 'Correct or include the CVE tag in the mbox with format: "CVE: CVE-YYYY-XXXX"',
49 commit)
diff --git a/meta/lib/patchtest/tests/test_mbox_description.py b/meta/lib/patchtest/tests/test_mbox_description.py
new file mode 100644
index 0000000000..7addc6b5f7
--- /dev/null
+++ b/meta/lib/patchtest/tests/test_mbox_description.py
@@ -0,0 +1,17 @@
1# Checks related to the patch's commit_message
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0
6
7import base
8
9class CommitMessage(base.Base):
10
11 def test_commit_message_presence(self):
12 for commit in CommitMessage.commits:
13 if not commit.commit_message.strip():
14 self.fail('Patch is missing a descriptive commit message',
15 'Please include a commit message on your patch explaining the change (most importantly why the change is being made)',
16 commit)
17
diff --git a/meta/lib/patchtest/tests/test_mbox_format.py b/meta/lib/patchtest/tests/test_mbox_format.py
new file mode 100644
index 0000000000..85c452ca0d
--- /dev/null
+++ b/meta/lib/patchtest/tests/test_mbox_format.py
@@ -0,0 +1,16 @@
1# Checks correct parsing of mboxes
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0
6
7import base
8import re
9
10class MboxFormat(base.Base):
11
12 def test_mbox_format(self):
13 if self.unidiff_parse_error:
14 self.fail('Series cannot be parsed correctly due to malformed diff lines',
15 'Create the series again using git-format-patch and ensure it can be applied using git am',
16 data=[('Diff line', re.sub('^.+:\s(?<!$)','',self.unidiff_parse_error))])
diff --git a/meta/lib/patchtest/tests/test_mbox_mailinglist.py b/meta/lib/patchtest/tests/test_mbox_mailinglist.py
new file mode 100644
index 0000000000..de38e205b1
--- /dev/null
+++ b/meta/lib/patchtest/tests/test_mbox_mailinglist.py
@@ -0,0 +1,64 @@
1# Check if the series was intended for other project (not OE-Core)
2#
3# Copyright (C) 2017 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0
6
7import subprocess
8import collections
9import base
10import re
11from data import PatchTestInput
12
13class MailingList(base.Base):
14
15 # base paths of main yocto project sub-projects
16 paths = {
17 'oe-core': ['meta-selftest', 'meta-skeleton', 'meta', 'scripts'],
18 'bitbake': ['bitbake'],
19 'documentation': ['documentation'],
20 'poky': ['meta-poky','meta-yocto-bsp'],
21 'oe': ['meta-gpe', 'meta-gnome', 'meta-efl', 'meta-networking', 'meta-multimedia','meta-initramfs', 'meta-ruby', 'contrib', 'meta-xfce', 'meta-filesystems', 'meta-perl', 'meta-webserver', 'meta-systemd', 'meta-oe', 'meta-python']
22 }
23
24 # scripts folder is a mix of oe-core and poky, most is oe-core code except:
25 poky_scripts = ['scripts/yocto-bsp', 'scripts/yocto-kernel', 'scripts/yocto-layer', 'scripts/lib/bsp']
26
27 Project = collections.namedtuple('Project', ['name', 'listemail', 'gitrepo', 'paths'])
28
29 bitbake = Project(name='Bitbake', listemail='bitbake-devel@lists.openembedded.org', gitrepo='http://git.openembedded.org/bitbake/', paths=paths['bitbake'])
30 doc = Project(name='Documentantion', listemail='yocto@yoctoproject.org', gitrepo='http://git.yoctoproject.org/cgit/cgit.cgi/yocto-docs/', paths=paths['documentation'])
31 poky = Project(name='Poky', listemail='poky@yoctoproject.org', gitrepo='http://git.yoctoproject.org/cgit/cgit.cgi/poky/', paths=paths['poky'])
32 oe = Project(name='oe', listemail='openembedded-devel@lists.openembedded.org', gitrepo='http://git.openembedded.org/meta-openembedded/', paths=paths['oe'])
33
34
35 def test_target_mailing_list(self):
36 """In case of merge failure, check for other targeted projects"""
37 if PatchTestInput.repo.ismerged:
38 self.skip('Series merged, no reason to check other mailing lists')
39
40 # a meta project may be indicted in the message subject, if this is the case, just fail
41 # TODO: there may be other project with no-meta prefix, we also need to detect these
42 project_regex = re.compile("\[(?P<project>meta-.+)\]")
43 for commit in MailingList.commits:
44 match = project_regex.match(commit.subject)
45 if match:
46 self.fail('Series sent to the wrong mailing list',
47 'Check the project\'s README (%s) and send the patch to the indicated list' % match.group('project'),
48 commit)
49
50 for patch in self.patchset:
51 folders = patch.path.split('/')
52 base_path = folders[0]
53 for project in [self.bitbake, self.doc, self.oe, self.poky]:
54 if base_path in project.paths:
55 self.fail('Series sent to the wrong mailing list or some patches from the series correspond to different mailing lists', 'Send the series again to the correct mailing list (ML)',
56 data=[('Suggested ML', '%s [%s]' % (project.listemail, project.gitrepo)),
57 ('Patch\'s path:', patch.path)])
58
59 # check for poky's scripts code
60 if base_path.startswith('scripts'):
61 for poky_file in self.poky_scripts:
62 if patch.path.startswith(poky_file):
63 self.fail('Series sent to the wrong mailing list or some patches from the series correspond to different mailing lists', 'Send the series again to the correct mailing list (ML)',
64 data=[('Suggested ML', '%s [%s]' % (self.poky.listemail, self.poky.gitrepo)),('Patch\'s path:', patch.path)])
diff --git a/meta/lib/patchtest/tests/test_mbox_merge.py b/meta/lib/patchtest/tests/test_mbox_merge.py
new file mode 100644
index 0000000000..c8b6718d15
--- /dev/null
+++ b/meta/lib/patchtest/tests/test_mbox_merge.py
@@ -0,0 +1,25 @@
1# Check if mbox was merged by patchtest
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0
6
7import subprocess
8import base
9from data import PatchTestInput
10
11def headlog():
12 output = subprocess.check_output(
13 "cd %s; git log --pretty='%%h#%%aN#%%cD:#%%s' -1" % PatchTestInput.repodir,
14 universal_newlines=True,
15 shell=True
16 )
17 return output.split('#')
18
19class Merge(base.Base):
20 def test_series_merge_on_head(self):
21 if not PatchTestInput.repo.ismerged:
22 commithash, author, date, shortlog = headlog()
23 self.fail('Series does not apply on top of target branch',
24 'Rebase your series on top of targeted branch',
25 data=[('Targeted branch', '%s (currently at %s)' % (PatchTestInput.repo.branch, commithash))])
diff --git a/meta/lib/patchtest/tests/test_mbox_shortlog.py b/meta/lib/patchtest/tests/test_mbox_shortlog.py
new file mode 100644
index 0000000000..b6c2a209ff
--- /dev/null
+++ b/meta/lib/patchtest/tests/test_mbox_shortlog.py
@@ -0,0 +1,41 @@
1# Checks related to the patch's summary
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0
6
7import base
8import parse_shortlog
9import pyparsing
10
11maxlength = 90
12
13class Shortlog(base.Base):
14
15 def test_shortlog_format(self):
16 for commit in Shortlog.commits:
17 shortlog = commit.shortlog
18 if not shortlog.strip():
19 self.skip('Empty shortlog, no reason to execute shortlog format test')
20 else:
21 # no reason to re-check on revert shortlogs
22 if shortlog.startswith('Revert "'):
23 continue
24 try:
25 parse_shortlog.shortlog.parseString(shortlog)
26 except pyparsing.ParseException as pe:
27 self.fail('Shortlog does not follow expected format',
28 'Commit shortlog (first line of commit message) should follow the format "<target>: <summary>"',
29 commit)
30
31 def test_shortlog_length(self):
32 for commit in Shortlog.commits:
33 # no reason to re-check on revert shortlogs
34 shortlog = commit.shortlog
35 if shortlog.startswith('Revert "'):
36 continue
37 l = len(shortlog)
38 if l > maxlength:
39 self.fail('Commit shortlog is too long',
40 'Edit shortlog so that it is %d characters or less (currently %d characters)' % (maxlength, l),
41 commit)
diff --git a/meta/lib/patchtest/tests/test_mbox_signed_off_by.py b/meta/lib/patchtest/tests/test_mbox_signed_off_by.py
new file mode 100644
index 0000000000..6458951f1c
--- /dev/null
+++ b/meta/lib/patchtest/tests/test_mbox_signed_off_by.py
@@ -0,0 +1,28 @@
1# Checks related to the patch's signed-off-by lines
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0
6
7import base
8import parse_signed_off_by
9import re
10
11class SignedOffBy(base.Base):
12
13 revert_shortlog_regex = re.compile('Revert\s+".*"')
14
15 @classmethod
16 def setUpClassLocal(cls):
17 # match self.mark with no '+' preceding it
18 cls.prog = parse_signed_off_by.signed_off_by
19
20 def test_signed_off_by_presence(self):
21 for commit in SignedOffBy.commits:
22 # skip those patches that revert older commits, these do not required the tag presence
23 if self.revert_shortlog_regex.match(commit.shortlog):
24 continue
25 if not SignedOffBy.prog.search_string(commit.payload):
26 self.fail('Patch is missing Signed-off-by',
27 'Sign off the patch (either manually or with "git commit --amend -s")',
28 commit)
diff --git a/meta/lib/patchtest/tests/test_metadata_lic_files_chksum.py b/meta/lib/patchtest/tests/test_metadata_lic_files_chksum.py
new file mode 100644
index 0000000000..e9a5b6bb4e
--- /dev/null
+++ b/meta/lib/patchtest/tests/test_metadata_lic_files_chksum.py
@@ -0,0 +1,82 @@
1# Checks related to the patch's LIC_FILES_CHKSUM metadata variable
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0
6
7import base
8import re
9from data import PatchTestInput, PatchTestDataStore
10
11class LicFilesChkSum(base.Metadata):
12 metadata = 'LIC_FILES_CHKSUM'
13 license = 'LICENSE'
14 closed = 'CLOSED'
15 lictag = 'License-Update'
16 lictag_re = re.compile("^%s:" % lictag, re.MULTILINE)
17
18 def setUp(self):
19 # these tests just make sense on patches that can be merged
20 if not PatchTestInput.repo.canbemerged:
21 self.skip('Patch cannot be merged')
22
23 def test_lic_files_chksum_presence(self):
24 if not self.added:
25 self.skip('No added recipes, skipping test')
26
27 for pn in self.added:
28 rd = self.tinfoil.parse_recipe(pn)
29 pathname = rd.getVar('FILE')
30 # we are not interested in images
31 if '/images/' in pathname:
32 continue
33 lic_files_chksum = rd.getVar(self.metadata)
34 if rd.getVar(self.license) == self.closed:
35 continue
36 if not lic_files_chksum:
37 self.fail('%s is missing in newly added recipe' % self.metadata,
38 'Specify the variable %s in %s' % (self.metadata, pn))
39
40 def pretest_lic_files_chksum_modified_not_mentioned(self):
41 if not self.modified:
42 self.skip('No modified recipes, skipping pretest')
43 # get the proper metadata values
44 for pn in self.modified:
45 rd = self.tinfoil.parse_recipe(pn)
46 pathname = rd.getVar('FILE')
47 # we are not interested in images
48 if '/images/' in pathname:
49 continue
50 PatchTestDataStore['%s-%s-%s' % (self.shortid(),self.metadata,pn)] = rd.getVar(self.metadata)
51
52 def test_lic_files_chksum_modified_not_mentioned(self):
53 if not self.modified:
54 self.skip('No modified recipes, skipping test')
55
56 # get the proper metadata values
57 for pn in self.modified:
58 rd = self.tinfoil.parse_recipe(pn)
59 pathname = rd.getVar('FILE')
60 # we are not interested in images
61 if '/images/' in pathname:
62 continue
63 PatchTestDataStore['%s-%s-%s' % (self.shortid(),self.metadata,pn)] = rd.getVar(self.metadata)
64 # compare if there were changes between pre-merge and merge
65 for pn in self.modified:
66 pretest = PatchTestDataStore['pre%s-%s-%s' % (self.shortid(),self.metadata, pn)]
67 test = PatchTestDataStore['%s-%s-%s' % (self.shortid(),self.metadata, pn)]
68
69 # TODO: this is workaround to avoid false-positives when pretest metadata is empty (not reason found yet)
70 # For more info, check bug 12284
71 if not pretest:
72 return
73
74 if pretest != test:
75 # if any patch on the series contain reference on the metadata, fail
76 for commit in self.commits:
77 if self.lictag_re.search(commit.commit_message):
78 break
79 else:
80 self.fail('LIC_FILES_CHKSUM changed on target %s but there is no "%s" tag in commit message' % (pn, self.lictag),
81 'Include "%s: <description>" into the commit message with a brief description' % self.lictag,
82 data=[('Current checksum', pretest), ('New checksum', test)])
diff --git a/meta/lib/patchtest/tests/test_metadata_license.py b/meta/lib/patchtest/tests/test_metadata_license.py
new file mode 100644
index 0000000000..16604dbfb1
--- /dev/null
+++ b/meta/lib/patchtest/tests/test_metadata_license.py
@@ -0,0 +1,55 @@
1# Checks related to the patch's LIC_FILES_CHKSUM metadata variable
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0
6
7import base
8import os
9from data import PatchTestInput
10
11class License(base.Metadata):
12 metadata = 'LICENSE'
13 invalid_license = 'PATCHTESTINVALID'
14
15 def setUp(self):
16 # these tests just make sense on patches that can be merged
17 if not PatchTestInput.repo.canbemerged:
18 self.skip('Patch cannot be merged')
19
20 def test_license_presence(self):
21 if not self.added:
22 self.skip('No added recipes, skipping test')
23
24 # TODO: this is a workaround so we can parse the recipe not
25 # containing the LICENSE var: add some default license instead
26 # of INVALID into auto.conf, then remove this line at the end
27 auto_conf = os.path.join(os.environ.get('BUILDDIR'), 'conf', 'auto.conf')
28 open_flag = 'w'
29 if os.path.exists(auto_conf):
30 open_flag = 'a'
31 with open(auto_conf, open_flag) as fd:
32 for pn in self.added:
33 fd.write('LICENSE ??= "%s"\n' % self.invalid_license)
34
35 no_license = False
36 for pn in self.added:
37 rd = self.tinfoil.parse_recipe(pn)
38 license = rd.getVar(self.metadata)
39 if license == self.invalid_license:
40 no_license = True
41 break
42
43 # remove auto.conf line or the file itself
44 if open_flag == 'w':
45 os.remove(auto_conf)
46 else:
47 fd = open(auto_conf, 'r')
48 lines = fd.readlines()
49 fd.close()
50 with open(auto_conf, 'w') as fd:
51 fd.write(''.join(lines[:-1]))
52
53 if no_license:
54 self.fail('Recipe does not have the LICENSE field set', 'Include a LICENSE into the new recipe')
55
diff --git a/meta/lib/patchtest/tests/test_metadata_max_length.py b/meta/lib/patchtest/tests/test_metadata_max_length.py
new file mode 100644
index 0000000000..04a5e23469
--- /dev/null
+++ b/meta/lib/patchtest/tests/test_metadata_max_length.py
@@ -0,0 +1,26 @@
1# Checks related to patch line lengths
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0
6
7import base
8import re
9
10class MaxLength(base.Base):
11 add_mark = re.compile('\+ ')
12 max_length = 200
13
14 def test_max_line_length(self):
15 for patch in self.patchset:
16 # for the moment, we are just interested in metadata
17 if patch.path.endswith('.patch'):
18 continue
19 payload = str(patch)
20 for line in payload.splitlines():
21 if self.add_mark.match(line):
22 current_line_length = len(line[1:])
23 if current_line_length > self.max_length:
24 self.fail('Patch line too long (current length %s)' % current_line_length,
25 'Shorten the corresponding patch line (max length supported %s)' % self.max_length,
26 data=[('Patch', patch.path), ('Line', '%s ...' % line[0:80])])
diff --git a/meta/lib/patchtest/tests/test_metadata_src_uri.py b/meta/lib/patchtest/tests/test_metadata_src_uri.py
new file mode 100644
index 0000000000..718229d7ad
--- /dev/null
+++ b/meta/lib/patchtest/tests/test_metadata_src_uri.py
@@ -0,0 +1,75 @@
1# Checks related to the patch's SRC_URI metadata variable
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0
6
7import subprocess
8import base
9import re
10import os
11from data import PatchTestInput, PatchTestDataStore
12
13class SrcUri(base.Metadata):
14
15 metadata = 'SRC_URI'
16 md5sum = 'md5sum'
17 sha256sum = 'sha256sum'
18 git_regex = re.compile('^git\:\/\/.*')
19
20 def setUp(self):
21 # these tests just make sense on patches that can be merged
22 if not PatchTestInput.repo.canbemerged:
23 self.skip('Patch cannot be merged')
24
25 def pretest_src_uri_left_files(self):
26 if not self.modified:
27 self.skip('No modified recipes, skipping pretest')
28
29 # get the proper metadata values
30 for pn in self.modified:
31 # we are not interested in images
32 if 'core-image' in pn:
33 continue
34 rd = self.tinfoil.parse_recipe(pn)
35 PatchTestDataStore['%s-%s-%s' % (self.shortid(), self.metadata, pn)] = rd.getVar(self.metadata)
36
37 def test_src_uri_left_files(self):
38 if not self.modified:
39 self.skip('No modified recipes, skipping pretest')
40
41 # get the proper metadata values
42 for pn in self.modified:
43 # we are not interested in images
44 if 'core-image' in pn:
45 continue
46 rd = self.tinfoil.parse_recipe(pn)
47 PatchTestDataStore['%s-%s-%s' % (self.shortid(), self.metadata, pn)] = rd.getVar(self.metadata)
48
49 for pn in self.modified:
50 pretest_src_uri = PatchTestDataStore['pre%s-%s-%s' % (self.shortid(), self.metadata, pn)].split()
51 test_src_uri = PatchTestDataStore['%s-%s-%s' % (self.shortid(), self.metadata, pn)].split()
52
53 pretest_files = set([os.path.basename(patch) for patch in pretest_src_uri if patch.startswith('file://')])
54 test_files = set([os.path.basename(patch) for patch in test_src_uri if patch.startswith('file://')])
55
56 # check if files were removed
57 if len(test_files) < len(pretest_files):
58
59 # get removals from patchset
60 filesremoved_from_patchset = set()
61 for patch in self.patchset:
62 if patch.is_removed_file:
63 filesremoved_from_patchset.add(os.path.basename(patch.path))
64
65 # get the deleted files from the SRC_URI
66 filesremoved_from_usr_uri = pretest_files - test_files
67
68 # finally, get those patches removed at SRC_URI and not removed from the patchset
69 # TODO: we are not taking into account renames, so test may raise false positives
70 not_removed = filesremoved_from_usr_uri - filesremoved_from_patchset
71 if not_removed:
72 self.fail('Patches not removed from tree',
73 'Amend the patch containing the software patch file removal',
74 data=[('Patch', f) for f in not_removed])
75
diff --git a/meta/lib/patchtest/tests/test_metadata_summary.py b/meta/lib/patchtest/tests/test_metadata_summary.py
new file mode 100644
index 0000000000..931b26768e
--- /dev/null
+++ b/meta/lib/patchtest/tests/test_metadata_summary.py
@@ -0,0 +1,32 @@
1# Checks related to the patch's summary metadata variable
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0
6
7import base
8from data import PatchTestInput
9
10class Summary(base.Metadata):
11 metadata = 'SUMMARY'
12
13 def setUp(self):
14 # these tests just make sense on patches that can be merged
15 if not PatchTestInput.repo.canbemerged:
16 self.skip('Patch cannot be merged')
17
18 def test_summary_presence(self):
19 if not self.added:
20 self.skip('No added recipes, skipping test')
21
22 for pn in self.added:
23 # we are not interested in images
24 if 'core-image' in pn:
25 continue
26 rd = self.tinfoil.parse_recipe(pn)
27 summary = rd.getVar(self.metadata)
28
29 # "${PN} version ${PN}-${PR}" is the default, so fail if default
30 if summary.startswith('%s version' % pn):
31 self.fail('%s is missing in newly added recipe' % self.metadata,
32 'Specify the variable %s in %s' % (self.metadata, pn))
diff --git a/meta/lib/patchtest/tests/test_patch_cve.py b/meta/lib/patchtest/tests/test_patch_cve.py
new file mode 100644
index 0000000000..46ed9ef791
--- /dev/null
+++ b/meta/lib/patchtest/tests/test_patch_cve.py
@@ -0,0 +1,51 @@
1# Checks related to the patch's CVE lines
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License version 2 as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License along
15# with this program; if not, write to the Free Software Foundation, Inc.,
16# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18# SPDX-License-Identifier: GPL-2.0-or-later
19
20import base
21import os
22import re
23
24class CVE(base.Base):
25
26 re_cve_pattern = re.compile("CVE\-\d{4}\-\d+", re.IGNORECASE)
27 re_cve_payload_tag = re.compile("\+CVE:(\s+CVE\-\d{4}\-\d+)+")
28
29 def setUp(self):
30 if self.unidiff_parse_error:
31 self.skip('Parse error %s' % self.unidiff_parse_error)
32
33 # we are just interested in series that introduce CVE patches, thus discard other
34 # possibilities: modification to current CVEs, patch directly introduced into the
35 # recipe, upgrades already including the CVE, etc.
36 new_cves = [p for p in self.patchset if p.path.endswith('.patch') and p.is_added_file]
37 if not new_cves:
38 self.skip('No new CVE patches introduced')
39
40 def test_cve_tag_format(self):
41 for commit in CVE.commits:
42 if self.re_cve_pattern.search(commit.shortlog) or self.re_cve_pattern.search(commit.commit_message):
43 tag_found = False
44 for line in commit.payload.splitlines():
45 if self.re_cve_payload_tag.match(line):
46 tag_found = True
47 break
48 if not tag_found:
49 self.fail('Missing or incorrectly formatted CVE tag in included patch file',
50 'Correct or include the CVE tag on cve patch with format: "CVE: CVE-YYYY-XXXX"',
51 commit)
diff --git a/meta/lib/patchtest/tests/test_patch_signed_off_by.py b/meta/lib/patchtest/tests/test_patch_signed_off_by.py
new file mode 100644
index 0000000000..4855d6daf7
--- /dev/null
+++ b/meta/lib/patchtest/tests/test_patch_signed_off_by.py
@@ -0,0 +1,43 @@
1# Checks related to the patch's signed-off-by lines
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0
6
7import base
8import parse_signed_off_by
9import re
10
11class PatchSignedOffBy(base.Base):
12
13 @classmethod
14 def setUpClassLocal(cls):
15 cls.newpatches = []
16 # get just those relevant patches: new software patches
17 for patch in cls.patchset:
18 if patch.path.endswith('.patch') and patch.is_added_file:
19 cls.newpatches.append(patch)
20
21 cls.mark = str(parse_signed_off_by.signed_off_by_mark).strip('"')
22
23 # match PatchSignedOffBy.mark with '+' preceding it
24 cls.prog = parse_signed_off_by.patch_signed_off_by
25
26 def setUp(self):
27 if self.unidiff_parse_error:
28 self.skip('Parse error %s' % self.unidiff_parse_error)
29
30 def test_signed_off_by_presence(self):
31 if not PatchSignedOffBy.newpatches:
32 self.skip("There are no new software patches, no reason to test %s presence" % PatchSignedOffBy.mark)
33
34 for newpatch in PatchSignedOffBy.newpatches:
35 payload = newpatch.__str__()
36 for line in payload.splitlines():
37 if self.patchmetadata_regex.match(line):
38 continue
39 if PatchSignedOffBy.prog.search_string(payload):
40 break
41 else:
42 self.fail('A patch file has been added, but does not have a Signed-off-by tag',
43 'Sign off the added patch file (%s)' % newpatch.path)
diff --git a/meta/lib/patchtest/tests/test_patch_upstream_status.py b/meta/lib/patchtest/tests/test_patch_upstream_status.py
new file mode 100644
index 0000000000..eda5353c66
--- /dev/null
+++ b/meta/lib/patchtest/tests/test_patch_upstream_status.py
@@ -0,0 +1,64 @@
1# Checks related to the patch's upstream-status lines
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0
6
7import base
8import parse_upstream_status
9import pyparsing
10import os
11
12class PatchUpstreamStatus(base.Base):
13
14 upstream_status_regex = pyparsing.AtLineStart("+" + "Upstream-Status")
15
16 @classmethod
17 def setUpClassLocal(cls):
18 cls.newpatches = []
19 # get just those relevant patches: new software patches
20 for patch in cls.patchset:
21 if patch.path.endswith('.patch') and patch.is_added_file:
22 cls.newpatches.append(patch)
23
24 def setUp(self):
25 if self.unidiff_parse_error:
26 self.skip('Python-unidiff parse error')
27 self.valid_status = ', '.join(parse_upstream_status.upstream_status_nonliteral_valid_status)
28 self.standard_format = 'Upstream-Status: <Valid status>'
29
30 def test_upstream_status_presence_format(self):
31 if not PatchUpstreamStatus.newpatches:
32 self.skip("There are no new software patches, no reason to test Upstream-Status presence/format")
33
34 for newpatch in PatchUpstreamStatus.newpatches:
35 payload = newpatch.__str__()
36 if not self.upstream_status_regex.search_string(payload):
37 self.fail('Added patch file is missing Upstream-Status in the header',
38 'Add Upstream-Status: <Valid status> to the header of %s' % newpatch.path,
39 data=[('Standard format', self.standard_format), ('Valid status', self.valid_status)])
40 for line in payload.splitlines():
41 if self.patchmetadata_regex.match(line):
42 continue
43 if self.upstream_status_regex.search_string(line):
44 if parse_upstream_status.inappropriate_status_mark.searchString(line):
45 try:
46 parse_upstream_status.upstream_status_inappropriate_info.parseString(line.lstrip('+'))
47 except pyparsing.ParseException as pe:
48 self.fail('Upstream-Status is Inappropriate, but no reason was provided',
49 'Include a brief reason why %s is inappropriate' % os.path.basename(newpatch.path),
50 data=[('Current', pe.pstr), ('Standard format', 'Upstream-Status: Inappropriate [reason]')])
51 elif parse_upstream_status.submitted_status_mark.searchString(line):
52 try:
53 parse_upstream_status.upstream_status_submitted_info.parseString(line.lstrip('+'))
54 except pyparsing.ParseException as pe:
55 self.fail('Upstream-Status is Submitted, but it is not mentioned where',
56 'Include where %s was submitted' % os.path.basename(newpatch.path),
57 data=[('Current', pe.pstr), ('Standard format', 'Upstream-Status: Submitted [where]')])
58 else:
59 try:
60 parse_upstream_status.upstream_status.parseString(line.lstrip('+'))
61 except pyparsing.ParseException as pe:
62 self.fail('Upstream-Status is in incorrect format',
63 'Fix Upstream-Status format in %s' % os.path.basename(newpatch.path),
64 data=[('Current', pe.pstr), ('Standard format', self.standard_format), ('Valid status', self.valid_status)])
diff --git a/meta/lib/patchtest/tests/test_python_pylint.py b/meta/lib/patchtest/tests/test_python_pylint.py
new file mode 100644
index 0000000000..ea8efb7c2a
--- /dev/null
+++ b/meta/lib/patchtest/tests/test_python_pylint.py
@@ -0,0 +1,61 @@
1# Checks related to the python code done with pylint
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0
6
7import base
8from data import PatchTestInput
9import pylint.epylint as lint
10
11class PyLint(base.Base):
12 pythonpatches = []
13 pylint_pretest = {}
14 pylint_test = {}
15 pylint_options = " -E --disable='E0611, E1101, F0401, E0602' --msg-template='L:{line} F:{module} I:{msg}'"
16
17 @classmethod
18 def setUpClassLocal(cls):
19 # get just those patches touching python files
20 cls.pythonpatches = []
21 for patch in cls.patchset:
22 if patch.path.endswith('.py'):
23 if not patch.is_removed_file:
24 cls.pythonpatches.append(patch)
25
26 def setUp(self):
27 if self.unidiff_parse_error:
28 self.skip('Python-unidiff parse error')
29 if not PatchTestInput.repo.canbemerged:
30 self.skip('Patch cannot be merged, no reason to execute the test method')
31 if not PyLint.pythonpatches:
32 self.skip('No python related patches, skipping test')
33
34 def pretest_pylint(self):
35 for pythonpatch in self.pythonpatches:
36 if pythonpatch.is_modified_file:
37 (pylint_stdout, pylint_stderr) = lint.py_run(command_options = pythonpatch.path + self.pylint_options, return_std=True)
38 for line in pylint_stdout.readlines():
39 if not '*' in line:
40 if line.strip():
41 self.pylint_pretest[line.strip().split(' ',1)[0]] = line.strip().split(' ',1)[1]
42
43 def test_pylint(self):
44 for pythonpatch in self.pythonpatches:
45 # a condition checking whether a file is renamed or not
46 # unidiff doesn't support this yet
47 if pythonpatch.target_file is not pythonpatch.path:
48 path = pythonpatch.target_file[2:]
49 else:
50 path = pythonpatch.path
51 (pylint_stdout, pylint_stderr) = lint.py_run(command_options = path + self.pylint_options, return_std=True)
52 for line in pylint_stdout.readlines():
53 if not '*' in line:
54 if line.strip():
55 self.pylint_test[line.strip().split(' ',1)[0]] = line.strip().split(' ',1)[1]
56
57 for issue in self.pylint_test:
58 if self.pylint_test[issue] not in self.pylint_pretest.values():
59 self.fail('Errors in your Python code were encountered',
60 'Correct the lines introduced by your patch',
61 data=[('Output', 'Please, fix the listed issues:'), ('', issue + ' ' + self.pylint_test[issue])])