diff options
Diffstat (limited to 'meta/lib/patchtest')
48 files changed, 3176 insertions, 0 deletions
diff --git a/meta/lib/patchtest/README.md b/meta/lib/patchtest/README.md new file mode 100644 index 0000000000..27cc61c802 --- /dev/null +++ b/meta/lib/patchtest/README.md | |||
@@ -0,0 +1,20 @@ | |||
1 | # patchtest selftests for openembedded-core | ||
2 | |||
3 | This directory provides a test suite and selftest script for use with the | ||
4 | patchtest repository: <https://git.yoctoproject.org/patchtest/> | ||
5 | |||
6 | To setup for use: | ||
7 | |||
8 | 1. Clone <https://git.openembedded.org/openembedded-core> (this repo) and <https://git.openembedded.org/bitbake/> | ||
9 | 2. Clone <https://git.yoctoproject.org/patchtest> | ||
10 | 3. Install the necessary Python modules: in meta/lib/patchtest or the patchtest | ||
11 | repo, do `pip install -r requirements.txt` | ||
12 | 4. Add patchtest to PATH: `export PATH=/path/to/patchtest/repo:$PATH` | ||
13 | 5. Initialize the environment: `source oe-init-build-env` | ||
14 | 6. Add meta-selftest to bblayers.conf: `bitbake-layers add-layer | ||
15 | /path/to/meta-selftest/` (the selftests use this layer's recipes as test | ||
16 | targets) | ||
17 | 7. Finally, run the selftest script: `./meta/lib/patchtest/selftest/selftest` | ||
18 | |||
19 | For more information on using patchtest, see the patchtest repo at | ||
20 | <https://git.yoctoproject.org/patchtest/>. | ||
diff --git a/meta/lib/patchtest/mbox.py b/meta/lib/patchtest/mbox.py new file mode 100644 index 0000000000..1d95819b7a --- /dev/null +++ b/meta/lib/patchtest/mbox.py | |||
@@ -0,0 +1,108 @@ | |||
1 | #! /usr/bin/env python3 | ||
2 | |||
3 | # series.py | ||
4 | # | ||
5 | # Read a series' mbox file and get information about the patches | ||
6 | # contained | ||
7 | # | ||
8 | # Copyright (C) 2024 BayLibre SAS | ||
9 | # | ||
10 | # SPDX-License-Identifier: GPL-2.0-only | ||
11 | # | ||
12 | |||
13 | import email | ||
14 | import re | ||
15 | |||
16 | # From: https://stackoverflow.com/questions/59681461/read-a-big-mbox-file-with-python | ||
17 | class MboxReader: | ||
18 | def __init__(self, filepath): | ||
19 | self.handle = open(filepath, 'rb') | ||
20 | assert self.handle.readline().startswith(b'From ') | ||
21 | |||
22 | def __enter__(self): | ||
23 | return self | ||
24 | |||
25 | def __exit__(self, exc_type, exc_value, exc_traceback): | ||
26 | self.handle.close() | ||
27 | |||
28 | def __iter__(self): | ||
29 | return iter(self.__next__()) | ||
30 | |||
31 | def __next__(self): | ||
32 | lines = [] | ||
33 | while True: | ||
34 | line = self.handle.readline() | ||
35 | if line == b'' or line.startswith(b'From '): | ||
36 | yield email.message_from_bytes(b''.join(lines)) | ||
37 | if line == b'': | ||
38 | break | ||
39 | lines = [] | ||
40 | continue | ||
41 | lines.append(line) | ||
42 | |||
43 | class Patch: | ||
44 | def __init__(self, data): | ||
45 | self.author = data['From'] | ||
46 | self.to = data['To'] | ||
47 | self.cc = data['Cc'] | ||
48 | self.subject = data['Subject'] | ||
49 | self.split_body = re.split('---', data.get_payload(), maxsplit=1) | ||
50 | self.commit_message = self.split_body[0] | ||
51 | self.diff = self.split_body[1] | ||
52 | |||
53 | class PatchSeries: | ||
54 | def __init__(self, filepath): | ||
55 | with MboxReader(filepath) as mbox: | ||
56 | self.patches = [Patch(message) for message in mbox] | ||
57 | |||
58 | assert self.patches | ||
59 | self.patch_count = len(self.patches) | ||
60 | self.path = filepath | ||
61 | |||
62 | @property | ||
63 | def path(self): | ||
64 | return self.path | ||
65 | |||
66 | self.branch = self.get_branch() | ||
67 | |||
68 | def get_branch(self): | ||
69 | fullprefix = "" | ||
70 | pattern = re.compile(r"(\[.*\])", re.DOTALL) | ||
71 | |||
72 | # There should be at least one patch in the series and it should | ||
73 | # include the branch name in the subject, so parse that | ||
74 | match = pattern.search(self.patches[0].subject) | ||
75 | if match: | ||
76 | fullprefix = match.group(1) | ||
77 | |||
78 | branch, branches, valid_branches = None, [], [] | ||
79 | |||
80 | if fullprefix: | ||
81 | prefix = fullprefix.strip('[]') | ||
82 | branches = [ b.strip() for b in prefix.split(',')] | ||
83 | valid_branches = [b for b in branches if PatchSeries.valid_branch(b)] | ||
84 | |||
85 | if len(valid_branches): | ||
86 | branch = valid_branches[0] | ||
87 | |||
88 | # Get the branch name excluding any brackets. If nothing was | ||
89 | # found, then assume there was no branch tag in the subject line | ||
90 | # and that the patch targets master | ||
91 | if branch is not None: | ||
92 | return branch.split(']')[0] | ||
93 | else: | ||
94 | return "master" | ||
95 | |||
96 | @staticmethod | ||
97 | def valid_branch(branch): | ||
98 | """ Check if branch is valid name """ | ||
99 | lbranch = branch.lower() | ||
100 | |||
101 | invalid = lbranch.startswith('patch') or \ | ||
102 | lbranch.startswith('rfc') or \ | ||
103 | lbranch.startswith('resend') or \ | ||
104 | re.search(r'^v\d+', lbranch) or \ | ||
105 | re.search(r'^\d+/\d+', lbranch) | ||
106 | |||
107 | return not invalid | ||
108 | |||
diff --git a/meta/lib/patchtest/patchtest_parser.py b/meta/lib/patchtest/patchtest_parser.py new file mode 100644 index 0000000000..2a11cb76c2 --- /dev/null +++ b/meta/lib/patchtest/patchtest_parser.py | |||
@@ -0,0 +1,78 @@ | |||
1 | # ex:ts=4:sw=4:sts=4:et | ||
2 | # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- | ||
3 | # | ||
4 | # patchtestdata: module used to share command line arguments between | ||
5 | # patchtest & test suite and a data store between test cases | ||
6 | # | ||
7 | # Copyright (C) 2016 Intel Corporation | ||
8 | # | ||
9 | # SPDX-License-Identifier: GPL-2.0-only | ||
10 | # | ||
11 | # NOTE: Strictly speaking, unit test should be isolated from outside, | ||
12 | # but patchtest test suites uses command line input data and | ||
13 | # pretest and test test cases may use the datastore defined | ||
14 | # on this module | ||
15 | |||
16 | import os | ||
17 | import argparse | ||
18 | |||
19 | default_testdir = os.path.abspath(os.path.dirname(__file__) + "/tests") | ||
20 | default_repodir = os.path.abspath(os.path.dirname(__file__) + "/../../..") | ||
21 | |||
22 | class PatchtestParser(object): | ||
23 | """Abstract the patchtest argument parser""" | ||
24 | |||
25 | @classmethod | ||
26 | def set_namespace(cls): | ||
27 | parser = cls.get_parser() | ||
28 | parser.parse_args(namespace=cls) | ||
29 | |||
30 | @classmethod | ||
31 | def get_parser(cls): | ||
32 | parser = argparse.ArgumentParser() | ||
33 | |||
34 | target_patch_group = parser.add_mutually_exclusive_group(required=True) | ||
35 | |||
36 | target_patch_group.add_argument('--patch', metavar='PATCH', dest='patch_path', | ||
37 | help='The patch to be tested') | ||
38 | |||
39 | target_patch_group.add_argument('--directory', metavar='DIRECTORY', dest='patch_path', | ||
40 | help='The directory containing patches to be tested') | ||
41 | |||
42 | parser.add_argument('--repodir', metavar='REPO', | ||
43 | default=default_repodir, | ||
44 | help="Name of the repository where patch is merged") | ||
45 | |||
46 | parser.add_argument('--testdir', metavar='TESTDIR', | ||
47 | default=default_testdir, | ||
48 | help="Directory where test cases are located") | ||
49 | |||
50 | parser.add_argument('--top-level-directory', '-t', | ||
51 | dest='topdir', | ||
52 | default=None, | ||
53 | help="Top level directory of project (defaults to start directory)") | ||
54 | |||
55 | parser.add_argument('--pattern', '-p', | ||
56 | dest='pattern', | ||
57 | default='test*.py', | ||
58 | help="Pattern to match test files") | ||
59 | |||
60 | parser.add_argument('--base-branch', '-b', | ||
61 | dest='basebranch', | ||
62 | help="Branch name used by patchtest to branch from. By default, it uses the current one.") | ||
63 | |||
64 | parser.add_argument('--base-commit', '-c', | ||
65 | dest='basecommit', | ||
66 | help="Commit ID used by patchtest to branch from. By default, it uses HEAD.") | ||
67 | |||
68 | parser.add_argument('--debug', '-d', | ||
69 | action='store_true', | ||
70 | help='Enable debug output') | ||
71 | |||
72 | parser.add_argument('--log-results', | ||
73 | action='store_true', | ||
74 | help='Enable logging to a file matching the target patch name with ".testresult" appended') | ||
75 | |||
76 | |||
77 | return parser | ||
78 | |||
diff --git a/meta/lib/patchtest/patchtest_patterns.py b/meta/lib/patchtest/patchtest_patterns.py new file mode 100644 index 0000000000..50637cf499 --- /dev/null +++ b/meta/lib/patchtest/patchtest_patterns.py | |||
@@ -0,0 +1,98 @@ | |||
1 | # common pyparsing variables | ||
2 | # | ||
3 | # Copyright (C) 2016 Intel Corporation | ||
4 | # | ||
5 | # SPDX-License-Identifier: GPL-2.0-only | ||
6 | |||
7 | import pyparsing | ||
8 | import re | ||
9 | |||
10 | # general | ||
11 | colon = pyparsing.Literal(":") | ||
12 | line_start = pyparsing.LineStart() | ||
13 | line_end = pyparsing.LineEnd() | ||
14 | lessthan = pyparsing.Literal("<") | ||
15 | greaterthan = pyparsing.Literal(">") | ||
16 | inappropriate = pyparsing.CaselessLiteral("Inappropriate") | ||
17 | submitted = pyparsing.CaselessLiteral("Submitted") | ||
18 | |||
19 | # word related | ||
20 | nestexpr = pyparsing.nestedExpr(opener='[', closer=']') | ||
21 | inappropriateinfo = pyparsing.Literal("Inappropriate") + nestexpr | ||
22 | submittedinfo = pyparsing.Literal("Submitted") + nestexpr | ||
23 | word = pyparsing.Word(pyparsing.alphas) | ||
24 | worddot = pyparsing.Word(pyparsing.alphas+".") | ||
25 | |||
26 | # metadata | ||
27 | |||
28 | metadata_lic = 'LICENSE' | ||
29 | invalid_license = 'PATCHTESTINVALID' | ||
30 | metadata_chksum = 'LIC_FILES_CHKSUM' | ||
31 | license_var = 'LICENSE' | ||
32 | closed = 'CLOSED' | ||
33 | lictag_re = pyparsing.AtLineStart("License-Update:") | ||
34 | lic_chksum_added = pyparsing.AtLineStart("+" + metadata_chksum) | ||
35 | lic_chksum_removed = pyparsing.AtLineStart("-" + metadata_chksum) | ||
36 | add_mark = pyparsing.Regex('\\+ ') | ||
37 | patch_max_line_length = 200 | ||
38 | metadata_src_uri = "SRC_URI" | ||
39 | metadata_summary = "SUMMARY" | ||
40 | cve_check_ignore_var = "CVE_CHECK_IGNORE" | ||
41 | cve_status_var = "CVE_STATUS" | ||
42 | endcommit_messages_regex = re.compile( | ||
43 | r"\(From \w+-\w+ rev:|(?<!\S)Signed-off-by|(?<!\S)---\n" | ||
44 | ) | ||
45 | patchmetadata_regex = re.compile( | ||
46 | r"-{3} \S+|\+{3} \S+|@{2} -\d+,\d+ \+\d+,\d+ @{2} \S+" | ||
47 | ) | ||
48 | |||
49 | # mbox | ||
50 | auh_email = 'auh@yoctoproject.org' | ||
51 | |||
52 | invalid_submitters = [pyparsing.Regex("^Upgrade Helper.+"), | ||
53 | pyparsing.Regex(auh_email), | ||
54 | pyparsing.Regex("uh@not\.set"), | ||
55 | pyparsing.Regex("\S+@example\.com")] | ||
56 | |||
57 | mbox_bugzilla = pyparsing.Regex('\[\s?YOCTO.*\]') | ||
58 | mbox_bugzilla_validation = pyparsing.Regex('\[(\s?YOCTO\s?#\s?(\d+)\s?,?)+\]') | ||
59 | mbox_revert_shortlog_regex = pyparsing.Regex('Revert\s+".*"') | ||
60 | mbox_shortlog_maxlength = 90 | ||
61 | # based on https://stackoverflow.com/questions/30281026/regex-parsing-github-usernames-javascript | ||
62 | mbox_github_username = pyparsing.Regex('\B@([a-z0-9](?:-(?=[a-z0-9])|[a-z0-9]){0,38}(?<=[a-z0-9]))') | ||
63 | |||
64 | # patch | ||
65 | |||
66 | cve = pyparsing.Regex("CVE\-\d{4}\-\d+") | ||
67 | cve_payload_tag = pyparsing.Regex("\+CVE:(\s+CVE\-\d{4}\-\d+)+") | ||
68 | upstream_status_regex = pyparsing.AtLineStart("+" + "Upstream-Status") | ||
69 | |||
70 | # shortlog | ||
71 | |||
72 | shortlog_target = pyparsing.OneOrMore(pyparsing.Word(pyparsing.printables.replace(':',''))) | ||
73 | shortlog_summary = pyparsing.OneOrMore(pyparsing.Word(pyparsing.printables)) | ||
74 | shortlog = line_start + shortlog_target + colon + shortlog_summary + line_end | ||
75 | |||
76 | # signed-off-bys | ||
77 | |||
78 | email_pattern = pyparsing.Regex(r"(?P<user>[A-Za-z0-9._%+-]+)@(?P<hostname>[A-Za-z0-9.-]+)\.(?P<domain>[A-Za-z]{2,})") | ||
79 | |||
80 | signed_off_by_prefix = pyparsing.Literal("Signed-off-by:") | ||
81 | signed_off_by_name = pyparsing.Regex('\S+.*(?= <)') | ||
82 | signed_off_by_email = lessthan + email_pattern + greaterthan | ||
83 | signed_off_by = pyparsing.AtLineStart(signed_off_by_prefix + signed_off_by_name + signed_off_by_email) | ||
84 | patch_signed_off_by = pyparsing.AtLineStart("+" + signed_off_by_prefix + signed_off_by_name + signed_off_by_email) | ||
85 | |||
86 | # upstream-status | ||
87 | |||
88 | upstream_status_literal_valid_status = ["Pending", "Backport", "Denied", "Inappropriate", "Submitted", "Inactive-Upstream"] | ||
89 | upstream_status_nonliteral_valid_status = ["Pending", "Backport", "Denied", "Inappropriate [reason]", "Submitted [where]", "Inactive-Upstream [lastcommit: when (and/or) lastrelease: when]"] | ||
90 | |||
91 | upstream_status_valid_status = pyparsing.Or( | ||
92 | [pyparsing.Literal(status) for status in upstream_status_literal_valid_status] | ||
93 | ) | ||
94 | |||
95 | upstream_status_prefix = pyparsing.Literal("Upstream-Status") | ||
96 | upstream_status = line_start + upstream_status_prefix + colon + upstream_status_valid_status | ||
97 | upstream_status_inappropriate_info = line_start + upstream_status_prefix + colon + inappropriateinfo | ||
98 | upstream_status_submitted_info = line_start + upstream_status_prefix + colon + submittedinfo | ||
diff --git a/meta/lib/patchtest/repo.py b/meta/lib/patchtest/repo.py new file mode 100644 index 0000000000..8ec8f68a0b --- /dev/null +++ b/meta/lib/patchtest/repo.py | |||
@@ -0,0 +1,85 @@ | |||
1 | # ex:ts=4:sw=4:sts=4:et | ||
2 | # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- | ||
3 | # | ||
4 | # patchtestrepo: PatchTestRepo class used mainly to control a git repo from patchtest | ||
5 | # | ||
6 | # Copyright (C) 2016 Intel Corporation | ||
7 | # | ||
8 | # SPDX-License-Identifier: GPL-2.0-only | ||
9 | # | ||
10 | |||
11 | import git | ||
12 | import os | ||
13 | import mbox | ||
14 | |||
15 | class PatchTestRepo(object): | ||
16 | |||
17 | # prefixes used for temporal branches/stashes | ||
18 | prefix = 'patchtest' | ||
19 | |||
20 | def __init__(self, patch, repodir, commit=None, branch=None): | ||
21 | self.repodir = repodir | ||
22 | self.repo = git.Repo.init(repodir) | ||
23 | self.patch = mbox.PatchSeries(patch) | ||
24 | self.current_branch = self.repo.active_branch.name | ||
25 | |||
26 | # targeted branch defined on the patch may be invalid, so make sure there | ||
27 | # is a corresponding remote branch | ||
28 | valid_patch_branch = None | ||
29 | if self.patch.branch in self.repo.branches: | ||
30 | valid_patch_branch = self.patch.branch | ||
31 | |||
32 | # Target Commit | ||
33 | # Priority (top has highest priority): | ||
34 | # 1. commit given at cmd line | ||
35 | # 2. branch given at cmd line | ||
36 | # 3. branch given at the patch | ||
37 | # 3. current HEAD | ||
38 | self._commit = self._get_commitid(commit) or \ | ||
39 | self._get_commitid(branch) or \ | ||
40 | self._get_commitid(valid_patch_branch) or \ | ||
41 | self._get_commitid('HEAD') | ||
42 | |||
43 | self._workingbranch = "%s_%s" % (PatchTestRepo.prefix, os.getpid()) | ||
44 | |||
45 | # create working branch. Use the '-B' flag so that we just | ||
46 | # check out the existing one if it's there | ||
47 | self.repo.git.execute(['git', 'checkout', '-B', self._workingbranch, self._commit]) | ||
48 | |||
49 | self._patchmerged = False | ||
50 | |||
51 | # Check if patch can be merged using git-am | ||
52 | self._patchcanbemerged = True | ||
53 | try: | ||
54 | # Make sure to get the absolute path of the file | ||
55 | self.repo.git.execute(['git', 'apply', '--check', os.path.abspath(self.patch.path)], with_exceptions=True) | ||
56 | except git.exc.GitCommandError as ce: | ||
57 | self._patchcanbemerged = False | ||
58 | |||
59 | def ismerged(self): | ||
60 | return self._patchmerged | ||
61 | |||
62 | def canbemerged(self): | ||
63 | return self._patchcanbemerged | ||
64 | |||
65 | def _get_commitid(self, commit): | ||
66 | |||
67 | if not commit: | ||
68 | return None | ||
69 | |||
70 | try: | ||
71 | return self.repo.rev_parse(commit).hexsha | ||
72 | except Exception as e: | ||
73 | print(f"Couldn't find commit {commit} in repo") | ||
74 | |||
75 | return None | ||
76 | |||
77 | def merge(self): | ||
78 | if self._patchcanbemerged: | ||
79 | self.repo.git.execute(['git', 'am', '--keep-cr', os.path.abspath(self.patch.path)]) | ||
80 | self._patchmerged = True | ||
81 | |||
82 | def clean(self): | ||
83 | self.repo.git.execute(['git', 'checkout', self.current_branch]) | ||
84 | self.repo.git.execute(['git', 'branch', '-D', self._workingbranch]) | ||
85 | self._patchmerged = False | ||
diff --git a/meta/lib/patchtest/requirements.txt b/meta/lib/patchtest/requirements.txt new file mode 100644 index 0000000000..4247b91f09 --- /dev/null +++ b/meta/lib/patchtest/requirements.txt | |||
@@ -0,0 +1,7 @@ | |||
1 | boto3 | ||
2 | git-pw>=2.5.0 | ||
3 | GitPython | ||
4 | jinja2 | ||
5 | pylint | ||
6 | pyparsing>=3.0.9 | ||
7 | unidiff | ||
diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_author_valid.1.fail b/meta/lib/patchtest/selftest/files/TestMbox.test_author_valid.1.fail new file mode 100644 index 0000000000..30c1bc4624 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_author_valid.1.fail | |||
@@ -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 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_author_valid.1.pass b/meta/lib/patchtest/selftest/files/TestMbox.test_author_valid.1.pass new file mode 100644 index 0000000000..6e82b08bc6 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_author_valid.1.pass | |||
@@ -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 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_author_valid.2.fail b/meta/lib/patchtest/selftest/files/TestMbox.test_author_valid.2.fail new file mode 100644 index 0000000000..745a8f45d9 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_author_valid.2.fail | |||
@@ -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 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_author_valid.2.pass b/meta/lib/patchtest/selftest/files/TestMbox.test_author_valid.2.pass new file mode 100644 index 0000000000..56cb77fa69 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_author_valid.2.pass | |||
@@ -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 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_bugzilla_entry_format.fail b/meta/lib/patchtest/selftest/files/TestMbox.test_bugzilla_entry_format.fail new file mode 100644 index 0000000000..6facb8c756 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_bugzilla_entry_format.fail | |||
@@ -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 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_bugzilla_entry_format.pass b/meta/lib/patchtest/selftest/files/TestMbox.test_bugzilla_entry_format.pass new file mode 100644 index 0000000000..2f35458b4f --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_bugzilla_entry_format.pass | |||
@@ -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 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_presence.fail b/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_presence.fail new file mode 100644 index 0000000000..6f4e61c0da --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_presence.fail | |||
@@ -0,0 +1,62 @@ | |||
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 | Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
7 | --- | ||
8 | .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++ | ||
9 | .../selftest-hello/selftest-hello_1.0.bb | 4 ++- | ||
10 | 2 files changed, 29 insertions(+), 1 deletion(-) | ||
11 | create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
12 | |||
13 | 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 | ||
14 | new file mode 100644 | ||
15 | index 00000000000..8a4f9329303 | ||
16 | --- /dev/null | ||
17 | +++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
18 | @@ -0,0 +1,26 @@ | ||
19 | +From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001 | ||
20 | +From: Trevor Gamblin <tgamblin@baylibre.com> | ||
21 | +Date: Tue, 29 Aug 2023 14:08:20 -0400 | ||
22 | +Subject: [PATCH] Fix CVE-NOT-REAL | ||
23 | + | ||
24 | +CVE: CVE-1234-56789 | ||
25 | +Upstream-Status: Backport(http://example.com/example) | ||
26 | + | ||
27 | +Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
28 | +--- | ||
29 | + strlen.c | 1 + | ||
30 | + 1 file changed, 1 insertion(+) | ||
31 | + | ||
32 | +diff --git a/strlen.c b/strlen.c | ||
33 | +index 1788f38..83d7918 100644 | ||
34 | +--- a/strlen.c | ||
35 | ++++ b/strlen.c | ||
36 | + | ||
37 | +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 | 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 | ||
46 | index 2dc352d479e..d937759f157 100644 | ||
47 | --- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb | ||
48 | +++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb | ||
49 | @@ -3,7 +3,9 @@ SECTION = "examples" | ||
50 | LICENSE = "MIT" | ||
51 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" | ||
52 | |||
53 | -SRC_URI = "file://helloworld.c" | ||
54 | +SRC_URI = "file://helloworld.c \ | ||
55 | + file://0001-Fix-CVE-1234-56789.patch \ | ||
56 | + " | ||
57 | |||
58 | S = "${WORKDIR}/sources" | ||
59 | UNPACKDIR = "${S}" | ||
60 | -- | ||
61 | 2.45.1 | ||
62 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_presence.pass b/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_presence.pass new file mode 100644 index 0000000000..3fbc23fd00 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_presence.pass | |||
@@ -0,0 +1,66 @@ | |||
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_commit_message_presence test. | ||
7 | |||
8 | CVE: CVE-1234-56789 | ||
9 | |||
10 | Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
11 | --- | ||
12 | .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++ | ||
13 | .../selftest-hello/selftest-hello_1.0.bb | 4 ++- | ||
14 | 2 files changed, 29 insertions(+), 1 deletion(-) | ||
15 | create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
16 | |||
17 | 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 | ||
18 | new file mode 100644 | ||
19 | index 00000000000..8a4f9329303 | ||
20 | --- /dev/null | ||
21 | +++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
22 | @@ -0,0 +1,26 @@ | ||
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 | + | ||
41 | +int main() { | ||
42 | + | ||
43 | + printf("%d\n", str_len(string1)); | ||
44 | + printf("%d\n", str_len(string2)); | ||
45 | + printf("CVE FIXED!!!\n"); | ||
46 | + | ||
47 | + return 0; | ||
48 | +} | ||
49 | 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 | ||
50 | index 2dc352d479e..d937759f157 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://0001-Fix-CVE-1234-56789.patch \ | ||
60 | + " | ||
61 | |||
62 | S = "${WORKDIR}/sources" | ||
63 | UNPACKDIR = "${S}" | ||
64 | -- | ||
65 | 2.45.1 | ||
66 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_user_tags.fail b/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_user_tags.fail new file mode 100644 index 0000000000..9d54af9644 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_user_tags.fail | |||
@@ -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 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_user_tags.pass b/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_user_tags.pass new file mode 100644 index 0000000000..57f2fc8a8e --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_user_tags.pass | |||
@@ -0,0 +1,66 @@ | |||
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_commit_message_user_tags test. | ||
7 | |||
8 | CVE: CVE-1234-56789 | ||
9 | |||
10 | Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
11 | --- | ||
12 | .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++ | ||
13 | .../selftest-hello/selftest-hello_1.0.bb | 4 ++- | ||
14 | 2 files changed, 29 insertions(+), 1 deletion(-) | ||
15 | create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
16 | |||
17 | 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 | ||
18 | new file mode 100644 | ||
19 | index 00000000000..8a4f9329303 | ||
20 | --- /dev/null | ||
21 | +++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
22 | @@ -0,0 +1,26 @@ | ||
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 | + | ||
41 | +int main() { | ||
42 | + | ||
43 | + printf("%d\n", str_len(string1)); | ||
44 | + printf("%d\n", str_len(string2)); | ||
45 | + printf("CVE FIXED!!!\n"); | ||
46 | + | ||
47 | + return 0; | ||
48 | +} | ||
49 | 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 | ||
50 | index 2dc352d479e..d937759f157 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://0001-Fix-CVE-1234-56789.patch \ | ||
60 | + " | ||
61 | |||
62 | S = "${WORKDIR}/sources" | ||
63 | UNPACKDIR = "${S}" | ||
64 | -- | ||
65 | 2.45.1 | ||
66 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_mbox_format.fail b/meta/lib/patchtest/selftest/files/TestMbox.test_mbox_format.fail new file mode 100644 index 0000000000..0dda6802d1 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_mbox_format.fail | |||
@@ -0,0 +1,66 @@ | |||
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_mbox_format test. | ||
7 | |||
8 | CVE: CVE-1234-56789 | ||
9 | |||
10 | Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
11 | --- | ||
12 | .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++ | ||
13 | .../selftest-hello/selftest-hello_1.0.bb | 4 ++- | ||
14 | 2 files changed, 29 insertions(+), 1 deletion(-) | ||
15 | create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
16 | |||
17 | 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 | ||
18 | new file mode 100644 | ||
19 | index 00000000000..8a4f9329303 | ||
20 | --- /dev/null | ||
21 | +++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
22 | @@ -0,0 +1,26 @@ | ||
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 | + | ||
41 | +int main() { | ||
42 | + | ||
43 | + printf("%d\n", str_len(string1)); | ||
44 | + printf("%d\n", str_len(string2)); | ||
45 | + printf("CVE FIXED!!!\n"); | ||
46 | + | ||
47 | + return 0; | ||
48 | +} | ||
49 | 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 | ||
50 | index 2dc352d479e..d937759f157 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://0001-Fix-CVE-1234-56789.patch \ | ||
60 | + " | ||
61 | |||
62 | S = "${WORKDIR}/sources" | ||
63 | UNPACKDIR = "${S}" | ||
64 | -- | ||
65 | 2.45.1 | ||
66 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_mbox_format.pass b/meta/lib/patchtest/selftest/files/TestMbox.test_mbox_format.pass new file mode 100644 index 0000000000..f06ae11d04 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_mbox_format.pass | |||
@@ -0,0 +1,66 @@ | |||
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_mbox_format test. | ||
7 | |||
8 | CVE: CVE-1234-56789 | ||
9 | |||
10 | Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
11 | --- | ||
12 | .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++ | ||
13 | .../selftest-hello/selftest-hello_1.0.bb | 4 ++- | ||
14 | 2 files changed, 29 insertions(+), 1 deletion(-) | ||
15 | create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
16 | |||
17 | 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 | ||
18 | new file mode 100644 | ||
19 | index 00000000000..8a4f9329303 | ||
20 | --- /dev/null | ||
21 | +++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
22 | @@ -0,0 +1,26 @@ | ||
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 | + | ||
41 | +int main() { | ||
42 | + | ||
43 | + printf("%d\n", str_len(string1)); | ||
44 | + printf("%d\n", str_len(string2)); | ||
45 | + printf("CVE FIXED!!!\n"); | ||
46 | + | ||
47 | + return 0; | ||
48 | +} | ||
49 | 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 | ||
50 | index 2dc352d479e..d937759f157 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://0001-Fix-CVE-1234-56789.patch \ | ||
60 | + " | ||
61 | |||
62 | S = "${WORKDIR}/sources" | ||
63 | UNPACKDIR = "${S}" | ||
64 | -- | ||
65 | 2.45.1 | ||
66 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_series_merge_on_head.1.skip b/meta/lib/patchtest/selftest/files/TestMbox.test_series_merge_on_head.1.skip new file mode 100644 index 0000000000..072ccc28c0 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_series_merge_on_head.1.skip | |||
@@ -0,0 +1,35 @@ | |||
1 | From d12db4cfa913b0e7a4b5bd858d3019acc53ce426 Mon Sep 17 00:00:00 2001 | ||
2 | From: Trevor Gamblin <tgamblin@baylibre.com> | ||
3 | Date: Wed, 30 Aug 2023 12:15:00 -0400 | ||
4 | Subject: [PATCH] selftest-hello: upgrade 1.0 -> 1.1 | ||
5 | |||
6 | This file should skip the test_series_merge_on_head test. | ||
7 | |||
8 | Signed-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 | |||
14 | diff --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 | ||
15 | similarity index 88% | ||
16 | rename from meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb | ||
17 | rename to meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb | ||
18 | index 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 | -- | ||
34 | 2.41.0 | ||
35 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_series_merge_on_head.2.skip b/meta/lib/patchtest/selftest/files/TestMbox.test_series_merge_on_head.2.skip new file mode 100644 index 0000000000..49bd1f8ede --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_series_merge_on_head.2.skip | |||
@@ -0,0 +1,41 @@ | |||
1 | From 55208224f492af0ad929555ffc9b95ff1d301c5f Mon Sep 17 00:00:00 2001 | ||
2 | From: Trevor Gamblin <tgamblin@baylibre.com> | ||
3 | Date: Thu, 17 Aug 2023 15:02:38 -0400 | ||
4 | Subject: [PATCH] python3-dtc: upgrade 1.6.1 -> 1.7.0 | ||
5 | |||
6 | Changelog: https://kernel.googlesource.com/pub/scm/utils/dtc/dtc/+log/039a99414e778332d8f9c04cbd3072e1dcc62798 | ||
7 | |||
8 | Remove custom PV from the recipe since the relevant functionality is in | ||
9 | 1.7.0: | ||
10 | |||
11 | [tgamblin@megalith dtc]$ git tag --contains c001fc01a43e7a06447c06ea3d50bd60641322b8 | ||
12 | v1.7.0 | ||
13 | |||
14 | Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
15 | Signed-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 | |||
21 | diff --git a/meta/recipes-devtools/python/python3-dtc_1.6.1.bb b/meta/recipes-devtools/python/python3-dtc_1.7.0.bb | ||
22 | similarity index 92% | ||
23 | rename from meta/recipes-devtools/python/python3-dtc_1.6.1.bb | ||
24 | rename to meta/recipes-devtools/python/python3-dtc_1.7.0.bb | ||
25 | index 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 | -- | ||
40 | 2.41.0 | ||
41 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_format.fail b/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_format.fail new file mode 100644 index 0000000000..c5e4df2549 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_format.fail | |||
@@ -0,0 +1,66 @@ | |||
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_shortlog_format test. | ||
7 | |||
8 | CVE: CVE-1234-56789 | ||
9 | |||
10 | Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
11 | --- | ||
12 | .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++ | ||
13 | .../selftest-hello/selftest-hello_1.0.bb | 4 ++- | ||
14 | 2 files changed, 29 insertions(+), 1 deletion(-) | ||
15 | create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
16 | |||
17 | 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 | ||
18 | new file mode 100644 | ||
19 | index 00000000000..8a4f9329303 | ||
20 | --- /dev/null | ||
21 | +++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
22 | @@ -0,0 +1,26 @@ | ||
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 | + | ||
41 | +int main() { | ||
42 | + | ||
43 | + printf("%d\n", str_len(string1)); | ||
44 | + printf("%d\n", str_len(string2)); | ||
45 | + printf("CVE FIXED!!!\n"); | ||
46 | + | ||
47 | + return 0; | ||
48 | +} | ||
49 | 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 | ||
50 | index 2dc352d479e..d937759f157 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://0001-Fix-CVE-1234-56789.patch \ | ||
60 | + " | ||
61 | |||
62 | S = "${WORKDIR}/sources" | ||
63 | UNPACKDIR = "${S}" | ||
64 | -- | ||
65 | 2.45.1 | ||
66 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_format.pass b/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_format.pass new file mode 100644 index 0000000000..4948e26afc --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_format.pass | |||
@@ -0,0 +1,66 @@ | |||
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_shortlog_format test. | ||
7 | |||
8 | CVE: CVE-1234-56789 | ||
9 | |||
10 | Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
11 | --- | ||
12 | .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++ | ||
13 | .../selftest-hello/selftest-hello_1.0.bb | 4 ++- | ||
14 | 2 files changed, 29 insertions(+), 1 deletion(-) | ||
15 | create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
16 | |||
17 | 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 | ||
18 | new file mode 100644 | ||
19 | index 00000000000..8a4f9329303 | ||
20 | --- /dev/null | ||
21 | +++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
22 | @@ -0,0 +1,26 @@ | ||
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 | + | ||
41 | +int main() { | ||
42 | + | ||
43 | + printf("%d\n", str_len(string1)); | ||
44 | + printf("%d\n", str_len(string2)); | ||
45 | + printf("CVE FIXED!!!\n"); | ||
46 | + | ||
47 | + return 0; | ||
48 | +} | ||
49 | 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 | ||
50 | index 2dc352d479e..d937759f157 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://0001-Fix-CVE-1234-56789.patch \ | ||
60 | + " | ||
61 | |||
62 | S = "${WORKDIR}/sources" | ||
63 | UNPACKDIR = "${S}" | ||
64 | -- | ||
65 | 2.45.1 | ||
66 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_length.fail b/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_length.fail new file mode 100644 index 0000000000..4ed1242821 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_length.fail | |||
@@ -0,0 +1,66 @@ | |||
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 this is a very long commit shortlog with way too many words included in it to pass the test | ||
5 | |||
6 | This should fail the test_shortlong_length test. | ||
7 | |||
8 | CVE: CVE-1234-56789 | ||
9 | |||
10 | Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
11 | --- | ||
12 | .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++ | ||
13 | .../selftest-hello/selftest-hello_1.0.bb | 4 ++- | ||
14 | 2 files changed, 29 insertions(+), 1 deletion(-) | ||
15 | create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
16 | |||
17 | 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 | ||
18 | new file mode 100644 | ||
19 | index 00000000000..8a4f9329303 | ||
20 | --- /dev/null | ||
21 | +++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
22 | @@ -0,0 +1,26 @@ | ||
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 | + | ||
41 | +int main() { | ||
42 | + | ||
43 | + printf("%d\n", str_len(string1)); | ||
44 | + printf("%d\n", str_len(string2)); | ||
45 | + printf("CVE FIXED!!!\n"); | ||
46 | + | ||
47 | + return 0; | ||
48 | +} | ||
49 | 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 | ||
50 | index 2dc352d479e..d937759f157 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://0001-Fix-CVE-1234-56789.patch \ | ||
60 | + " | ||
61 | |||
62 | S = "${WORKDIR}/sources" | ||
63 | UNPACKDIR = "${S}" | ||
64 | -- | ||
65 | 2.45.1 | ||
66 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_length.pass b/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_length.pass new file mode 100644 index 0000000000..ef5066a650 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_length.pass | |||
@@ -0,0 +1,66 @@ | |||
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_shortlog_length test. | ||
7 | |||
8 | CVE: CVE-1234-56789 | ||
9 | |||
10 | Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
11 | --- | ||
12 | .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++ | ||
13 | .../selftest-hello/selftest-hello_1.0.bb | 4 ++- | ||
14 | 2 files changed, 29 insertions(+), 1 deletion(-) | ||
15 | create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
16 | |||
17 | 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 | ||
18 | new file mode 100644 | ||
19 | index 00000000000..8a4f9329303 | ||
20 | --- /dev/null | ||
21 | +++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
22 | @@ -0,0 +1,26 @@ | ||
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 | + | ||
41 | +int main() { | ||
42 | + | ||
43 | + printf("%d\n", str_len(string1)); | ||
44 | + printf("%d\n", str_len(string2)); | ||
45 | + printf("CVE FIXED!!!\n"); | ||
46 | + | ||
47 | + return 0; | ||
48 | +} | ||
49 | 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 | ||
50 | index 2dc352d479e..d937759f157 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://0001-Fix-CVE-1234-56789.patch \ | ||
60 | + " | ||
61 | |||
62 | S = "${WORKDIR}/sources" | ||
63 | UNPACKDIR = "${S}" | ||
64 | -- | ||
65 | 2.45.1 | ||
66 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_signed_off_by_presence.1.fail b/meta/lib/patchtest/selftest/files/TestMbox.test_signed_off_by_presence.1.fail new file mode 100644 index 0000000000..4ede7271ee --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_signed_off_by_presence.1.fail | |||
@@ -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_signed_off_by_presence test. | ||
7 | |||
8 | CVE: CVE-1234-56789 | ||
9 | |||
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 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_signed_off_by_presence.2.fail b/meta/lib/patchtest/selftest/files/TestMbox.test_signed_off_by_presence.2.fail new file mode 100644 index 0000000000..f7c3f5145a --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_signed_off_by_presence.2.fail | |||
@@ -0,0 +1,66 @@ | |||
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_signed_off_by_presence test. | ||
7 | |||
8 | CVE: CVE-1234-56789 | ||
9 | |||
10 | Approved-of-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
11 | --- | ||
12 | .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++ | ||
13 | .../selftest-hello/selftest-hello_1.0.bb | 4 ++- | ||
14 | 2 files changed, 29 insertions(+), 1 deletion(-) | ||
15 | create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
16 | |||
17 | 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 | ||
18 | new file mode 100644 | ||
19 | index 00000000000..8a4f9329303 | ||
20 | --- /dev/null | ||
21 | +++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
22 | @@ -0,0 +1,26 @@ | ||
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 | + | ||
41 | +int main() { | ||
42 | + | ||
43 | + printf("%d\n", str_len(string1)); | ||
44 | + printf("%d\n", str_len(string2)); | ||
45 | + printf("CVE FIXED!!!\n"); | ||
46 | + | ||
47 | + return 0; | ||
48 | +} | ||
49 | 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 | ||
50 | index 2dc352d479e..d937759f157 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://0001-Fix-CVE-1234-56789.patch \ | ||
60 | + " | ||
61 | |||
62 | S = "${WORKDIR}/sources" | ||
63 | UNPACKDIR = "${S}" | ||
64 | -- | ||
65 | 2.45.1 | ||
66 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_signed_off_by_presence.pass b/meta/lib/patchtest/selftest/files/TestMbox.test_signed_off_by_presence.pass new file mode 100644 index 0000000000..2661c1416f --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_signed_off_by_presence.pass | |||
@@ -0,0 +1,66 @@ | |||
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_signed_off_by_presence test. | ||
7 | |||
8 | CVE: CVE-1234-56789 | ||
9 | |||
10 | Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
11 | --- | ||
12 | .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++ | ||
13 | .../selftest-hello/selftest-hello_1.0.bb | 4 ++- | ||
14 | 2 files changed, 29 insertions(+), 1 deletion(-) | ||
15 | create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
16 | |||
17 | 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 | ||
18 | new file mode 100644 | ||
19 | index 00000000000..8a4f9329303 | ||
20 | --- /dev/null | ||
21 | +++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
22 | @@ -0,0 +1,26 @@ | ||
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 | + | ||
41 | +int main() { | ||
42 | + | ||
43 | + printf("%d\n", str_len(string1)); | ||
44 | + printf("%d\n", str_len(string2)); | ||
45 | + printf("CVE FIXED!!!\n"); | ||
46 | + | ||
47 | + return 0; | ||
48 | +} | ||
49 | 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 | ||
50 | index 2dc352d479e..d937759f157 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://0001-Fix-CVE-1234-56789.patch \ | ||
60 | + " | ||
61 | |||
62 | S = "${WORKDIR}/sources" | ||
63 | UNPACKDIR = "${S}" | ||
64 | -- | ||
65 | 2.45.1 | ||
66 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMetadata.test_cve_check_ignore.fail b/meta/lib/patchtest/selftest/files/TestMetadata.test_cve_check_ignore.fail new file mode 100644 index 0000000000..dccafcd9bc --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMetadata.test_cve_check_ignore.fail | |||
@@ -0,0 +1,25 @@ | |||
1 | From 60450eefbc2c438a37c5e08759d021b18f0df0a3 Mon Sep 17 00:00:00 2001 | ||
2 | From: Trevor Gamblin <tgamblin@baylibre.com> | ||
3 | Date: Fri, 31 May 2024 09:18:17 -0400 | ||
4 | Subject: [PATCH] selftest-hello: add CVE_CHECK_IGNORE | ||
5 | |||
6 | This should fail the test_cve_tag_format selftest. | ||
7 | |||
8 | Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
9 | --- | ||
10 | meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb | 1 + | ||
11 | 1 file changed, 1 insertion(+) | ||
12 | |||
13 | 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 | ||
14 | index 2dc352d479e..cc103de6e2e 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 | @@ -17,4 +17,5 @@ do_install() { | ||
18 | install -m 0755 helloworld ${D}${bindir} | ||
19 | } | ||
20 | |||
21 | +CVE_CHECK_IGNORE = "CVE-2024-12345" | ||
22 | BBCLASSEXTEND = "native nativesdk" | ||
23 | -- | ||
24 | 2.45.1 | ||
25 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMetadata.test_cve_check_ignore.pass b/meta/lib/patchtest/selftest/files/TestMetadata.test_cve_check_ignore.pass new file mode 100644 index 0000000000..93a6cc91fb --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMetadata.test_cve_check_ignore.pass | |||
@@ -0,0 +1,25 @@ | |||
1 | From f91073242268d2b2c1a1a705e7fd585679f78a59 Mon Sep 17 00:00:00 2001 | ||
2 | From: Trevor Gamblin <tgamblin@baylibre.com> | ||
3 | Date: Fri, 31 May 2024 09:18:17 -0400 | ||
4 | Subject: [PATCH] selftest-hello: add CVE_STATUS | ||
5 | |||
6 | This should pass the test_cve_tag_format selftest. | ||
7 | |||
8 | Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
9 | --- | ||
10 | meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb | 1 + | ||
11 | 1 file changed, 1 insertion(+) | ||
12 | |||
13 | 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 | ||
14 | index 2dc352d479e..88c5c98608f 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 | @@ -17,4 +17,5 @@ do_install() { | ||
18 | install -m 0755 helloworld ${D}${bindir} | ||
19 | } | ||
20 | |||
21 | +CVE_STATUS[CVE-2024-12345] = "not-applicable-platform: Issue only applies on Windows" | ||
22 | BBCLASSEXTEND = "native nativesdk" | ||
23 | -- | ||
24 | 2.45.1 | ||
25 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMetadata.test_lic_files_chksum_modified_not_mentioned.fail b/meta/lib/patchtest/selftest/files/TestMetadata.test_lic_files_chksum_modified_not_mentioned.fail new file mode 100644 index 0000000000..61b3784e3c --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMetadata.test_lic_files_chksum_modified_not_mentioned.fail | |||
@@ -0,0 +1,28 @@ | |||
1 | From 974c3a143bc67faaff9abcc0a06a3d5e692fc660 Mon Sep 17 00:00:00 2001 | ||
2 | From: Trevor Gamblin <tgamblin@baylibre.com> | ||
3 | Date: Fri, 31 May 2024 11:51:15 -0400 | ||
4 | Subject: [PATCH] selftest-hello: update LIC_FILES_CHKSUM | ||
5 | |||
6 | This should fail the test_lic_files_chksum_modified_not_mentioned test. | ||
7 | |||
8 | Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
9 | --- | ||
10 | meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb | 2 +- | ||
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
12 | |||
13 | 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 | ||
14 | index 2dc352d479e..356921db1dd 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,7 +1,7 @@ | ||
18 | DESCRIPTION = "Simple helloworld application -- selftest variant" | ||
19 | SECTION = "examples" | ||
20 | LICENSE = "MIT" | ||
21 | -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" | ||
22 | +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f303" | ||
23 | |||
24 | SRC_URI = "file://helloworld.c" | ||
25 | |||
26 | -- | ||
27 | 2.45.1 | ||
28 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMetadata.test_lic_files_chksum_modified_not_mentioned.pass b/meta/lib/patchtest/selftest/files/TestMetadata.test_lic_files_chksum_modified_not_mentioned.pass new file mode 100644 index 0000000000..b7be1e8e55 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMetadata.test_lic_files_chksum_modified_not_mentioned.pass | |||
@@ -0,0 +1,30 @@ | |||
1 | From 974c3a143bc67faaff9abcc0a06a3d5e692fc660 Mon Sep 17 00:00:00 2001 | ||
2 | From: Trevor Gamblin <tgamblin@baylibre.com> | ||
3 | Date: Fri, 31 May 2024 11:51:15 -0400 | ||
4 | Subject: [PATCH] selftest-hello: update LIC_FILES_CHKSUM | ||
5 | |||
6 | This should pass the test_lic_files_chksum_modified_not_mentioned test. | ||
7 | |||
8 | License-Update: Stuff happened! | ||
9 | |||
10 | Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
11 | --- | ||
12 | meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb | 2 +- | ||
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
14 | |||
15 | 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 | ||
16 | index 2dc352d479e..356921db1dd 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 | -- | ||
29 | 2.45.1 | ||
30 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMetadata.test_lic_files_chksum_presence.fail b/meta/lib/patchtest/selftest/files/TestMetadata.test_lic_files_chksum_presence.fail new file mode 100644 index 0000000000..a7a0b0bacb --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMetadata.test_lic_files_chksum_presence.fail | |||
@@ -0,0 +1,42 @@ | |||
1 | From 74bc209a4fbe4da2f57e153ccfff3d2241dada8d Mon Sep 17 00:00:00 2001 | ||
2 | From: Trevor Gamblin <tgamblin@baylibre.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_lic_files_chksum_presence test. | ||
7 | |||
8 | Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
9 | --- | ||
10 | .../selftest-hello-extra_1.0.bb | 20 +++++++++++++++++++ | ||
11 | 1 file changed, 20 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..875bcbef859 | ||
17 | --- /dev/null | ||
18 | +++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb | ||
19 | @@ -0,0 +1,20 @@ | ||
20 | +SUMMARY = "This is an example summary" | ||
21 | +DESCRIPTION = "Simple helloworld application -- selftest variant" | ||
22 | +SECTION = "examples" | ||
23 | +LICENSE = "MIT" | ||
24 | + | ||
25 | +SRC_URI = "file://helloworld.c" | ||
26 | + | ||
27 | +S = "${WORKDIR}/sources" | ||
28 | +UNPACKDIR = "${S}" | ||
29 | + | ||
30 | +do_compile() { | ||
31 | + ${CC} ${CFLAGS} ${LDFLAGS} helloworld.c -o helloworld | ||
32 | +} | ||
33 | + | ||
34 | +do_install() { | ||
35 | + install -d ${D}${bindir} | ||
36 | + install -m 0755 helloworld ${D}${bindir} | ||
37 | +} | ||
38 | + | ||
39 | +BBCLASSEXTEND = "native nativesdk" | ||
40 | -- | ||
41 | 2.45.1 | ||
42 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMetadata.test_lic_files_chksum_presence.pass b/meta/lib/patchtest/selftest/files/TestMetadata.test_lic_files_chksum_presence.pass new file mode 100644 index 0000000000..8ffa97ec56 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMetadata.test_lic_files_chksum_presence.pass | |||
@@ -0,0 +1,43 @@ | |||
1 | From 04eb94a0134ef5eb5b5fd783b303104fbfcd8437 Mon Sep 17 00:00:00 2001 | ||
2 | From: Trevor Gamblin <tgamblin@baylibre.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_lic_files_chksum_presence 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 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMetadata.test_src_uri_left_files.fail b/meta/lib/patchtest/selftest/files/TestMetadata.test_src_uri_left_files.fail new file mode 100644 index 0000000000..0a402d0a3e --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMetadata.test_src_uri_left_files.fail | |||
@@ -0,0 +1,28 @@ | |||
1 | From f2f7b6bcb831289bc3ba2343ad7dc5bee6d6e0cd Mon Sep 17 00:00:00 2001 | ||
2 | From: Trevor Gamblin <tgamblin@baylibre.com> | ||
3 | Date: Fri, 31 May 2024 08:45:41 -0400 | ||
4 | Subject: [PATCH] selftest-hello: remove helloworld.c | ||
5 | |||
6 | This should fail the test_src_uri_left_files selftest. | ||
7 | |||
8 | Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
9 | --- | ||
10 | meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb | 2 -- | ||
11 | 1 file changed, 2 deletions(-) | ||
12 | |||
13 | 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 | ||
14 | index 2dc352d479e..e95270adaeb 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}/sources" | ||
24 | UNPACKDIR = "${S}" | ||
25 | |||
26 | -- | ||
27 | 2.45.1 | ||
28 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMetadata.test_src_uri_left_files.pass b/meta/lib/patchtest/selftest/files/TestMetadata.test_src_uri_left_files.pass new file mode 100644 index 0000000000..a675c028d0 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMetadata.test_src_uri_left_files.pass | |||
@@ -0,0 +1,44 @@ | |||
1 | From e79933e2fc68570066eca66f0b599d259b7a1731 Mon Sep 17 00:00:00 2001 | ||
2 | From: Trevor Gamblin <tgamblin@baylibre.com> | ||
3 | Date: Fri, 31 May 2024 08:18:48 -0400 | ||
4 | Subject: [PATCH] selftest-hello: remove helloworld.c | ||
5 | |||
6 | This should pass the test_src_uri_left_files selftest. | ||
7 | |||
8 | Signed-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 | 2 -- | ||
12 | 2 files changed, 10 deletions(-) | ||
13 | delete mode 100644 meta-selftest/recipes-test/selftest-hello/files/helloworld.c | ||
14 | |||
15 | diff --git a/meta-selftest/recipes-test/selftest-hello/files/helloworld.c b/meta-selftest/recipes-test/selftest-hello/files/helloworld.c | ||
16 | deleted file mode 100644 | ||
17 | index fc7169b7b83..00000000000 | ||
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 | -} | ||
29 | 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 | ||
30 | index 2dc352d479e..e95270adaeb 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}/sources" | ||
40 | UNPACKDIR = "${S}" | ||
41 | |||
42 | -- | ||
43 | 2.45.1 | ||
44 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMetadata.test_summary_presence.fail b/meta/lib/patchtest/selftest/files/TestMetadata.test_summary_presence.fail new file mode 100644 index 0000000000..1087843619 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMetadata.test_summary_presence.fail | |||
@@ -0,0 +1,42 @@ | |||
1 | From f4b72cc24f5e2a290a8637775c4d41c16d5d83aa Mon Sep 17 00:00:00 2001 | ||
2 | From: Trevor Gamblin <tgamblin@baylibre.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_summary_presence test. | ||
7 | |||
8 | Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
9 | --- | ||
10 | .../selftest-hello-extra_1.0.bb | 20 +++++++++++++++++++ | ||
11 | 1 file changed, 20 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..2dc352d479e | ||
17 | --- /dev/null | ||
18 | +++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb | ||
19 | @@ -0,0 +1,20 @@ | ||
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 | + | ||
25 | +SRC_URI = "file://helloworld.c" | ||
26 | + | ||
27 | +S = "${WORKDIR}/sources" | ||
28 | +UNPACKDIR = "${S}" | ||
29 | + | ||
30 | +do_compile() { | ||
31 | + ${CC} ${CFLAGS} ${LDFLAGS} helloworld.c -o helloworld | ||
32 | +} | ||
33 | + | ||
34 | +do_install() { | ||
35 | + install -d ${D}${bindir} | ||
36 | + install -m 0755 helloworld ${D}${bindir} | ||
37 | +} | ||
38 | + | ||
39 | +BBCLASSEXTEND = "native nativesdk" | ||
40 | -- | ||
41 | 2.45.1 | ||
42 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestMetadata.test_summary_presence.pass b/meta/lib/patchtest/selftest/files/TestMetadata.test_summary_presence.pass new file mode 100644 index 0000000000..3d35a8d8fb --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMetadata.test_summary_presence.pass | |||
@@ -0,0 +1,43 @@ | |||
1 | From 04eb94a0134ef5eb5b5fd783b303104fbfcd8437 Mon Sep 17 00:00:00 2001 | ||
2 | From: Trevor Gamblin <tgamblin@baylibre.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_summary_presence 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 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestPatch.test_cve_tag_format.fail b/meta/lib/patchtest/selftest/files/TestPatch.test_cve_tag_format.fail new file mode 100644 index 0000000000..f64f2a40b0 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestPatch.test_cve_tag_format.fail | |||
@@ -0,0 +1,66 @@ | |||
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_cve_tag_format test. | ||
7 | |||
8 | CVE: CVE-1234-56789 | ||
9 | |||
10 | Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
11 | --- | ||
12 | .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++ | ||
13 | .../selftest-hello/selftest-hello_1.0.bb | 4 ++- | ||
14 | 2 files changed, 29 insertions(+), 1 deletion(-) | ||
15 | create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
16 | |||
17 | 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 | ||
18 | new file mode 100644 | ||
19 | index 00000000000..8a4f9329303 | ||
20 | --- /dev/null | ||
21 | +++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
22 | @@ -0,0 +1,26 @@ | ||
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-BAD_FORMAT | ||
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 | + | ||
41 | +int main() { | ||
42 | + | ||
43 | + printf("%d\n", str_len(string1)); | ||
44 | + printf("%d\n", str_len(string2)); | ||
45 | + printf("CVE FIXED!!!\n"); | ||
46 | + | ||
47 | + return 0; | ||
48 | +} | ||
49 | 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 | ||
50 | index 2dc352d479e..d937759f157 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://0001-Fix-CVE-1234-56789.patch \ | ||
60 | + " | ||
61 | |||
62 | S = "${WORKDIR}/sources" | ||
63 | UNPACKDIR = "${S}" | ||
64 | -- | ||
65 | 2.45.1 | ||
66 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestPatch.test_cve_tag_format.pass b/meta/lib/patchtest/selftest/files/TestPatch.test_cve_tag_format.pass new file mode 100644 index 0000000000..3819487041 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestPatch.test_cve_tag_format.pass | |||
@@ -0,0 +1,66 @@ | |||
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_cve_tag format test. | ||
7 | |||
8 | CVE: CVE-1234-56789 | ||
9 | |||
10 | Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
11 | --- | ||
12 | .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++ | ||
13 | .../selftest-hello/selftest-hello_1.0.bb | 4 ++- | ||
14 | 2 files changed, 29 insertions(+), 1 deletion(-) | ||
15 | create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
16 | |||
17 | 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 | ||
18 | new file mode 100644 | ||
19 | index 00000000000..8a4f9329303 | ||
20 | --- /dev/null | ||
21 | +++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
22 | @@ -0,0 +1,26 @@ | ||
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 | + | ||
41 | +int main() { | ||
42 | + | ||
43 | + printf("%d\n", str_len(string1)); | ||
44 | + printf("%d\n", str_len(string2)); | ||
45 | + printf("CVE FIXED!!!\n"); | ||
46 | + | ||
47 | + return 0; | ||
48 | +} | ||
49 | 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 | ||
50 | index 2dc352d479e..d937759f157 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://0001-Fix-CVE-1234-56789.patch \ | ||
60 | + " | ||
61 | |||
62 | S = "${WORKDIR}/sources" | ||
63 | UNPACKDIR = "${S}" | ||
64 | -- | ||
65 | 2.45.1 | ||
66 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestPatch.test_signed_off_by_presence.fail b/meta/lib/patchtest/selftest/files/TestPatch.test_signed_off_by_presence.fail new file mode 100644 index 0000000000..b2d0fab9e3 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestPatch.test_signed_off_by_presence.fail | |||
@@ -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_signed_off_by_presence test. | ||
7 | |||
8 | CVE: CVE-1234-56789 | ||
9 | |||
10 | Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
11 | --- | ||
12 | .../files/0001-Fix-CVE-1234-56789.patch | 25 +++++++++++++++++++ | ||
13 | .../selftest-hello/selftest-hello_1.0.bb | 4 ++- | ||
14 | 2 files changed, 28 insertions(+), 1 deletion(-) | ||
15 | create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
16 | |||
17 | 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 | ||
18 | new file mode 100644 | ||
19 | index 00000000000..8a4f9329303 | ||
20 | --- /dev/null | ||
21 | +++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
22 | @@ -0,0 +1,25 @@ | ||
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 | +--- | ||
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 | |||
diff --git a/meta/lib/patchtest/selftest/files/TestPatch.test_signed_off_by_presence.pass b/meta/lib/patchtest/selftest/files/TestPatch.test_signed_off_by_presence.pass new file mode 100644 index 0000000000..2661c1416f --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestPatch.test_signed_off_by_presence.pass | |||
@@ -0,0 +1,66 @@ | |||
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_signed_off_by_presence test. | ||
7 | |||
8 | CVE: CVE-1234-56789 | ||
9 | |||
10 | Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
11 | --- | ||
12 | .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++ | ||
13 | .../selftest-hello/selftest-hello_1.0.bb | 4 ++- | ||
14 | 2 files changed, 29 insertions(+), 1 deletion(-) | ||
15 | create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
16 | |||
17 | 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 | ||
18 | new file mode 100644 | ||
19 | index 00000000000..8a4f9329303 | ||
20 | --- /dev/null | ||
21 | +++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch | ||
22 | @@ -0,0 +1,26 @@ | ||
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 | + | ||
41 | +int main() { | ||
42 | + | ||
43 | + printf("%d\n", str_len(string1)); | ||
44 | + printf("%d\n", str_len(string2)); | ||
45 | + printf("CVE FIXED!!!\n"); | ||
46 | + | ||
47 | + return 0; | ||
48 | +} | ||
49 | 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 | ||
50 | index 2dc352d479e..d937759f157 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://0001-Fix-CVE-1234-56789.patch \ | ||
60 | + " | ||
61 | |||
62 | S = "${WORKDIR}/sources" | ||
63 | UNPACKDIR = "${S}" | ||
64 | -- | ||
65 | 2.45.1 | ||
66 | |||
diff --git a/meta/lib/patchtest/selftest/selftest b/meta/lib/patchtest/selftest/selftest new file mode 100755 index 0000000000..3cf1c361f7 --- /dev/null +++ b/meta/lib/patchtest/selftest/selftest | |||
@@ -0,0 +1,94 @@ | |||
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-only | ||
8 | |||
9 | import os | ||
10 | import subprocess | ||
11 | import sys | ||
12 | |||
13 | currentdir = os.path.dirname(os.path.abspath(__file__)) | ||
14 | patchesdir = os.path.join(currentdir, 'files') | ||
15 | topdir = os.path.dirname(currentdir) | ||
16 | parentdir = os.path.dirname(topdir) | ||
17 | |||
18 | # path to the repo root | ||
19 | repodir = os.path.dirname(os.path.dirname(parentdir)) | ||
20 | |||
21 | def print_results(passcount, failcount, skipcount, xpasscount, xfailcount, xskipcount, errorcount): | ||
22 | total = passcount + skipcount + failcount + xpasscount + xfailcount + xskipcount + errorcount | ||
23 | print("============================================================================") | ||
24 | print("Testsuite summary for %s" % os.path.basename(topdir)) | ||
25 | print("============================================================================") | ||
26 | print("# TOTAL: %s" % str(total)) | ||
27 | print("# XPASS: %s" % str(xpasscount)) | ||
28 | print("# XFAIL: %s" % str(xfailcount)) | ||
29 | print("# XSKIP: %s" % str(xskipcount)) | ||
30 | print("# PASS: %s" % str(passcount)) | ||
31 | print("# FAIL: %s" % str(failcount)) | ||
32 | print("# SKIP: %s" % str(skipcount)) | ||
33 | print("# ERROR: %s" % str(errorcount)) | ||
34 | print("============================================================================") | ||
35 | |||
36 | # Once the tests are in oe-core, we can remove the testdir param and use os.path.dirname to get relative paths | ||
37 | def test(root, patch): | ||
38 | res = True | ||
39 | patchpath = os.path.abspath(os.path.join(root, patch)) | ||
40 | |||
41 | cmd = 'patchtest --base-commit HEAD --repodir %s --testdir %s/tests --patch %s' % (repodir, topdir, patchpath) | ||
42 | results = subprocess.check_output(cmd, stderr=subprocess.STDOUT, universal_newlines=True, shell=True) | ||
43 | |||
44 | return results | ||
45 | |||
46 | if __name__ == '__main__': | ||
47 | passcount = 0 | ||
48 | failcount = 0 | ||
49 | skipcount = 0 | ||
50 | xpasscount = 0 | ||
51 | xfailcount = 0 | ||
52 | xskipcount = 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) | ||
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(':', 1) | ||
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 | elif expected_result.upper() == "SKIP" and result.upper() == "SKIP": | ||
77 | xskipcount = xskipcount + 1 | ||
78 | print("XSKIP: %s (file: %s)" % (testid.strip("."), os.path.basename(patch))) | ||
79 | else: | ||
80 | print("%s: %s (%s)" % (result.upper(), testid.strip("."), os.path.basename(patch))) | ||
81 | if result.upper() == "PASS": | ||
82 | passcount = passcount + 1 | ||
83 | elif result.upper() == "FAIL": | ||
84 | failcount = failcount + 1 | ||
85 | elif result.upper() == "SKIP": | ||
86 | skipcount = skipcount + 1 | ||
87 | else: | ||
88 | print("Bad result on test %s against %s" % (testid.strip("."), os.path.basename(patch))) | ||
89 | errorcount = errorcount + 1 | ||
90 | break | ||
91 | else: | ||
92 | print ("No test for=%s" % patch) | ||
93 | |||
94 | print_results(passcount, failcount, skipcount, xpasscount, xfailcount, xskipcount, 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..919ca136bb --- /dev/null +++ b/meta/lib/patchtest/tests/base.py | |||
@@ -0,0 +1,252 @@ | |||
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-only | ||
6 | |||
7 | import unittest | ||
8 | import logging | ||
9 | import json | ||
10 | import unidiff | ||
11 | from patchtest_parser import PatchtestParser | ||
12 | import mailbox | ||
13 | import patchtest_patterns | ||
14 | import collections | ||
15 | import sys | ||
16 | import os | ||
17 | import re | ||
18 | |||
19 | logger = logging.getLogger("patchtest") | ||
20 | debug = logger.debug | ||
21 | info = logger.info | ||
22 | warn = logger.warn | ||
23 | error = logger.error | ||
24 | |||
25 | Commit = collections.namedtuple( | ||
26 | "Commit", ["author", "subject", "commit_message", "shortlog", "payload"] | ||
27 | ) | ||
28 | |||
29 | Commit = collections.namedtuple('Commit', ['author', 'subject', 'commit_message', 'shortlog', 'payload']) | ||
30 | |||
31 | class PatchtestOEError(Exception): | ||
32 | """Exception for handling patchtest-oe errors""" | ||
33 | def __init__(self, message, exitcode=1): | ||
34 | super().__init__(message) | ||
35 | self.exitcode = exitcode | ||
36 | |||
37 | class Base(unittest.TestCase): | ||
38 | # if unit test fails, fail message will throw at least the following JSON: {"id": <testid>} | ||
39 | |||
40 | @staticmethod | ||
41 | def msg_to_commit(msg): | ||
42 | payload = msg.get_payload() | ||
43 | return Commit(subject=msg['subject'].replace('\n', ' ').replace(' ', ' '), | ||
44 | author=msg.get('From'), | ||
45 | shortlog=Base.shortlog(msg['subject']), | ||
46 | commit_message=Base.commit_message(payload), | ||
47 | payload=payload) | ||
48 | |||
49 | @staticmethod | ||
50 | def commit_message(payload): | ||
51 | commit_message = payload.__str__() | ||
52 | match = patchtest_patterns.endcommit_messages_regex.search(payload) | ||
53 | if match: | ||
54 | commit_message = payload[:match.start()] | ||
55 | return commit_message | ||
56 | |||
57 | @staticmethod | ||
58 | def shortlog(shlog): | ||
59 | # remove possible prefix (between brackets) before colon | ||
60 | start = shlog.find(']', 0, shlog.find(':')) | ||
61 | # remove also newlines and spaces at both sides | ||
62 | return shlog[start + 1:].replace('\n', '').strip() | ||
63 | |||
64 | @classmethod | ||
65 | def setUpClass(cls): | ||
66 | |||
67 | # General objects: mailbox.mbox and patchset | ||
68 | cls.mbox = mailbox.mbox(PatchtestParser.repo.patch.path) | ||
69 | |||
70 | # Patch may be malformed, so try parsing it | ||
71 | cls.unidiff_parse_error = '' | ||
72 | cls.patchset = None | ||
73 | try: | ||
74 | cls.patchset = unidiff.PatchSet.from_filename( | ||
75 | PatchtestParser.repo.patch.path, encoding="UTF-8" | ||
76 | ) | ||
77 | except unidiff.UnidiffParseError as upe: | ||
78 | cls.patchset = [] | ||
79 | cls.unidiff_parse_error = str(upe) | ||
80 | |||
81 | # Easy to iterate list of commits | ||
82 | cls.commits = [] | ||
83 | for msg in cls.mbox: | ||
84 | if msg['subject'] and msg.get_payload(): | ||
85 | cls.commits.append(Base.msg_to_commit(msg)) | ||
86 | |||
87 | cls.setUpClassLocal() | ||
88 | |||
89 | @classmethod | ||
90 | def tearDownClass(cls): | ||
91 | cls.tearDownClassLocal() | ||
92 | |||
93 | @classmethod | ||
94 | def setUpClassLocal(cls): | ||
95 | pass | ||
96 | |||
97 | @classmethod | ||
98 | def tearDownClassLocal(cls): | ||
99 | pass | ||
100 | |||
101 | def fail(self, issue, fix=None, commit=None, data=None): | ||
102 | """ Convert to a JSON string failure data""" | ||
103 | value = {'id': self.id(), | ||
104 | 'issue': issue} | ||
105 | |||
106 | if fix: | ||
107 | value['fix'] = fix | ||
108 | if commit: | ||
109 | value['commit'] = {'subject': commit.subject, | ||
110 | 'shortlog': commit.shortlog} | ||
111 | |||
112 | # extend return value with other useful info | ||
113 | if data: | ||
114 | value['data'] = data | ||
115 | |||
116 | return super(Base, self).fail(json.dumps(value)) | ||
117 | |||
118 | def skip(self, issue, data=None): | ||
119 | """ Convert the skip string to JSON""" | ||
120 | value = {'id': self.id(), | ||
121 | 'issue': issue} | ||
122 | |||
123 | # extend return value with other useful info | ||
124 | if data: | ||
125 | value['data'] = data | ||
126 | |||
127 | return super(Base, self).skipTest(json.dumps(value)) | ||
128 | |||
129 | def shortid(self): | ||
130 | return self.id().split('.')[-1] | ||
131 | |||
132 | def __str__(self): | ||
133 | return json.dumps({'id': self.id()}) | ||
134 | |||
135 | class Metadata(Base): | ||
136 | @classmethod | ||
137 | def setUpClassLocal(cls): | ||
138 | cls.tinfoil = cls.setup_tinfoil() | ||
139 | |||
140 | # get info about added/modified/remove recipes | ||
141 | cls.added, cls.modified, cls.removed = cls.get_metadata_stats(cls.patchset) | ||
142 | |||
143 | @classmethod | ||
144 | def tearDownClassLocal(cls): | ||
145 | cls.tinfoil.shutdown() | ||
146 | |||
147 | @classmethod | ||
148 | def setup_tinfoil(cls, config_only=False): | ||
149 | """Initialize tinfoil api from bitbake""" | ||
150 | |||
151 | # import relevant libraries | ||
152 | try: | ||
153 | scripts_path = os.path.join(PatchtestParser.repodir, "scripts", "lib") | ||
154 | if scripts_path not in sys.path: | ||
155 | sys.path.insert(0, scripts_path) | ||
156 | import scriptpath | ||
157 | scriptpath.add_bitbake_lib_path() | ||
158 | import bb.tinfoil | ||
159 | except ImportError: | ||
160 | raise PatchtestOEError('Could not import tinfoil module') | ||
161 | |||
162 | orig_cwd = os.path.abspath(os.curdir) | ||
163 | |||
164 | # Load tinfoil | ||
165 | tinfoil = None | ||
166 | try: | ||
167 | builddir = os.environ.get('BUILDDIR') | ||
168 | if not builddir: | ||
169 | logger.warn('Bitbake environment not loaded?') | ||
170 | return tinfoil | ||
171 | os.chdir(builddir) | ||
172 | tinfoil = bb.tinfoil.Tinfoil() | ||
173 | tinfoil.prepare(config_only=config_only) | ||
174 | except bb.tinfoil.TinfoilUIException as te: | ||
175 | if tinfoil: | ||
176 | tinfoil.shutdown() | ||
177 | raise PatchtestOEError('Could not prepare properly tinfoil (TinfoilUIException)') | ||
178 | except Exception as e: | ||
179 | if tinfoil: | ||
180 | tinfoil.shutdown() | ||
181 | raise e | ||
182 | finally: | ||
183 | os.chdir(orig_cwd) | ||
184 | |||
185 | return tinfoil | ||
186 | |||
187 | @classmethod | ||
188 | def get_metadata_stats(cls, patchset): | ||
189 | """Get lists of added, modified and removed metadata files""" | ||
190 | |||
191 | def find_pn(data, path): | ||
192 | """Find the PN from data""" | ||
193 | pn = None | ||
194 | pn_native = None | ||
195 | for _path, _pn in data: | ||
196 | if path in _path: | ||
197 | if 'native' in _pn: | ||
198 | # store the native PN but look for the non-native one first | ||
199 | pn_native = _pn | ||
200 | else: | ||
201 | pn = _pn | ||
202 | break | ||
203 | else: | ||
204 | # sent the native PN if found previously | ||
205 | if pn_native: | ||
206 | return pn_native | ||
207 | |||
208 | # on renames (usually upgrades), we need to check (FILE) base names | ||
209 | # because the unidiff library does not provided the new filename, just the modified one | ||
210 | # and tinfoil datastore, once the patch is merged, will contain the new filename | ||
211 | path_basename = path.split('_')[0] | ||
212 | for _path, _pn in data: | ||
213 | _path_basename = _path.split('_')[0] | ||
214 | if path_basename == _path_basename: | ||
215 | pn = _pn | ||
216 | return pn | ||
217 | |||
218 | if not cls.tinfoil: | ||
219 | cls.tinfoil = cls.setup_tinfoil() | ||
220 | |||
221 | added_paths, modified_paths, removed_paths = [], [], [] | ||
222 | added, modified, removed = [], [], [] | ||
223 | |||
224 | # get metadata filename additions, modification and removals | ||
225 | for patch in patchset: | ||
226 | if patch.path.endswith('.bb') or patch.path.endswith('.bbappend') or patch.path.endswith('.inc'): | ||
227 | if patch.is_added_file: | ||
228 | added_paths.append( | ||
229 | os.path.join( | ||
230 | os.path.abspath(PatchtestParser.repodir), patch.path | ||
231 | ) | ||
232 | ) | ||
233 | elif patch.is_modified_file: | ||
234 | modified_paths.append( | ||
235 | os.path.join( | ||
236 | os.path.abspath(PatchtestParser.repodir), patch.path | ||
237 | ) | ||
238 | ) | ||
239 | elif patch.is_removed_file: | ||
240 | removed_paths.append( | ||
241 | os.path.join( | ||
242 | os.path.abspath(PatchtestParser.repodir), patch.path | ||
243 | ) | ||
244 | ) | ||
245 | |||
246 | data = cls.tinfoil.cooker.recipecaches[''].pkg_fn.items() | ||
247 | |||
248 | added = [find_pn(data,path) for path in added_paths] | ||
249 | modified = [find_pn(data,path) for path in modified_paths] | ||
250 | removed = [find_pn(data,path) for path in removed_paths] | ||
251 | |||
252 | 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/test_mbox.py b/meta/lib/patchtest/tests/test_mbox.py new file mode 100644 index 0000000000..dab733ea77 --- /dev/null +++ b/meta/lib/patchtest/tests/test_mbox.py | |||
@@ -0,0 +1,179 @@ | |||
1 | # Checks related to the patch's author | ||
2 | # | ||
3 | # Copyright (C) 2016 Intel Corporation | ||
4 | # | ||
5 | # SPDX-License-Identifier: GPL-2.0-only | ||
6 | |||
7 | import base | ||
8 | import collections | ||
9 | import patchtest_patterns | ||
10 | import pyparsing | ||
11 | import re | ||
12 | import subprocess | ||
13 | from patchtest_parser import PatchtestParser | ||
14 | |||
15 | def headlog(): | ||
16 | output = subprocess.check_output( | ||
17 | "cd %s; git log --pretty='%%h#%%aN#%%cD:#%%s' -1" % PatchtestParser.repodir, | ||
18 | universal_newlines=True, | ||
19 | shell=True | ||
20 | ) | ||
21 | return output.split('#') | ||
22 | |||
23 | class TestMbox(base.Base): | ||
24 | |||
25 | # base paths of main yocto project sub-projects | ||
26 | paths = { | ||
27 | 'oe-core': ['meta-selftest', 'meta-skeleton', 'meta', 'scripts'], | ||
28 | 'bitbake': ['bitbake'], | ||
29 | 'documentation': ['documentation'], | ||
30 | 'poky': ['meta-poky','meta-yocto-bsp'], | ||
31 | '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'] | ||
32 | } | ||
33 | |||
34 | # scripts folder is a mix of oe-core and poky, most is oe-core code except: | ||
35 | poky_scripts = ['scripts/yocto-bsp', 'scripts/yocto-kernel', 'scripts/yocto-layer', 'scripts/lib/bsp'] | ||
36 | |||
37 | Project = collections.namedtuple('Project', ['name', 'listemail', 'gitrepo', 'paths']) | ||
38 | |||
39 | bitbake = Project(name='Bitbake', listemail='bitbake-devel@lists.openembedded.org', gitrepo='http://git.openembedded.org/bitbake/', paths=paths['bitbake']) | ||
40 | doc = Project(name='Documentantion', listemail='yocto@yoctoproject.org', gitrepo='http://git.yoctoproject.org/cgit/cgit.cgi/yocto-docs/', paths=paths['documentation']) | ||
41 | poky = Project(name='Poky', listemail='poky@yoctoproject.org', gitrepo='http://git.yoctoproject.org/cgit/cgit.cgi/poky/', paths=paths['poky']) | ||
42 | oe = Project(name='oe', listemail='openembedded-devel@lists.openembedded.org', gitrepo='http://git.openembedded.org/meta-openembedded/', paths=paths['oe']) | ||
43 | |||
44 | |||
45 | def test_signed_off_by_presence(self): | ||
46 | for commit in self.commits: | ||
47 | # skip those patches that revert older commits, these do not required the tag presence | ||
48 | if patchtest_patterns.mbox_revert_shortlog_regex.search_string(commit.shortlog): | ||
49 | continue | ||
50 | if not patchtest_patterns.signed_off_by.search_string(commit.payload): | ||
51 | self.fail( | ||
52 | 'Mbox is missing Signed-off-by. Add it manually or with "git commit --amend -s"', | ||
53 | commit=commit, | ||
54 | ) | ||
55 | |||
56 | def test_shortlog_format(self): | ||
57 | for commit in self.commits: | ||
58 | shortlog = commit.shortlog | ||
59 | if not shortlog.strip(): | ||
60 | self.skip('Empty shortlog, no reason to execute shortlog format test') | ||
61 | else: | ||
62 | # no reason to re-check on revert shortlogs | ||
63 | if shortlog.startswith('Revert "'): | ||
64 | continue | ||
65 | try: | ||
66 | patchtest_patterns.shortlog.parseString(shortlog) | ||
67 | except pyparsing.ParseException as pe: | ||
68 | self.fail('Commit shortlog (first line of commit message) should follow the format "<target>: <summary>"', | ||
69 | commit=commit) | ||
70 | |||
71 | def test_shortlog_length(self): | ||
72 | for commit in self.commits: | ||
73 | # no reason to re-check on revert shortlogs | ||
74 | shortlog = re.sub('^(\[.*?\])+ ', '', commit.shortlog) | ||
75 | if shortlog.startswith('Revert "'): | ||
76 | continue | ||
77 | l = len(shortlog) | ||
78 | if l > patchtest_patterns.mbox_shortlog_maxlength: | ||
79 | self.fail( | ||
80 | "Edit shortlog so that it is %d characters or less (currently %d characters)" | ||
81 | % (patchtest_patterns.mbox_shortlog_maxlength, l), | ||
82 | commit=commit, | ||
83 | ) | ||
84 | |||
85 | def test_series_merge_on_head(self): | ||
86 | self.skip("Merge test is disabled for now") | ||
87 | if PatchtestParser.repo.patch.branch != "master": | ||
88 | self.skip( | ||
89 | "Skipping merge test since patch is not intended" | ||
90 | " for master branch. Target detected is %s" | ||
91 | % PatchtestParser.repo.patch.branch | ||
92 | ) | ||
93 | if not PatchtestParser.repo.canbemerged: | ||
94 | commithash, author, date, shortlog = headlog() | ||
95 | self.fail( | ||
96 | "Series does not apply on top of target branch %s" | ||
97 | % PatchtestParser.repo.patch.branch, | ||
98 | data=[ | ||
99 | ( | ||
100 | "Targeted branch", | ||
101 | "%s (currently at %s)" | ||
102 | % (PatchtestParser.repo.patch.branch, commithash), | ||
103 | ) | ||
104 | ], | ||
105 | ) | ||
106 | |||
107 | def test_target_mailing_list(self): | ||
108 | """Check for other targeted projects""" | ||
109 | |||
110 | # a meta project may be indicted in the message subject, if this is the case, just fail | ||
111 | # TODO: there may be other project with no-meta prefix, we also need to detect these | ||
112 | project_regex = pyparsing.Regex("\[(?P<project>meta-.+)\]") | ||
113 | for commit in self.commits: | ||
114 | match = project_regex.search_string(commit.subject) | ||
115 | if match: | ||
116 | self.fail('Series sent to the wrong mailing list or some patches from the series correspond to different mailing lists', | ||
117 | commit=commit) | ||
118 | |||
119 | for patch in self.patchset: | ||
120 | folders = patch.path.split('/') | ||
121 | base_path = folders[0] | ||
122 | for project in [self.bitbake, self.doc, self.oe, self.poky]: | ||
123 | if base_path in project.paths: | ||
124 | self.fail('Series sent to the wrong mailing list or some patches from the series correspond to different mailing lists', | ||
125 | data=[('Suggested ML', '%s [%s]' % (project.listemail, project.gitrepo)), | ||
126 | ('Patch\'s path:', patch.path)]) | ||
127 | |||
128 | # check for poky's scripts code | ||
129 | if base_path.startswith('scripts'): | ||
130 | for poky_file in self.poky_scripts: | ||
131 | if patch.path.startswith(poky_file): | ||
132 | self.fail('Series sent to the wrong mailing list or some patches from the series correspond to different mailing lists', | ||
133 | data=[('Suggested ML', '%s [%s]' % (self.poky.listemail, self.poky.gitrepo)),('Patch\'s path:', patch.path)]) | ||
134 | |||
135 | def test_mbox_format(self): | ||
136 | if self.unidiff_parse_error: | ||
137 | self.fail('Series has malformed diff lines. Create the series again using git-format-patch and ensure it applies using git am', | ||
138 | data=[('Diff line',self.unidiff_parse_error)]) | ||
139 | |||
140 | def test_commit_message_presence(self): | ||
141 | for commit in self.commits: | ||
142 | if not commit.commit_message.strip(): | ||
143 | self.fail('Please include a commit message on your patch explaining the change', commit=commit) | ||
144 | |||
145 | # This may incorrectly report a failure if something such as a | ||
146 | # Python decorator is included in the commit message, but this | ||
147 | # scenario is much less common than the username case it is written | ||
148 | # to protect against | ||
149 | def test_commit_message_user_tags(self): | ||
150 | for commit in self.commits: | ||
151 | if patchtest_patterns.mbox_github_username.search_string(commit.commit_message): | ||
152 | self.fail('Mbox includes one or more GitHub-style username tags. Ensure that any "@" symbols are stripped out of usernames', commit=commit) | ||
153 | |||
154 | def test_bugzilla_entry_format(self): | ||
155 | for commit in self.commits: | ||
156 | if not patchtest_patterns.mbox_bugzilla.search_string(commit.commit_message): | ||
157 | self.skip("No bug ID found") | ||
158 | elif not patchtest_patterns.mbox_bugzilla_validation.search_string( | ||
159 | commit.commit_message | ||
160 | ): | ||
161 | self.fail( | ||
162 | 'Bugzilla issue ID is not correctly formatted - specify it with format: "[YOCTO #<bugzilla ID>]"', | ||
163 | commit=commit, | ||
164 | ) | ||
165 | |||
166 | def test_author_valid(self): | ||
167 | for commit in self.commits: | ||
168 | for invalid in patchtest_patterns.invalid_submitters: | ||
169 | if invalid.search_string(commit.author): | ||
170 | self.fail('Invalid author %s. Resend the series with a valid patch author' % commit.author, commit=commit) | ||
171 | |||
172 | def test_non_auh_upgrade(self): | ||
173 | for commit in self.commits: | ||
174 | if patchtest_patterns.auh_email in commit.commit_message: | ||
175 | self.fail( | ||
176 | "Invalid author %s. Resend the series with a valid patch author" | ||
177 | % patchtest_patterns.auh_email, | ||
178 | commit=commit, | ||
179 | ) | ||
diff --git a/meta/lib/patchtest/tests/test_metadata.py b/meta/lib/patchtest/tests/test_metadata.py new file mode 100644 index 0000000000..2dee80b002 --- /dev/null +++ b/meta/lib/patchtest/tests/test_metadata.py | |||
@@ -0,0 +1,212 @@ | |||
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-only | ||
6 | |||
7 | import base | ||
8 | import collections | ||
9 | import os | ||
10 | import patchtest_patterns | ||
11 | import pyparsing | ||
12 | from patchtest_parser import PatchtestParser | ||
13 | |||
14 | # Data store commonly used to share values between pre and post-merge tests | ||
15 | PatchTestDataStore = collections.defaultdict(str) | ||
16 | |||
17 | class TestMetadata(base.Metadata): | ||
18 | |||
19 | def test_license_presence(self): | ||
20 | if not self.added: | ||
21 | self.skip('No added recipes, skipping test') | ||
22 | |||
23 | # TODO: this is a workaround so we can parse the recipe not | ||
24 | # containing the LICENSE var: add some default license instead | ||
25 | # of INVALID into auto.conf, then remove this line at the end | ||
26 | auto_conf = os.path.join(os.environ.get('BUILDDIR'), 'conf', 'auto.conf') | ||
27 | open_flag = 'w' | ||
28 | if os.path.exists(auto_conf): | ||
29 | open_flag = 'a' | ||
30 | with open(auto_conf, open_flag) as fd: | ||
31 | for pn in self.added: | ||
32 | fd.write('LICENSE ??= "%s"\n' % patchtest_patterns.invalid_license) | ||
33 | |||
34 | no_license = False | ||
35 | for pn in self.added: | ||
36 | rd = self.tinfoil.parse_recipe(pn) | ||
37 | license = rd.getVar(patchtest_patterns.metadata_lic) | ||
38 | if license == patchtest_patterns.invalid_license: | ||
39 | no_license = True | ||
40 | break | ||
41 | |||
42 | # remove auto.conf line or the file itself | ||
43 | if open_flag == 'w': | ||
44 | os.remove(auto_conf) | ||
45 | else: | ||
46 | fd = open(auto_conf, 'r') | ||
47 | lines = fd.readlines() | ||
48 | fd.close() | ||
49 | with open(auto_conf, 'w') as fd: | ||
50 | fd.write(''.join(lines[:-1])) | ||
51 | |||
52 | if no_license: | ||
53 | self.fail('Recipe does not have the LICENSE field set.') | ||
54 | |||
55 | def test_lic_files_chksum_presence(self): | ||
56 | if not self.added: | ||
57 | self.skip('No added recipes, skipping test') | ||
58 | |||
59 | for pn in self.added: | ||
60 | rd = self.tinfoil.parse_recipe(pn) | ||
61 | pathname = rd.getVar('FILE') | ||
62 | # we are not interested in images | ||
63 | if '/images/' in pathname: | ||
64 | continue | ||
65 | lic_files_chksum = rd.getVar(patchtest_patterns.metadata_chksum) | ||
66 | if rd.getVar(patchtest_patterns.license_var) == patchtest_patterns.closed: | ||
67 | continue | ||
68 | if not lic_files_chksum: | ||
69 | self.fail( | ||
70 | "%s is missing in newly added recipe" % patchtest_patterns.metadata_chksum | ||
71 | ) | ||
72 | |||
73 | def test_lic_files_chksum_modified_not_mentioned(self): | ||
74 | if not self.modified: | ||
75 | self.skip('No modified recipes, skipping test') | ||
76 | |||
77 | for patch in self.patchset: | ||
78 | # for the moment, we are just interested in metadata | ||
79 | if patch.path.endswith('.patch'): | ||
80 | continue | ||
81 | payload = str(patch) | ||
82 | if patchtest_patterns.lic_chksum_added.search_string( | ||
83 | payload | ||
84 | ) or patchtest_patterns.lic_chksum_removed.search_string(payload): | ||
85 | # if any patch on the series contain reference on the metadata, fail | ||
86 | for commit in self.commits: | ||
87 | if patchtest_patterns.lictag_re.search_string(commit.commit_message): | ||
88 | break | ||
89 | else: | ||
90 | self.fail('LIC_FILES_CHKSUM changed without "License-Update:" tag and description in commit message') | ||
91 | |||
92 | def test_max_line_length(self): | ||
93 | for patch in self.patchset: | ||
94 | # for the moment, we are just interested in metadata | ||
95 | if patch.path.endswith('.patch'): | ||
96 | continue | ||
97 | payload = str(patch) | ||
98 | for line in payload.splitlines(): | ||
99 | if patchtest_patterns.add_mark.search_string(line): | ||
100 | current_line_length = len(line[1:]) | ||
101 | if current_line_length > patchtest_patterns.patch_max_line_length: | ||
102 | self.fail( | ||
103 | "Patch line too long (current length %s, maximum is %s)" | ||
104 | % (current_line_length, patchtest_patterns.patch_max_line_length), | ||
105 | data=[ | ||
106 | ("Patch", patch.path), | ||
107 | ("Line", "%s ..." % line[0:80]), | ||
108 | ], | ||
109 | ) | ||
110 | |||
111 | def pretest_src_uri_left_files(self): | ||
112 | # these tests just make sense on patches that can be merged | ||
113 | if not PatchtestParser.repo.canbemerged: | ||
114 | self.skip("Patch cannot be merged") | ||
115 | if not self.modified: | ||
116 | self.skip('No modified recipes, skipping pretest') | ||
117 | |||
118 | # get the proper metadata values | ||
119 | for pn in self.modified: | ||
120 | # we are not interested in images | ||
121 | if 'core-image' in pn: | ||
122 | continue | ||
123 | rd = self.tinfoil.parse_recipe(pn) | ||
124 | PatchTestDataStore[ | ||
125 | "%s-%s-%s" % (self.shortid(), patchtest_patterns.metadata_src_uri, pn) | ||
126 | ] = rd.getVar(patchtest_patterns.metadata_src_uri) | ||
127 | |||
128 | def test_src_uri_left_files(self): | ||
129 | # these tests just make sense on patches that can be merged | ||
130 | if not PatchtestParser.repo.canbemerged: | ||
131 | self.skip("Patch cannot be merged") | ||
132 | if not self.modified: | ||
133 | self.skip('No modified recipes, skipping pretest') | ||
134 | |||
135 | # get the proper metadata values | ||
136 | for pn in self.modified: | ||
137 | # we are not interested in images | ||
138 | if 'core-image' in pn: | ||
139 | continue | ||
140 | rd = self.tinfoil.parse_recipe(pn) | ||
141 | PatchTestDataStore[ | ||
142 | "%s-%s-%s" % (self.shortid(), patchtest_patterns.metadata_src_uri, pn) | ||
143 | ] = rd.getVar(patchtest_patterns.metadata_src_uri) | ||
144 | |||
145 | for pn in self.modified: | ||
146 | pretest_src_uri = PatchTestDataStore[ | ||
147 | "pre%s-%s-%s" % (self.shortid(), patchtest_patterns.metadata_src_uri, pn) | ||
148 | ].split() | ||
149 | test_src_uri = PatchTestDataStore[ | ||
150 | "%s-%s-%s" % (self.shortid(), patchtest_patterns.metadata_src_uri, pn) | ||
151 | ].split() | ||
152 | |||
153 | pretest_files = set([os.path.basename(patch) for patch in pretest_src_uri if patch.startswith('file://')]) | ||
154 | test_files = set([os.path.basename(patch) for patch in test_src_uri if patch.startswith('file://')]) | ||
155 | |||
156 | # check if files were removed | ||
157 | if len(test_files) < len(pretest_files): | ||
158 | |||
159 | # get removals from patchset | ||
160 | filesremoved_from_patchset = set() | ||
161 | for patch in self.patchset: | ||
162 | if patch.is_removed_file: | ||
163 | filesremoved_from_patchset.add(os.path.basename(patch.path)) | ||
164 | |||
165 | # get the deleted files from the SRC_URI | ||
166 | filesremoved_from_usr_uri = pretest_files - test_files | ||
167 | |||
168 | # finally, get those patches removed at SRC_URI and not removed from the patchset | ||
169 | # TODO: we are not taking into account renames, so test may raise false positives | ||
170 | not_removed = filesremoved_from_usr_uri - filesremoved_from_patchset | ||
171 | if not_removed: | ||
172 | self.fail('Patches not removed from tree. Remove them and amend the submitted mbox', | ||
173 | data=[('Patch', f) for f in not_removed]) | ||
174 | |||
175 | def test_summary_presence(self): | ||
176 | if not self.added: | ||
177 | self.skip('No added recipes, skipping test') | ||
178 | |||
179 | for pn in self.added: | ||
180 | # we are not interested in images | ||
181 | if 'core-image' in pn: | ||
182 | continue | ||
183 | rd = self.tinfoil.parse_recipe(pn) | ||
184 | summary = rd.getVar(patchtest_patterns.metadata_summary) | ||
185 | |||
186 | # "${PN} version ${PN}-${PR}" is the default, so fail if default | ||
187 | if summary.startswith("%s version" % pn): | ||
188 | self.fail( | ||
189 | "%s is missing in newly added recipe" % patchtest_patterns.metadata_summary | ||
190 | ) | ||
191 | |||
192 | def test_cve_check_ignore(self): | ||
193 | # Skip if we neither modified a recipe or target branches are not | ||
194 | # Nanbield and newer. CVE_CHECK_IGNORE was first deprecated in Nanbield. | ||
195 | if ( | ||
196 | not self.modified | ||
197 | or PatchtestParser.repo.patch.branch == "kirkstone" | ||
198 | or PatchtestParser.repo.patch.branch == "dunfell" | ||
199 | ): | ||
200 | self.skip("No modified recipes or older target branch, skipping test") | ||
201 | for pn in self.modified: | ||
202 | # we are not interested in images | ||
203 | if 'core-image' in pn: | ||
204 | continue | ||
205 | rd = self.tinfoil.parse_recipe(pn) | ||
206 | cve_check_ignore = rd.getVar(patchtest_patterns.cve_check_ignore_var) | ||
207 | |||
208 | if cve_check_ignore is not None: | ||
209 | self.fail( | ||
210 | "%s is deprecated and should be replaced by %s" | ||
211 | % (patchtest_patterns.cve_check_ignore_var, patchtest_patterns.cve_status_var) | ||
212 | ) | ||
diff --git a/meta/lib/patchtest/tests/test_patch.py b/meta/lib/patchtest/tests/test_patch.py new file mode 100644 index 0000000000..d08b8a5019 --- /dev/null +++ b/meta/lib/patchtest/tests/test_patch.py | |||
@@ -0,0 +1,131 @@ | |||
1 | # Checks related to the patch's CVE lines | ||
2 | # | ||
3 | # Copyright (C) 2016 Intel Corporation | ||
4 | # | ||
5 | # SPDX-License-Identifier: GPL-2.0-only | ||
6 | # | ||
7 | |||
8 | import base | ||
9 | import os | ||
10 | import patchtest_patterns | ||
11 | import pyparsing | ||
12 | |||
13 | class TestPatch(base.Base): | ||
14 | |||
15 | @classmethod | ||
16 | def setUpClassLocal(cls): | ||
17 | cls.newpatches = [] | ||
18 | # get just those relevant patches: new software patches | ||
19 | for patch in cls.patchset: | ||
20 | if patch.path.endswith('.patch') and patch.is_added_file: | ||
21 | cls.newpatches.append(patch) | ||
22 | |||
23 | cls.mark = str(patchtest_patterns.signed_off_by_prefix).strip('"') | ||
24 | |||
25 | # match PatchSignedOffBy.mark with '+' preceding it | ||
26 | cls.prog = patchtest_patterns.patch_signed_off_by | ||
27 | |||
28 | def setUp(self): | ||
29 | if self.unidiff_parse_error: | ||
30 | self.skip('Parse error %s' % self.unidiff_parse_error) | ||
31 | |||
32 | self.valid_status = ", ".join(patchtest_patterns.upstream_status_nonliteral_valid_status) | ||
33 | self.standard_format = "Upstream-Status: <Valid status>" | ||
34 | |||
35 | # we are just interested in series that introduce CVE patches, thus discard other | ||
36 | # possibilities: modification to current CVEs, patch directly introduced into the | ||
37 | # recipe, upgrades already including the CVE, etc. | ||
38 | new_cves = [p for p in self.patchset if p.path.endswith('.patch') and p.is_added_file] | ||
39 | if not new_cves: | ||
40 | self.skip('No new CVE patches introduced') | ||
41 | |||
42 | def test_upstream_status_presence_format(self): | ||
43 | if not TestPatch.newpatches: | ||
44 | self.skip("There are no new software patches, no reason to test Upstream-Status presence/format") | ||
45 | |||
46 | for newpatch in TestPatch.newpatches: | ||
47 | payload = newpatch.__str__() | ||
48 | if not patchtest_patterns.upstream_status_regex.search_string(payload): | ||
49 | self.fail( | ||
50 | "Added patch file is missing Upstream-Status: <Valid status> in the commit message", | ||
51 | data=[ | ||
52 | ("Standard format", self.standard_format), | ||
53 | ("Valid status", self.valid_status), | ||
54 | ], | ||
55 | ) | ||
56 | for line in payload.splitlines(): | ||
57 | if patchtest_patterns.patchmetadata_regex.match(line): | ||
58 | continue | ||
59 | if patchtest_patterns.upstream_status_regex.search_string(line): | ||
60 | if patchtest_patterns.inappropriate.searchString(line): | ||
61 | try: | ||
62 | patchtest_patterns.upstream_status_inappropriate_info.parseString( | ||
63 | line.lstrip("+") | ||
64 | ) | ||
65 | except pyparsing.ParseException as pe: | ||
66 | self.fail( | ||
67 | "Upstream-Status is Inappropriate, but no reason was provided", | ||
68 | data=[ | ||
69 | ("Current", pe.pstr), | ||
70 | ( | ||
71 | "Standard format", | ||
72 | "Upstream-Status: Inappropriate [reason]", | ||
73 | ), | ||
74 | ], | ||
75 | ) | ||
76 | elif patchtest_patterns.submitted.searchString(line): | ||
77 | try: | ||
78 | patchtest_patterns.upstream_status_submitted_info.parseString( | ||
79 | line.lstrip("+") | ||
80 | ) | ||
81 | except pyparsing.ParseException as pe: | ||
82 | self.fail( | ||
83 | "Upstream-Status is Submitted, but it is not mentioned where", | ||
84 | data=[ | ||
85 | ("Current", pe.pstr), | ||
86 | ( | ||
87 | "Standard format", | ||
88 | "Upstream-Status: Submitted [where]", | ||
89 | ), | ||
90 | ], | ||
91 | ) | ||
92 | else: | ||
93 | try: | ||
94 | patchtest_patterns.upstream_status.parseString(line.lstrip("+")) | ||
95 | except pyparsing.ParseException as pe: | ||
96 | self.fail( | ||
97 | "Upstream-Status is in incorrect format", | ||
98 | data=[ | ||
99 | ("Current", pe.pstr), | ||
100 | ("Standard format", self.standard_format), | ||
101 | ("Valid status", self.valid_status), | ||
102 | ], | ||
103 | ) | ||
104 | |||
105 | def test_signed_off_by_presence(self): | ||
106 | if not TestPatch.newpatches: | ||
107 | self.skip("There are no new software patches, no reason to test %s presence" % PatchSignedOffBy.mark) | ||
108 | |||
109 | for newpatch in TestPatch.newpatches: | ||
110 | payload = newpatch.__str__() | ||
111 | for line in payload.splitlines(): | ||
112 | if patchtest_patterns.patchmetadata_regex.match(line): | ||
113 | continue | ||
114 | if TestPatch.prog.search_string(payload): | ||
115 | break | ||
116 | else: | ||
117 | self.fail('A patch file has been added without a Signed-off-by tag: \'%s\'' % os.path.basename(newpatch.path)) | ||
118 | |||
119 | def test_cve_tag_format(self): | ||
120 | for commit in TestPatch.commits: | ||
121 | if patchtest_patterns.cve.search_string( | ||
122 | commit.shortlog | ||
123 | ) or patchtest_patterns.cve.search_string(commit.commit_message): | ||
124 | tag_found = False | ||
125 | for line in commit.payload.splitlines(): | ||
126 | if patchtest_patterns.cve_payload_tag.search_string(line): | ||
127 | tag_found = True | ||
128 | break | ||
129 | if not tag_found: | ||
130 | self.fail('Missing or incorrectly formatted CVE tag in patch file. Correct or include the CVE tag in the patch with format: "CVE: CVE-YYYY-XXXX"', | ||
131 | commit=commit) | ||
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..ec9129bc79 --- /dev/null +++ b/meta/lib/patchtest/tests/test_python_pylint.py | |||
@@ -0,0 +1,65 @@ | |||
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-only | ||
6 | |||
7 | import base | ||
8 | from io import StringIO | ||
9 | from patchtest_parser import PatchtestParser | ||
10 | from pylint.reporters.text import TextReporter | ||
11 | import pylint.lint as lint | ||
12 | |||
13 | |||
14 | class PyLint(base.Base): | ||
15 | pythonpatches = [] | ||
16 | pylint_pretest = {} | ||
17 | pylint_test = {} | ||
18 | pylint_options = " -E --disable='E0611, E1101, F0401, E0602' --msg-template='L:{line} F:{module} I:{msg}'" | ||
19 | |||
20 | @classmethod | ||
21 | def setUpClassLocal(cls): | ||
22 | # get just those patches touching python files | ||
23 | cls.pythonpatches = [] | ||
24 | for patch in cls.patchset: | ||
25 | if patch.path.endswith('.py'): | ||
26 | if not patch.is_removed_file: | ||
27 | cls.pythonpatches.append(patch) | ||
28 | |||
29 | def setUp(self): | ||
30 | if self.unidiff_parse_error: | ||
31 | self.skip('Python-unidiff parse error') | ||
32 | if not PyLint.pythonpatches: | ||
33 | self.skip('No python related patches, skipping test') | ||
34 | |||
35 | def pretest_pylint(self): | ||
36 | for pythonpatch in self.pythonpatches: | ||
37 | if pythonpatch.is_modified_file: | ||
38 | pylint_output = StringIO() | ||
39 | reporter = TextReporter(pylint_output) | ||
40 | lint.Run([self.pylint_options, pythonpatch.path], reporter=reporter, exit=False) | ||
41 | for line in pylint_output.readlines(): | ||
42 | if not '*' in line: | ||
43 | if line.strip(): | ||
44 | self.pylint_pretest[line.strip().split(' ',1)[0]] = line.strip().split(' ',1)[1] | ||
45 | |||
46 | def test_pylint(self): | ||
47 | for pythonpatch in self.pythonpatches: | ||
48 | # a condition checking whether a file is renamed or not | ||
49 | # unidiff doesn't support this yet | ||
50 | if pythonpatch.target_file is not pythonpatch.path: | ||
51 | path = pythonpatch.target_file[2:] | ||
52 | else: | ||
53 | path = pythonpatch.path | ||
54 | pylint_output = StringIO() | ||
55 | reporter = TextReporter(pylint_output) | ||
56 | lint.Run([self.pylint_options, pythonpatch.path], reporter=reporter, exit=False) | ||
57 | for line in pylint_output.readlines(): | ||
58 | if not '*' in line: | ||
59 | if line.strip(): | ||
60 | self.pylint_test[line.strip().split(' ',1)[0]] = line.strip().split(' ',1)[1] | ||
61 | |||
62 | for issue in self.pylint_test: | ||
63 | if self.pylint_test[issue] not in self.pylint_pretest.values(): | ||
64 | self.fail('Errors in your Python code were encountered. Please check your code with a linter and resubmit', | ||
65 | data=[('Output', 'Please, fix the listed issues:'), ('', issue + ' ' + self.pylint_test[issue])]) | ||