Skip to content

Commit 47f7ed5

Browse files
committed
tests/selftests: add files
Port the mbox test files over from the oe-core repo so that we don't have to keep pulling random patches from Patchwork and modifying them to do testing. Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
1 parent 6d8c258 commit 47f7ed5

19 files changed

Lines changed: 1158 additions & 0 deletions
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
From 04eb94a0134ef5eb5b5fd783b303104fbfcd8437 Mon Sep 17 00:00:00 2001
2+
From: First Last <first.last@example.com>
3+
Date: Fri, 31 May 2024 11:03:47 -0400
4+
Subject: [PATCH] selftest-hello: add selftest-hello-extra
5+
6+
This should fail the test_author_valid test.
7+
8+
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9+
---
10+
.../selftest-hello-extra_1.0.bb | 21 +++++++++++++++++++
11+
1 file changed, 21 insertions(+)
12+
create mode 100644 meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
13+
14+
diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
15+
new file mode 100644
16+
index 00000000000..f3dec1b220c
17+
--- /dev/null
18+
+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
19+
@@ -0,0 +1,21 @@
20+
+SUMMARY = "This is an example summary"
21+
+DESCRIPTION = "Simple helloworld application -- selftest variant"
22+
+SECTION = "examples"
23+
+LICENSE = "MIT"
24+
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
25+
+
26+
+SRC_URI = "file://helloworld.c"
27+
+
28+
+S = "${WORKDIR}/sources"
29+
+UNPACKDIR = "${S}"
30+
+
31+
+do_compile() {
32+
+ ${CC} ${CFLAGS} ${LDFLAGS} helloworld.c -o helloworld
33+
+}
34+
+
35+
+do_install() {
36+
+ install -d ${D}${bindir}
37+
+ install -m 0755 helloworld ${D}${bindir}
38+
+}
39+
+
40+
+BBCLASSEXTEND = "native nativesdk"
41+
--
42+
2.45.1
43+
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
From 04eb94a0134ef5eb5b5fd783b303104fbfcd8437 Mon Sep 17 00:00:00 2001
2+
From: First Last <first.last@address.com>
3+
Date: Fri, 31 May 2024 11:03:47 -0400
4+
Subject: [PATCH] selftest-hello: add selftest-hello-extra
5+
6+
This should pass the test_author_valid test.
7+
8+
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9+
---
10+
.../selftest-hello-extra_1.0.bb | 21 +++++++++++++++++++
11+
1 file changed, 21 insertions(+)
12+
create mode 100644 meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
13+
14+
diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
15+
new file mode 100644
16+
index 00000000000..f3dec1b220c
17+
--- /dev/null
18+
+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
19+
@@ -0,0 +1,21 @@
20+
+SUMMARY = "This is an example summary"
21+
+DESCRIPTION = "Simple helloworld application -- selftest variant"
22+
+SECTION = "examples"
23+
+LICENSE = "MIT"
24+
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
25+
+
26+
+SRC_URI = "file://helloworld.c"
27+
+
28+
+S = "${WORKDIR}/sources"
29+
+UNPACKDIR = "${S}"
30+
+
31+
+do_compile() {
32+
+ ${CC} ${CFLAGS} ${LDFLAGS} helloworld.c -o helloworld
33+
+}
34+
+
35+
+do_install() {
36+
+ install -d ${D}${bindir}
37+
+ install -m 0755 helloworld ${D}${bindir}
38+
+}
39+
+
40+
+BBCLASSEXTEND = "native nativesdk"
41+
--
42+
2.45.1
43+
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
From 04eb94a0134ef5eb5b5fd783b303104fbfcd8437 Mon Sep 17 00:00:00 2001
2+
From: Upgrade Helper <auh@auh.yoctoproject.org>
3+
Date: Fri, 31 May 2024 11:03:47 -0400
4+
Subject: [PATCH] selftest-hello: add selftest-hello-extra
5+
6+
This should fail the test_author_valid test.
7+
8+
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9+
---
10+
.../selftest-hello-extra_1.0.bb | 21 +++++++++++++++++++
11+
1 file changed, 21 insertions(+)
12+
create mode 100644 meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
13+
14+
diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
15+
new file mode 100644
16+
index 00000000000..f3dec1b220c
17+
--- /dev/null
18+
+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
19+
@@ -0,0 +1,21 @@
20+
+SUMMARY = "This is an example summary"
21+
+DESCRIPTION = "Simple helloworld application -- selftest variant"
22+
+SECTION = "examples"
23+
+LICENSE = "MIT"
24+
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
25+
+
26+
+SRC_URI = "file://helloworld.c"
27+
+
28+
+S = "${WORKDIR}/sources"
29+
+UNPACKDIR = "${S}"
30+
+
31+
+do_compile() {
32+
+ ${CC} ${CFLAGS} ${LDFLAGS} helloworld.c -o helloworld
33+
+}
34+
+
35+
+do_install() {
36+
+ install -d ${D}${bindir}
37+
+ install -m 0755 helloworld ${D}${bindir}
38+
+}
39+
+
40+
+BBCLASSEXTEND = "native nativesdk"
41+
--
42+
2.45.1
43+
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
From 04eb94a0134ef5eb5b5fd783b303104fbfcd8437 Mon Sep 17 00:00:00 2001
2+
From: First Last <averylongemailaddressthatishardtoread.from@address.com>
3+
Date: Fri, 31 May 2024 11:03:47 -0400
4+
Subject: [PATCH] selftest-hello: add selftest-hello-extra
5+
6+
This should pass the test_author_valid test.
7+
8+
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9+
---
10+
.../selftest-hello-extra_1.0.bb | 21 +++++++++++++++++++
11+
1 file changed, 21 insertions(+)
12+
create mode 100644 meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
13+
14+
diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
15+
new file mode 100644
16+
index 00000000000..f3dec1b220c
17+
--- /dev/null
18+
+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
19+
@@ -0,0 +1,21 @@
20+
+SUMMARY = "This is an example summary"
21+
+DESCRIPTION = "Simple helloworld application -- selftest variant"
22+
+SECTION = "examples"
23+
+LICENSE = "MIT"
24+
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
25+
+
26+
+SRC_URI = "file://helloworld.c"
27+
+
28+
+S = "${WORKDIR}/sources"
29+
+UNPACKDIR = "${S}"
30+
+
31+
+do_compile() {
32+
+ ${CC} ${CFLAGS} ${LDFLAGS} helloworld.c -o helloworld
33+
+}
34+
+
35+
+do_install() {
36+
+ install -d ${D}${bindir}
37+
+ install -m 0755 helloworld ${D}${bindir}
38+
+}
39+
+
40+
+BBCLASSEXTEND = "native nativesdk"
41+
--
42+
2.45.1
43+
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
From c9519f11502d5bb5c143ed43b4c981b6a211bdf9 Mon Sep 17 00:00:00 2001
2+
From: Trevor Gamblin <tgamblin@baylibre.com>
3+
Date: Fri, 31 May 2024 09:54:50 -0400
4+
Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5+
6+
This should fail the test_bugzilla_entry_format test.
7+
8+
[YOCTO 1234]
9+
CVE: CVE-1234-56789
10+
11+
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
12+
---
13+
.../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++
14+
.../selftest-hello/selftest-hello_1.0.bb | 4 ++-
15+
2 files changed, 29 insertions(+), 1 deletion(-)
16+
create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
17+
18+
diff --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
19+
new file mode 100644
20+
index 00000000000..8a4f9329303
21+
--- /dev/null
22+
+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
23+
@@ -0,0 +1,26 @@
24+
+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
25+
+From: Trevor Gamblin <tgamblin@baylibre.com>
26+
+Date: Tue, 29 Aug 2023 14:08:20 -0400
27+
+Subject: [PATCH] Fix CVE-NOT-REAL
28+
+
29+
+CVE: CVE-1234-56789
30+
+Upstream-Status: Backport(http://example.com/example)
31+
+
32+
+Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
33+
+---
34+
+ strlen.c | 1 +
35+
+ 1 file changed, 1 insertion(+)
36+
+
37+
+diff --git a/strlen.c b/strlen.c
38+
+index 1788f38..83d7918 100644
39+
+--- a/strlen.c
40+
++++ b/strlen.c
41+
+
42+
+int main() {
43+
+
44+
+ printf("%d\n", str_len(string1));
45+
+ printf("%d\n", str_len(string2));
46+
+ printf("CVE FIXED!!!\n");
47+
+
48+
+ return 0;
49+
+}
50+
diff --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
51+
index 2dc352d479e..d937759f157 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://0001-Fix-CVE-1234-56789.patch \
61+
+ "
62+
63+
S = "${WORKDIR}/sources"
64+
UNPACKDIR = "${S}"
65+
--
66+
2.45.1
67+
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
From c9519f11502d5bb5c143ed43b4c981b6a211bdf9 Mon Sep 17 00:00:00 2001
2+
From: Trevor Gamblin <tgamblin@baylibre.com>
3+
Date: Fri, 31 May 2024 09:54:50 -0400
4+
Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5+
6+
This should pass the test_bugzilla_entry_format test.
7+
8+
[YOCTO #1234]
9+
CVE: CVE-1234-56789
10+
11+
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
12+
---
13+
.../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++
14+
.../selftest-hello/selftest-hello_1.0.bb | 4 ++-
15+
2 files changed, 29 insertions(+), 1 deletion(-)
16+
create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
17+
18+
diff --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
19+
new file mode 100644
20+
index 00000000000..8a4f9329303
21+
--- /dev/null
22+
+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
23+
@@ -0,0 +1,26 @@
24+
+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
25+
+From: Trevor Gamblin <tgamblin@baylibre.com>
26+
+Date: Tue, 29 Aug 2023 14:08:20 -0400
27+
+Subject: [PATCH] Fix CVE-NOT-REAL
28+
+
29+
+CVE: CVE-1234-56789
30+
+Upstream-Status: Backport(http://example.com/example)
31+
+
32+
+Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
33+
+---
34+
+ strlen.c | 1 +
35+
+ 1 file changed, 1 insertion(+)
36+
+
37+
+diff --git a/strlen.c b/strlen.c
38+
+index 1788f38..83d7918 100644
39+
+--- a/strlen.c
40+
++++ b/strlen.c
41+
+
42+
+int main() {
43+
+
44+
+ printf("%d\n", str_len(string1));
45+
+ printf("%d\n", str_len(string2));
46+
+ printf("CVE FIXED!!!\n");
47+
+
48+
+ return 0;
49+
+}
50+
diff --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
51+
index 2dc352d479e..d937759f157 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://0001-Fix-CVE-1234-56789.patch \
61+
+ "
62+
63+
S = "${WORKDIR}/sources"
64+
UNPACKDIR = "${S}"
65+
--
66+
2.45.1
67+
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
From c9519f11502d5bb5c143ed43b4c981b6a211bdf9 Mon Sep 17 00:00:00 2001
2+
From: Trevor Gamblin <tgamblin@baylibre.com>
3+
Date: Fri, 31 May 2024 09:54:50 -0400
4+
Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5+
6+
This should fail the test_commit_message_user_tags test because of this
7+
string: @teststring
8+
9+
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
10+
---
11+
.../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++
12+
.../selftest-hello/selftest-hello_1.0.bb | 4 ++-
13+
2 files changed, 29 insertions(+), 1 deletion(-)
14+
create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
15+
16+
diff --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
17+
new file mode 100644
18+
index 00000000000..8a4f9329303
19+
--- /dev/null
20+
+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
21+
@@ -0,0 +1,26 @@
22+
+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
23+
+From: Trevor Gamblin <tgamblin@baylibre.com>
24+
+Date: Tue, 29 Aug 2023 14:08:20 -0400
25+
+Subject: [PATCH] Fix CVE-NOT-REAL
26+
+
27+
+CVE: CVE-1234-56789
28+
+Upstream-Status: Backport(http://example.com/example)
29+
+
30+
+Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
31+
+---
32+
+ strlen.c | 1 +
33+
+ 1 file changed, 1 insertion(+)
34+
+
35+
+diff --git a/strlen.c b/strlen.c
36+
+index 1788f38..83d7918 100644
37+
+--- a/strlen.c
38+
++++ b/strlen.c
39+
+
40+
+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+
diff --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
49+
index 2dc352d479e..d937759f157 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://0001-Fix-CVE-1234-56789.patch \
59+
+ "
60+
61+
S = "${WORKDIR}/sources"
62+
UNPACKDIR = "${S}"
63+
--
64+
2.45.1
65+

0 commit comments

Comments
 (0)