summaryrefslogtreecommitdiffstats
path: root/meta/lib/patchtest
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/patchtest')
-rw-r--r--meta/lib/patchtest/README.md8
-rw-r--r--meta/lib/patchtest/mbox.py108
-rw-r--r--meta/lib/patchtest/patch.py62
-rw-r--r--meta/lib/patchtest/patchtest_parser.py (renamed from meta/lib/patchtest/data.py)10
-rw-r--r--meta/lib/patchtest/patchtest_patterns.py98
-rw-r--r--meta/lib/patchtest/repo.py63
-rw-r--r--meta/lib/patchtest/selftest/files/TestMbox.test_author_valid.1.fail57
-rw-r--r--meta/lib/patchtest/selftest/files/TestMbox.test_author_valid.1.pass56
-rw-r--r--meta/lib/patchtest/selftest/files/TestMbox.test_author_valid.2.fail56
-rw-r--r--meta/lib/patchtest/selftest/files/TestMbox.test_author_valid.2.pass56
-rw-r--r--meta/lib/patchtest/selftest/files/TestMbox.test_bugzilla_entry_format.fail73
-rw-r--r--meta/lib/patchtest/selftest/files/TestMbox.test_bugzilla_entry_format.pass78
-rw-r--r--meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_presence.fail68
-rw-r--r--meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_presence.pass72
-rw-r--r--meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_user_tags.fail65
-rw-r--r--meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_user_tags.pass66
-rw-r--r--meta/lib/patchtest/selftest/files/TestMbox.test_mbox_format.1.fail36
-rw-r--r--meta/lib/patchtest/selftest/files/TestMbox.test_mbox_format.2.fail35
-rw-r--r--meta/lib/patchtest/selftest/files/TestMbox.test_mbox_format.fail66
-rw-r--r--meta/lib/patchtest/selftest/files/TestMbox.test_mbox_format.pass79
-rw-r--r--meta/lib/patchtest/selftest/files/TestMbox.test_series_merge_on_head.1.skip2
-rw-r--r--meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_format.fail53
-rw-r--r--meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_format.pass53
-rw-r--r--meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_length.fail53
-rw-r--r--meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_length.pass53
-rw-r--r--meta/lib/patchtest/selftest/files/TestMbox.test_signed_off_by_presence.1.fail60
-rw-r--r--meta/lib/patchtest/selftest/files/TestMbox.test_signed_off_by_presence.2.fail62
-rw-r--r--meta/lib/patchtest/selftest/files/TestMbox.test_signed_off_by_presence.pass60
-rw-r--r--meta/lib/patchtest/selftest/files/TestMetadata.test_cve_check_ignore.fail25
-rw-r--r--meta/lib/patchtest/selftest/files/TestMetadata.test_cve_check_ignore.pass26
-rw-r--r--meta/lib/patchtest/selftest/files/TestMetadata.test_lic_files_chksum_modified_not_mentioned.fail23
-rw-r--r--meta/lib/patchtest/selftest/files/TestMetadata.test_lic_files_chksum_modified_not_mentioned.pass25
-rw-r--r--meta/lib/patchtest/selftest/files/TestMetadata.test_lic_files_chksum_presence.fail65
-rw-r--r--meta/lib/patchtest/selftest/files/TestMetadata.test_lic_files_chksum_presence.pass65
-rw-r--r--meta/lib/patchtest/selftest/files/TestMetadata.test_src_uri_left_files.fail23
-rw-r--r--meta/lib/patchtest/selftest/files/TestMetadata.test_src_uri_left_files.pass25
-rw-r--r--meta/lib/patchtest/selftest/files/TestMetadata.test_summary_presence.fail64
-rw-r--r--meta/lib/patchtest/selftest/files/TestMetadata.test_summary_presence.pass68
-rw-r--r--meta/lib/patchtest/selftest/files/TestPatch.test_cve_tag_format.fail57
-rw-r--r--meta/lib/patchtest/selftest/files/TestPatch.test_cve_tag_format.pass53
-rw-r--r--meta/lib/patchtest/selftest/files/TestPatch.test_signed_off_by_presence.fail60
-rw-r--r--meta/lib/patchtest/selftest/files/TestPatch.test_signed_off_by_presence.pass60
-rwxr-xr-xmeta/lib/patchtest/selftest/selftest2
-rw-r--r--meta/lib/patchtest/tests/base.py49
-rw-r--r--meta/lib/patchtest/tests/pyparsing/common.py26
-rw-r--r--meta/lib/patchtest/tests/pyparsing/parse_cve_tags.py18
-rw-r--r--meta/lib/patchtest/tests/pyparsing/parse_shortlog.py14
-rw-r--r--meta/lib/patchtest/tests/pyparsing/parse_signed_off_by.py22
-rw-r--r--meta/lib/patchtest/tests/pyparsing/parse_upstream_status.py24
-rw-r--r--meta/lib/patchtest/tests/test_mbox.py114
-rw-r--r--meta/lib/patchtest/tests/test_metadata.py107
-rw-r--r--meta/lib/patchtest/tests/test_patch.py100
-rw-r--r--meta/lib/patchtest/tests/test_python_pylint.py2
-rw-r--r--meta/lib/patchtest/utils.py61
54 files changed, 1511 insertions, 1275 deletions
diff --git a/meta/lib/patchtest/README.md b/meta/lib/patchtest/README.md
index f66613c0c1..27cc61c802 100644
--- a/meta/lib/patchtest/README.md
+++ b/meta/lib/patchtest/README.md
@@ -1,12 +1,12 @@
1# patchtest selftests for openembedded-core 1# patchtest selftests for openembedded-core
2 2
3This directory provides a test suite and selftest script for use with the 3This directory provides a test suite and selftest script for use with the
4patchtest repository: https://git.yoctoproject.org/patchtest/ 4patchtest repository: <https://git.yoctoproject.org/patchtest/>
5 5
6To setup for use: 6To setup for use:
7 7
81. Clone https://git.openembedded.org/openembedded-core (this repo) and https://git.openembedded.org/bitbake/ 81. Clone <https://git.openembedded.org/openembedded-core> (this repo) and <https://git.openembedded.org/bitbake/>
92. Clone https://git.yoctoproject.org/patchtest 92. Clone <https://git.yoctoproject.org/patchtest>
103. Install the necessary Python modules: in meta/lib/patchtest or the patchtest 103. Install the necessary Python modules: in meta/lib/patchtest or the patchtest
11 repo, do `pip install -r requirements.txt` 11 repo, do `pip install -r requirements.txt`
124. Add patchtest to PATH: `export PATH=/path/to/patchtest/repo:$PATH` 124. Add patchtest to PATH: `export PATH=/path/to/patchtest/repo:$PATH`
@@ -17,4 +17,4 @@ To setup for use:
177. Finally, run the selftest script: `./meta/lib/patchtest/selftest/selftest` 177. Finally, run the selftest script: `./meta/lib/patchtest/selftest/selftest`
18 18
19For more information on using patchtest, see the patchtest repo at 19For more information on using patchtest, see the patchtest repo at
20https://git.yoctoproject.org/patchtest/. 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
13import email
14import re
15
16# From: https://stackoverflow.com/questions/59681461/read-a-big-mbox-file-with-python
17class 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
43class 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
53class 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/patch.py b/meta/lib/patchtest/patch.py
deleted file mode 100644
index baf6283873..0000000000
--- a/meta/lib/patchtest/patch.py
+++ /dev/null
@@ -1,62 +0,0 @@
1# ex:ts=4:sw=4:sts=4:et
2# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
3#
4# patchtestpatch: PatchTestPatch class which abstracts a patch file
5#
6# Copyright (C) 2016 Intel Corporation
7#
8# SPDX-License-Identifier: GPL-2.0-only
9#
10
11import logging
12import utils
13
14logger = logging.getLogger('patchtest')
15
16class PatchTestPatch(object):
17 MERGE_STATUS_INVALID = 'INVALID'
18 MERGE_STATUS_NOT_MERGED = 'NOTMERGED'
19 MERGE_STATUS_MERGED_SUCCESSFULL = 'PASS'
20 MERGE_STATUS_MERGED_FAIL = 'FAIL'
21 MERGE_STATUS = (MERGE_STATUS_INVALID,
22 MERGE_STATUS_NOT_MERGED,
23 MERGE_STATUS_MERGED_SUCCESSFULL,
24 MERGE_STATUS_MERGED_FAIL)
25
26 def __init__(self, path, forcereload=False):
27 self._path = path
28 self._forcereload = forcereload
29
30 self._contents = None
31 self._branch = None
32 self._merge_status = PatchTestPatch.MERGE_STATUS_NOT_MERGED
33
34 @property
35 def contents(self):
36 if self._forcereload or (not self._contents):
37 logger.debug('Reading %s contents' % self._path)
38 try:
39 with open(self._path, newline='') as _f:
40 self._contents = _f.read()
41 except IOError:
42 logger.warn("Reading the mbox %s failed" % self.resource)
43 return self._contents
44
45 @property
46 def path(self):
47 return self._path
48
49 @property
50 def branch(self):
51 if not self._branch:
52 self._branch = utils.get_branch(self._path)
53 return self._branch
54
55 def setmergestatus(self, status):
56 self._merge_status = status
57
58 def getmergestatus(self):
59 return self._merge_status
60
61 merge_status = property(getmergestatus, setmergestatus)
62
diff --git a/meta/lib/patchtest/data.py b/meta/lib/patchtest/patchtest_parser.py
index 356259921d..2a11cb76c2 100644
--- a/meta/lib/patchtest/data.py
+++ b/meta/lib/patchtest/patchtest_parser.py
@@ -15,19 +15,11 @@
15 15
16import os 16import os
17import argparse 17import argparse
18import collections
19import logging
20
21logger=logging.getLogger('patchtest')
22info=logger.info
23 18
24default_testdir = os.path.abspath(os.path.dirname(__file__) + "/tests") 19default_testdir = os.path.abspath(os.path.dirname(__file__) + "/tests")
25default_repodir = os.path.abspath(os.path.dirname(__file__) + "/../../..") 20default_repodir = os.path.abspath(os.path.dirname(__file__) + "/../../..")
26 21
27# Data store commonly used to share values between pre and post-merge tests 22class PatchtestParser(object):
28PatchTestDataStore = collections.defaultdict(str)
29
30class PatchTestInput(object):
31 """Abstract the patchtest argument parser""" 23 """Abstract the patchtest argument parser"""
32 24
33 @classmethod 25 @classmethod
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
7import pyparsing
8import re
9
10# general
11colon = pyparsing.Literal(":")
12line_start = pyparsing.LineStart()
13line_end = pyparsing.LineEnd()
14lessthan = pyparsing.Literal("<")
15greaterthan = pyparsing.Literal(">")
16inappropriate = pyparsing.CaselessLiteral("Inappropriate")
17submitted = pyparsing.CaselessLiteral("Submitted")
18
19# word related
20nestexpr = pyparsing.nestedExpr(opener='[', closer=']')
21inappropriateinfo = pyparsing.Literal("Inappropriate") + nestexpr
22submittedinfo = pyparsing.Literal("Submitted") + nestexpr
23word = pyparsing.Word(pyparsing.alphas)
24worddot = pyparsing.Word(pyparsing.alphas+".")
25
26# metadata
27
28metadata_lic = 'LICENSE'
29invalid_license = 'PATCHTESTINVALID'
30metadata_chksum = 'LIC_FILES_CHKSUM'
31license_var = 'LICENSE'
32closed = 'CLOSED'
33lictag_re = pyparsing.AtLineStart("License-Update:")
34lic_chksum_added = pyparsing.AtLineStart("+" + metadata_chksum)
35lic_chksum_removed = pyparsing.AtLineStart("-" + metadata_chksum)
36add_mark = pyparsing.Regex('\\+ ')
37patch_max_line_length = 200
38metadata_src_uri = "SRC_URI"
39metadata_summary = "SUMMARY"
40cve_check_ignore_var = "CVE_CHECK_IGNORE"
41cve_status_var = "CVE_STATUS"
42endcommit_messages_regex = re.compile(
43 r"\(From \w+-\w+ rev:|(?<!\S)Signed-off-by|(?<!\S)---\n"
44)
45patchmetadata_regex = re.compile(
46 r"-{3} \S+|\+{3} \S+|@{2} -\d+,\d+ \+\d+,\d+ @{2} \S+"
47)
48
49# mbox
50auh_email = 'auh@yoctoproject.org'
51
52invalid_submitters = [pyparsing.Regex("^Upgrade Helper.+"),
53 pyparsing.Regex(auh_email),
54 pyparsing.Regex("uh@not\.set"),
55 pyparsing.Regex("\S+@example\.com")]
56
57mbox_bugzilla = pyparsing.Regex('\[\s?YOCTO.*\]')
58mbox_bugzilla_validation = pyparsing.Regex('\[(\s?YOCTO\s?#\s?(\d+)\s?,?)+\]')
59mbox_revert_shortlog_regex = pyparsing.Regex('Revert\s+".*"')
60mbox_shortlog_maxlength = 90
61# based on https://stackoverflow.com/questions/30281026/regex-parsing-github-usernames-javascript
62mbox_github_username = pyparsing.Regex('\B@([a-z0-9](?:-(?=[a-z0-9])|[a-z0-9]){0,38}(?<=[a-z0-9]))')
63
64# patch
65
66cve = pyparsing.Regex("CVE\-\d{4}\-\d+")
67cve_payload_tag = pyparsing.Regex("\+CVE:(\s+CVE\-\d{4}\-\d+)+")
68upstream_status_regex = pyparsing.AtLineStart("+" + "Upstream-Status")
69
70# shortlog
71
72shortlog_target = pyparsing.OneOrMore(pyparsing.Word(pyparsing.printables.replace(':','')))
73shortlog_summary = pyparsing.OneOrMore(pyparsing.Word(pyparsing.printables))
74shortlog = line_start + shortlog_target + colon + shortlog_summary + line_end
75
76# signed-off-bys
77
78email_pattern = pyparsing.Regex(r"(?P<user>[A-Za-z0-9._%+-]+)@(?P<hostname>[A-Za-z0-9.-]+)\.(?P<domain>[A-Za-z]{2,})")
79
80signed_off_by_prefix = pyparsing.Literal("Signed-off-by:")
81signed_off_by_name = pyparsing.Regex('\S+.*(?= <)')
82signed_off_by_email = lessthan + email_pattern + greaterthan
83signed_off_by = pyparsing.AtLineStart(signed_off_by_prefix + signed_off_by_name + signed_off_by_email)
84patch_signed_off_by = pyparsing.AtLineStart("+" + signed_off_by_prefix + signed_off_by_name + signed_off_by_email)
85
86# upstream-status
87
88upstream_status_literal_valid_status = ["Pending", "Backport", "Denied", "Inappropriate", "Submitted", "Inactive-Upstream"]
89upstream_status_nonliteral_valid_status = ["Pending", "Backport", "Denied", "Inappropriate [reason]", "Submitted [where]", "Inactive-Upstream [lastcommit: when (and/or) lastrelease: when]"]
90
91upstream_status_valid_status = pyparsing.Or(
92 [pyparsing.Literal(status) for status in upstream_status_literal_valid_status]
93)
94
95upstream_status_prefix = pyparsing.Literal("Upstream-Status")
96upstream_status = line_start + upstream_status_prefix + colon + upstream_status_valid_status
97upstream_status_inappropriate_info = line_start + upstream_status_prefix + colon + inappropriateinfo
98upstream_status_submitted_info = line_start + upstream_status_prefix + colon + submittedinfo
diff --git a/meta/lib/patchtest/repo.py b/meta/lib/patchtest/repo.py
index 5f361ac500..8ec8f68a0b 100644
--- a/meta/lib/patchtest/repo.py
+++ b/meta/lib/patchtest/repo.py
@@ -8,40 +8,27 @@
8# SPDX-License-Identifier: GPL-2.0-only 8# SPDX-License-Identifier: GPL-2.0-only
9# 9#
10 10
11import os
12import utils
13import logging
14import git 11import git
15from patch import PatchTestPatch 12import os
16 13import mbox
17logger = logging.getLogger('patchtest')
18info=logger.info
19 14
20class PatchTestRepo(object): 15class PatchTestRepo(object):
21 16
22 # prefixes used for temporal branches/stashes 17 # prefixes used for temporal branches/stashes
23 prefix = 'patchtest' 18 prefix = 'patchtest'
24 19
25
26 def __init__(self, patch, repodir, commit=None, branch=None): 20 def __init__(self, patch, repodir, commit=None, branch=None):
27 self._repodir = repodir 21 self.repodir = repodir
28 self._repo = git.Repo.init(repodir) 22 self.repo = git.Repo.init(repodir)
29 self._patch = PatchTestPatch(patch) 23 self.patch = mbox.PatchSeries(patch)
30 self._current_branch = self._repo.active_branch.name 24 self.current_branch = self.repo.active_branch.name
31 25
32 # targeted branch defined on the patch may be invalid, so make sure there 26 # targeted branch defined on the patch may be invalid, so make sure there
33 # is a corresponding remote branch 27 # is a corresponding remote branch
34 valid_patch_branch = None 28 valid_patch_branch = None
35 if self._patch.branch in self._repo.branches: 29 if self.patch.branch in self.repo.branches:
36 valid_patch_branch = self._patch.branch 30 valid_patch_branch = self.patch.branch
37 31
38 # Target Branch
39 # Priority (top has highest priority):
40 # 1. branch given at cmd line
41 # 2. branch given at the patch
42 # 3. current branch
43 self._branch = branch or valid_patch_branch or self._current_branch
44
45 # Target Commit 32 # Target Commit
46 # Priority (top has highest priority): 33 # Priority (top has highest priority):
47 # 1. commit given at cmd line 34 # 1. commit given at cmd line
@@ -57,7 +44,7 @@ class PatchTestRepo(object):
57 44
58 # create working branch. Use the '-B' flag so that we just 45 # create working branch. Use the '-B' flag so that we just
59 # check out the existing one if it's there 46 # check out the existing one if it's there
60 self._repo.git.execute(['git', 'checkout', '-B', self._workingbranch, self._commit]) 47 self.repo.git.execute(['git', 'checkout', '-B', self._workingbranch, self._commit])
61 48
62 self._patchmerged = False 49 self._patchmerged = False
63 50
@@ -65,35 +52,13 @@ class PatchTestRepo(object):
65 self._patchcanbemerged = True 52 self._patchcanbemerged = True
66 try: 53 try:
67 # Make sure to get the absolute path of the file 54 # Make sure to get the absolute path of the file
68 self._repo.git.execute(['git', 'apply', '--check', os.path.abspath(self._patch.path)], with_exceptions=True) 55 self.repo.git.execute(['git', 'apply', '--check', os.path.abspath(self.patch.path)], with_exceptions=True)
69 except git.exc.GitCommandError as ce: 56 except git.exc.GitCommandError as ce:
70 self._patchcanbemerged = False 57 self._patchcanbemerged = False
71 58
72 # for debugging purposes, print all repo parameters
73 logger.debug("Parameters")
74 logger.debug("\tRepository : %s" % self._repodir)
75 logger.debug("\tTarget Commit : %s" % self._commit)
76 logger.debug("\tTarget Branch : %s" % self._branch)
77 logger.debug("\tWorking branch : %s" % self._workingbranch)
78 logger.debug("\tPatch : %s" % self._patch)
79
80 @property
81 def patch(self):
82 return self._patch.path
83
84 @property
85 def branch(self):
86 return self._branch
87
88 @property
89 def commit(self):
90 return self._commit
91
92 @property
93 def ismerged(self): 59 def ismerged(self):
94 return self._patchmerged 60 return self._patchmerged
95 61
96 @property
97 def canbemerged(self): 62 def canbemerged(self):
98 return self._patchcanbemerged 63 return self._patchcanbemerged
99 64
@@ -103,7 +68,7 @@ class PatchTestRepo(object):
103 return None 68 return None
104 69
105 try: 70 try:
106 return self._repo.rev_parse(commit).hexsha 71 return self.repo.rev_parse(commit).hexsha
107 except Exception as e: 72 except Exception as e:
108 print(f"Couldn't find commit {commit} in repo") 73 print(f"Couldn't find commit {commit} in repo")
109 74
@@ -111,10 +76,10 @@ class PatchTestRepo(object):
111 76
112 def merge(self): 77 def merge(self):
113 if self._patchcanbemerged: 78 if self._patchcanbemerged:
114 self._repo.git.execute(['git', 'am', '--keep-cr', os.path.abspath(self._patch.path)]) 79 self.repo.git.execute(['git', 'am', '--keep-cr', os.path.abspath(self.patch.path)])
115 self._patchmerged = True 80 self._patchmerged = True
116 81
117 def clean(self): 82 def clean(self):
118 self._repo.git.execute(['git', 'checkout', self._current_branch]) 83 self.repo.git.execute(['git', 'checkout', self.current_branch])
119 self._repo.git.execute(['git', 'branch', '-D', self._workingbranch]) 84 self.repo.git.execute(['git', 'branch', '-D', self._workingbranch])
120 self._patchmerged = False 85 self._patchmerged = False
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
index 0c40cdc1b6..30c1bc4624 100644
--- a/meta/lib/patchtest/selftest/files/TestMbox.test_author_valid.1.fail
+++ b/meta/lib/patchtest/selftest/files/TestMbox.test_author_valid.1.fail
@@ -1,32 +1,43 @@
1From 1fbb446d1849b1208012cbdae5d85d228cdbe4a6 Mon Sep 17 00:00:00 2001 1From 04eb94a0134ef5eb5b5fd783b303104fbfcd8437 Mon Sep 17 00:00:00 2001
2From: First Last <first.last@example.com> 2From: First Last <first.last@example.com>
3Date: Tue, 29 Aug 2023 13:32:24 -0400 3Date: Fri, 31 May 2024 11:03:47 -0400
4Subject: [PATCH] selftest-hello: add a summary 4Subject: [PATCH] selftest-hello: add selftest-hello-extra
5 5
6This patch should fail the selftests because the author address is from the 6This should fail the test_author_valid test.
7invalid "example.com".
8 7
9Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> 8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
10--- 9---
11 .../recipes-test/selftest-hello/selftest-hello_1.0.bb | 3 ++- 10 .../selftest-hello-extra_1.0.bb | 21 +++++++++++++++++++
12 1 file changed, 2 insertions(+), 1 deletion(-) 11 1 file changed, 21 insertions(+)
12 create mode 100644 meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
13 13
14diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 14diff --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
15index 547587bef4..491f0a3df7 100644 15new file mode 100644
16--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 16index 00000000000..f3dec1b220c
17+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 17--- /dev/null
18@@ -1,3 +1,4 @@ 18+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
19+SUMMARY = "A cool sample" 19@@ -0,0 +1,21 @@
20 DESCRIPTION = "Simple helloworld application -- selftest variant" 20+SUMMARY = "This is an example summary"
21 SECTION = "examples" 21+DESCRIPTION = "Simple helloworld application -- selftest variant"
22 LICENSE = "MIT" 22+SECTION = "examples"
23@@ -16,4 +17,4 @@ do_install() { 23+LICENSE = "MIT"
24 install -m 0755 helloworld ${D}${bindir} 24+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
25 } 25+
26 26+SRC_URI = "file://helloworld.c"
27-BBCLASSEXTEND = "native nativesdk" 27+
28\ No newline at end of file 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+
29+BBCLASSEXTEND = "native nativesdk" 40+BBCLASSEXTEND = "native nativesdk"
30-- 41--
312.41.0 422.45.1
32 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
index cbb8ef2cef..6e82b08bc6 100644
--- a/meta/lib/patchtest/selftest/files/TestMbox.test_author_valid.1.pass
+++ b/meta/lib/patchtest/selftest/files/TestMbox.test_author_valid.1.pass
@@ -1,31 +1,43 @@
1From 1fbb446d1849b1208012cbdae5d85d228cdbe4a6 Mon Sep 17 00:00:00 2001 1From 04eb94a0134ef5eb5b5fd783b303104fbfcd8437 Mon Sep 17 00:00:00 2001
2From: First Last <first.last@address.com> 2From: First Last <first.last@address.com>
3Date: Tue, 29 Aug 2023 13:32:24 -0400 3Date: Fri, 31 May 2024 11:03:47 -0400
4Subject: [PATCH] selftest-hello: add a summary 4Subject: [PATCH] selftest-hello: add selftest-hello-extra
5 5
6This patch should pass the selftests because the author address is in a valid format. 6This should pass the test_author_valid test.
7 7
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> 8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9--- 9---
10 .../recipes-test/selftest-hello/selftest-hello_1.0.bb | 3 ++- 10 .../selftest-hello-extra_1.0.bb | 21 +++++++++++++++++++
11 1 file changed, 2 insertions(+), 1 deletion(-) 11 1 file changed, 21 insertions(+)
12 create mode 100644 meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
12 13
13diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 14diff --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
14index 547587bef4..491f0a3df7 100644 15new file mode 100644
15--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 16index 00000000000..f3dec1b220c
16+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 17--- /dev/null
17@@ -1,3 +1,4 @@ 18+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
18+SUMMARY = "A cool sample" 19@@ -0,0 +1,21 @@
19 DESCRIPTION = "Simple helloworld application -- selftest variant" 20+SUMMARY = "This is an example summary"
20 SECTION = "examples" 21+DESCRIPTION = "Simple helloworld application -- selftest variant"
21 LICENSE = "MIT" 22+SECTION = "examples"
22@@ -16,4 +17,4 @@ do_install() { 23+LICENSE = "MIT"
23 install -m 0755 helloworld ${D}${bindir} 24+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
24 } 25+
25 26+SRC_URI = "file://helloworld.c"
26-BBCLASSEXTEND = "native nativesdk" 27+
27\ No newline at end of file 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+
28+BBCLASSEXTEND = "native nativesdk" 40+BBCLASSEXTEND = "native nativesdk"
29-- 41--
302.41.0 422.45.1
31 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
index 3e2b81bca1..745a8f45d9 100644
--- a/meta/lib/patchtest/selftest/files/TestMbox.test_author_valid.2.fail
+++ b/meta/lib/patchtest/selftest/files/TestMbox.test_author_valid.2.fail
@@ -1,31 +1,43 @@
1From 1fbb446d1849b1208012cbdae5d85d228cdbe4a6 Mon Sep 17 00:00:00 2001 1From 04eb94a0134ef5eb5b5fd783b303104fbfcd8437 Mon Sep 17 00:00:00 2001
2From: Upgrade Helper <auh@auh.yoctoproject.org> 2From: Upgrade Helper <auh@auh.yoctoproject.org>
3Date: Tue, 29 Aug 2023 13:32:24 -0400 3Date: Fri, 31 May 2024 11:03:47 -0400
4Subject: [PATCH] selftest-hello: add a summary 4Subject: [PATCH] selftest-hello: add selftest-hello-extra
5 5
6This patch should fail the selftests because AUH is an invalid sender. 6This should fail the test_author_valid test.
7 7
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> 8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9--- 9---
10 .../recipes-test/selftest-hello/selftest-hello_1.0.bb | 3 ++- 10 .../selftest-hello-extra_1.0.bb | 21 +++++++++++++++++++
11 1 file changed, 2 insertions(+), 1 deletion(-) 11 1 file changed, 21 insertions(+)
12 create mode 100644 meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
12 13
13diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 14diff --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
14index 547587bef4..491f0a3df7 100644 15new file mode 100644
15--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 16index 00000000000..f3dec1b220c
16+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 17--- /dev/null
17@@ -1,3 +1,4 @@ 18+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
18+SUMMARY = "A cool sample" 19@@ -0,0 +1,21 @@
19 DESCRIPTION = "Simple helloworld application -- selftest variant" 20+SUMMARY = "This is an example summary"
20 SECTION = "examples" 21+DESCRIPTION = "Simple helloworld application -- selftest variant"
21 LICENSE = "MIT" 22+SECTION = "examples"
22@@ -16,4 +17,4 @@ do_install() { 23+LICENSE = "MIT"
23 install -m 0755 helloworld ${D}${bindir} 24+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
24 } 25+
25 26+SRC_URI = "file://helloworld.c"
26-BBCLASSEXTEND = "native nativesdk" 27+
27\ No newline at end of file 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+
28+BBCLASSEXTEND = "native nativesdk" 40+BBCLASSEXTEND = "native nativesdk"
29-- 41--
302.41.0 422.45.1
31 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
index f84e1265a7..56cb77fa69 100644
--- a/meta/lib/patchtest/selftest/files/TestMbox.test_author_valid.2.pass
+++ b/meta/lib/patchtest/selftest/files/TestMbox.test_author_valid.2.pass
@@ -1,31 +1,43 @@
1From 1fbb446d1849b1208012cbdae5d85d228cdbe4a6 Mon Sep 17 00:00:00 2001 1From 04eb94a0134ef5eb5b5fd783b303104fbfcd8437 Mon Sep 17 00:00:00 2001
2From: First Last <averylongemailaddressthatishardtoread.from@address.com> 2From: First Last <averylongemailaddressthatishardtoread.from@address.com>
3Date: Tue, 29 Aug 2023 13:32:24 -0400 3Date: Fri, 31 May 2024 11:03:47 -0400
4Subject: [PATCH] selftest-hello: add a summary 4Subject: [PATCH] selftest-hello: add selftest-hello-extra
5 5
6This patch should pass the selftests because the author address is in a valid format. 6This should pass the test_author_valid test.
7 7
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> 8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9--- 9---
10 .../recipes-test/selftest-hello/selftest-hello_1.0.bb | 3 ++- 10 .../selftest-hello-extra_1.0.bb | 21 +++++++++++++++++++
11 1 file changed, 2 insertions(+), 1 deletion(-) 11 1 file changed, 21 insertions(+)
12 create mode 100644 meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
12 13
13diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 14diff --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
14index 547587bef4..491f0a3df7 100644 15new file mode 100644
15--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 16index 00000000000..f3dec1b220c
16+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 17--- /dev/null
17@@ -1,3 +1,4 @@ 18+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
18+SUMMARY = "A cool sample" 19@@ -0,0 +1,21 @@
19 DESCRIPTION = "Simple helloworld application -- selftest variant" 20+SUMMARY = "This is an example summary"
20 SECTION = "examples" 21+DESCRIPTION = "Simple helloworld application -- selftest variant"
21 LICENSE = "MIT" 22+SECTION = "examples"
22@@ -16,4 +17,4 @@ do_install() { 23+LICENSE = "MIT"
23 install -m 0755 helloworld ${D}${bindir} 24+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
24 } 25+
25 26+SRC_URI = "file://helloworld.c"
26-BBCLASSEXTEND = "native nativesdk" 27+
27\ No newline at end of file 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+
28+BBCLASSEXTEND = "native nativesdk" 40+BBCLASSEXTEND = "native nativesdk"
29-- 41--
302.41.0 422.45.1
31 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
index 854d7eb8c7..6facb8c756 100644
--- a/meta/lib/patchtest/selftest/files/TestMbox.test_bugzilla_entry_format.fail
+++ b/meta/lib/patchtest/selftest/files/TestMbox.test_bugzilla_entry_format.fail
@@ -1,26 +1,67 @@
1From f06e14633723c1e78bc7a4b0fd0d3b79d09f0c68 Mon Sep 17 00:00:00 2001 1From c9519f11502d5bb5c143ed43b4c981b6a211bdf9 Mon Sep 17 00:00:00 2001
2From: name@somedomain.com <email@address.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Thu, 2 May 2024 10:21:45 -0400 3Date: Fri, 31 May 2024 09:54:50 -0400
4Subject: [PATCH] README.OE-Core.md: Add foo to header 4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5 5
6This test patch adds 'foo' to the header of README.OE-Core.md 6This should fail the test_bugzilla_entry_format test.
7 7
8[YOCTO 1234] 8[YOCTO 1234]
9CVE: CVE-1234-56789
9 10
10Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> 11Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
11--- 12---
12 README.OE-Core.md | 1 + 13 .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++
13 1 file changed, 1 insertion(+) 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
14 17
15diff --git a/README.OE-Core.md b/README.OE-Core.md 18diff --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
16index 687c58e410c..9d863891134 100644 19new file mode 100644
17--- a/README.OE-Core.md 20index 00000000000..8a4f9329303
18+++ b/README.OE-Core.md 21--- /dev/null
19@@ -1,3 +1,4 @@ 22+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
20+**** FOO **** 23@@ -0,0 +1,26 @@
21 OpenEmbedded-Core 24+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
22 ================= 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+}
50diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
51index 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"
23 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}"
24-- 65--
252.44.0 662.45.1
26 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
index 2648b03364..2f35458b4f 100644
--- a/meta/lib/patchtest/selftest/files/TestMbox.test_bugzilla_entry_format.pass
+++ b/meta/lib/patchtest/selftest/files/TestMbox.test_bugzilla_entry_format.pass
@@ -1,25 +1,67 @@
1From fdfd605e565d874502522c4b70b786c8c5aa0bad Mon Sep 17 00:00:00 2001 1From c9519f11502d5bb5c143ed43b4c981b6a211bdf9 Mon Sep 17 00:00:00 2001
2From: name@somedomain.com <email@address.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Fri, 17 Feb 2017 16:29:21 -0600 3Date: Fri, 31 May 2024 09:54:50 -0400
4Subject: [PATCH] README: adds 'foo' to the header 4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5 5
6This test patch adds 'foo' to the header 6This should pass the test_bugzilla_entry_format test.
7 7
8[YOCTO #1234] 8[YOCTO #1234]
9CVE: CVE-1234-56789
9 10
10Signed-off-by: Daniela Plascencia <daniela.plascencia@linux.intel.com> 11Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
11--- 12---
12 README | 1 + 13 .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++
13 1 file changed, 1 insertion(+) 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
14 17
15diff --git a/README b/README 18diff --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
16index 521916cd4f..cdf29dcea3 100644 19new file mode 100644
17--- a/README 20index 00000000000..8a4f9329303
18+++ b/README 21--- /dev/null
19@@ -1,3 +1,4 @@ 22+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
20+**** FOO **** 23@@ -0,0 +1,26 @@
21 OpenEmbedded-Core 24+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
22 ================= 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+}
50diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
51index 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--
662.45.1
23 67
24--
252.11.0
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
index 93ca0f9119..6f4e61c0da 100644
--- a/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_presence.fail
+++ b/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_presence.fail
@@ -1,22 +1,62 @@
1From 0a52a62c9430c05d22cb7f46380488f2280b69bb Mon Sep 17 00:00:00 2001 1From c9519f11502d5bb5c143ed43b4c981b6a211bdf9 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Fri, 1 Sep 2023 08:56:14 -0400 3Date: Fri, 31 May 2024 09:54:50 -0400
4Subject: [PATCH] README.OE-Core.md: add foo 4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5 5
6Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> 6Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
7--- 7---
8 README.OE-Core.md | 1 + 8 .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++
9 1 file changed, 1 insertion(+) 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
10 12
11diff --git a/README.OE-Core.md b/README.OE-Core.md 13diff --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
12index 2f2127fb03..48464252c8 100644 14new file mode 100644
13--- a/README.OE-Core.md 15index 00000000000..8a4f9329303
14+++ b/README.OE-Core.md 16--- /dev/null
15@@ -1,3 +1,4 @@ 17+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
16+** FOO ** 18@@ -0,0 +1,26 @@
17 OpenEmbedded-Core 19+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
18 ================= 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+}
45diff --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
46index 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"
19 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}"
20-- 60--
212.41.0 612.45.1
22 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
index 5e3dcbd58b..3fbc23fd00 100644
--- a/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_presence.pass
+++ b/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_presence.pass
@@ -1,24 +1,66 @@
1From 0a52a62c9430c05d22cb7f46380488f2280b69bb Mon Sep 17 00:00:00 2001 1From c9519f11502d5bb5c143ed43b4c981b6a211bdf9 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Fri, 1 Sep 2023 08:56:14 -0400 3Date: Fri, 31 May 2024 09:54:50 -0400
4Subject: [PATCH] README.OE-Core.md: add foo 4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5 5
6This is a commit message 6This should pass the test_commit_message_presence test.
7
8CVE: CVE-1234-56789
7 9
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> 10Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9--- 11---
10 README.OE-Core.md | 1 + 12 .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++
11 1 file changed, 1 insertion(+) 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
12 16
13diff --git a/README.OE-Core.md b/README.OE-Core.md 17diff --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
14index 2f2127fb03..48464252c8 100644 18new file mode 100644
15--- a/README.OE-Core.md 19index 00000000000..8a4f9329303
16+++ b/README.OE-Core.md 20--- /dev/null
17@@ -1,3 +1,4 @@ 21+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
18+** FOO ** 22@@ -0,0 +1,26 @@
19 OpenEmbedded-Core 23+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
20 ================= 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+}
49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
50index 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+ "
21 61
62 S = "${WORKDIR}/sources"
63 UNPACKDIR = "${S}"
22-- 64--
232.41.0 652.45.1
24 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 @@
1From c9519f11502d5bb5c143ed43b4c981b6a211bdf9 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Fri, 31 May 2024 09:54:50 -0400
4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5
6This should fail the test_commit_message_user_tags test because of this
7string: @teststring
8
9Signed-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
16diff --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
17new file mode 100644
18index 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+}
48diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
49index 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--
642.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 @@
1From c9519f11502d5bb5c143ed43b4c981b6a211bdf9 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Fri, 31 May 2024 09:54:50 -0400
4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5
6This should pass the test_commit_message_user_tags test.
7
8CVE: CVE-1234-56789
9
10Signed-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
17diff --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
18new file mode 100644
19index 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+}
49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
50index 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--
652.45.1
66
diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_mbox_format.1.fail b/meta/lib/patchtest/selftest/files/TestMbox.test_mbox_format.1.fail
deleted file mode 100644
index 9cc4aab38a..0000000000
--- a/meta/lib/patchtest/selftest/files/TestMbox.test_mbox_format.1.fail
+++ /dev/null
@@ -1,36 +0,0 @@
1From d12db4cfa913b0e7a4b5bd858d3019acc53ce426 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Wed, 30 Aug 2023 12:15:00 -0400
4Subject: [PATCH] selftest-hello: upgrade 1.0 -> 1.1
5
6This test should fail the mbox formatting test and the merge on head
7test.
8
9Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
10---
11 .../{selftest-hello_1.0.bb => selftest-hello_1.1.bb} | 3 ++-
12 1 file changed, 2 insertions(+), 1 deletion(-)
13 rename meta-selftest/recipes-test/selftest-hello/{selftest-hello_1.0.bb => selftest-hello_1.1.bb} (88%)
14
15diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb
16similarity index 88%
17rename from meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
18rename to meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb
19index 547587bef4..acc388ec2c 100644
20--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
21+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb
22@@ -1,3 +1,4 @@
23%+SUMMARY = "Hello!"
24 DESCRIPTION = "Simple helloworld application -- selftest variant"
25 SECTION = "examples"
26 LICENSE = "MIT"
27@@ -16,4 +17,4 @@ do_install() {
28 install -m 0755 helloworld ${D}${bindir}
29 }
30
31-BBCLASSEXTEND = "native nativesdk"
32\ No newline at end of file
33+BBCLASSEXTEND = "native nativesdk"
34--
352.41.0
36
diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_mbox_format.2.fail b/meta/lib/patchtest/selftest/files/TestMbox.test_mbox_format.2.fail
deleted file mode 100644
index eca1c60085..0000000000
--- a/meta/lib/patchtest/selftest/files/TestMbox.test_mbox_format.2.fail
+++ /dev/null
@@ -1,35 +0,0 @@
1From d12db4cfa913b0e7a4b5bd858d3019acc53ce426 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Wed, 30 Aug 2023 12:15:00 -0400
4Subject: [PATCH] selftest-hello: upgrade 1.0 -> 1.1
5
6This test should fail the merge-on-head and mbox formatting tests.
7
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9---
10 .../{selftest-hello_1.0.bb => selftest-hello_1.1.bb} | 3 ++-
11 1 file changed, 2 insertions(+), 1 deletion(-)
12 rename meta-selftest/recipes-test/selftest-hello/{selftest-hello_1.0.bb => selftest-hello_1.1.bb} (88%)
13
14diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb
15similarity index 88%
16rename from meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
17rename to meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb
18index 547587bef4..acc388ec2c 100644
19--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
20+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb
21@@ -1,3 +1,4 @@
22%+SUMMARY = "Hello!"
23 DESCRIPTION = "Simple helloworld application -- selftest variant"
24 SECTION = "examples"
25 LICENSE = "MIT"
26@@ -16,4 +17,4 @@ do_install() {
27 install -m 0755 helloworld ${D}${bindir}
28 }
29
30-BBCLASSEXTEND = "native nativesdk"
31\ No newline at end of file
32+BBCLASSEXTEND = "native nativesdk"
33--
342.41.0
35
diff --git a/meta/lib/patchtest/selftest/files/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 @@
1From c9519f11502d5bb5c143ed43b4c981b6a211bdf9 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Fri, 31 May 2024 09:54:50 -0400
4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5
6This should fail the test_mbox_format test.
7
8CVE: CVE-1234-56789
9
10Signed-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
17diff --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
18new file mode 100644
19index 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+}
49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
50index 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--
652.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
index 33940adffc..f06ae11d04 100644
--- a/meta/lib/patchtest/selftest/files/TestMbox.test_mbox_format.pass
+++ b/meta/lib/patchtest/selftest/files/TestMbox.test_mbox_format.pass
@@ -1,33 +1,66 @@
1From d12db4cfa913b0e7a4b5bd858d3019acc53ce426 Mon Sep 17 00:00:00 2001 1From c9519f11502d5bb5c143ed43b4c981b6a211bdf9 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Wed, 30 Aug 2023 12:15:00 -0400 3Date: Fri, 31 May 2024 09:54:50 -0400
4Subject: [PATCH] selftest-hello: upgrade 1.0 -> 1.1 4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5
6This should pass the test_mbox_format test.
7
8CVE: CVE-1234-56789
5 9
6Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> 10Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
7--- 11---
8 .../{selftest-hello_1.0.bb => selftest-hello_1.1.bb} | 3 ++- 12 .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++
9 1 file changed, 2 insertions(+), 1 deletion(-) 13 .../selftest-hello/selftest-hello_1.0.bb | 4 ++-
10 rename meta-selftest/recipes-test/selftest-hello/{selftest-hello_1.0.bb => selftest-hello_1.1.bb} (88%) 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
11 16
12diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb 17diff --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
13similarity index 88% 18new file mode 100644
14rename from meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 19index 00000000000..8a4f9329303
15rename to meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb 20--- /dev/null
16index 547587bef4..acc388ec2c 100644 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+}
49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
50index 2dc352d479e..d937759f157 100644
17--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 51--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
18+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb 52+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
19@@ -1,3 +1,4 @@ 53@@ -3,7 +3,9 @@ SECTION = "examples"
20+SUMMARY = "Hello!"
21 DESCRIPTION = "Simple helloworld application -- selftest variant"
22 SECTION = "examples"
23 LICENSE = "MIT" 54 LICENSE = "MIT"
24@@ -16,4 +17,4 @@ do_install() { 55 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
25 install -m 0755 helloworld ${D}${bindir} 56
26 } 57-SRC_URI = "file://helloworld.c"
58+SRC_URI = "file://helloworld.c \
59+ file://0001-Fix-CVE-1234-56789.patch \
60+ "
27 61
28-BBCLASSEXTEND = "native nativesdk" 62 S = "${WORKDIR}/sources"
29\ No newline at end of file 63 UNPACKDIR = "${S}"
30+BBCLASSEXTEND = "native nativesdk"
31-- 64--
322.41.0 652.45.1
33 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
index 2a72457878..072ccc28c0 100644
--- 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
@@ -3,7 +3,7 @@ From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Wed, 30 Aug 2023 12:15:00 -0400 3Date: Wed, 30 Aug 2023 12:15:00 -0400
4Subject: [PATCH] selftest-hello: upgrade 1.0 -> 1.1 4Subject: [PATCH] selftest-hello: upgrade 1.0 -> 1.1
5 5
6This file should pass the test_series_merge_on_head test. 6This file should skip the test_series_merge_on_head test.
7 7
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> 8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9--- 9---
diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_format.fail b/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_format.fail
index cdbbc61b61..c5e4df2549 100644
--- a/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_format.fail
+++ b/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_format.fail
@@ -1,23 +1,25 @@
1From 35ccee3cee96fb29514475279248078d88907231 Mon Sep 17 00:00:00 2001 1From c9519f11502d5bb5c143ed43b4c981b6a211bdf9 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Tue, 29 Aug 2023 14:12:27 -0400 3Date: Fri, 31 May 2024 09:54:50 -0400
4Subject: [PATCH] selftest-hello% fix CVE-1234-56789 4Subject: [PATCH] selftest-hello% fix CVE-1234-56789
5 5
6This should fail the test_shortlog_format test.
7
6CVE: CVE-1234-56789 8CVE: CVE-1234-56789
7 9
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> 10Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9--- 11---
10 .../files/0001-Fix-CVE-1234-56789.patch | 27 +++++++++++++++++++ 12 .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++
11 .../selftest-hello/selftest-hello_1.0.bb | 6 +++-- 13 .../selftest-hello/selftest-hello_1.0.bb | 4 ++-
12 2 files changed, 31 insertions(+), 2 deletions(-) 14 2 files changed, 29 insertions(+), 1 deletion(-)
13 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch 15 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
14 16
15diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch 17diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
16new file mode 100644 18new file mode 100644
17index 0000000000..9219b8db62 19index 00000000000..8a4f9329303
18--- /dev/null 20--- /dev/null
19+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch 21+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
20@@ -0,0 +1,27 @@ 22@@ -0,0 +1,26 @@
21+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001 23+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
22+From: Trevor Gamblin <tgamblin@baylibre.com> 24+From: Trevor Gamblin <tgamblin@baylibre.com>
23+Date: Tue, 29 Aug 2023 14:08:20 -0400 25+Date: Tue, 29 Aug 2023 14:08:20 -0400
@@ -35,19 +37,17 @@ index 0000000000..9219b8db62
35+index 1788f38..83d7918 100644 37+index 1788f38..83d7918 100644
36+--- a/strlen.c 38+--- a/strlen.c
37++++ b/strlen.c 39++++ b/strlen.c
38+@@ -8,6 +8,7 @@ int main() {
39+
40+ printf("%d\n", str_len(string1));
41+ printf("%d\n", str_len(string2));
42++ printf("CVE FIXED!!!\n");
43+
44+ return 0;
45+ }
46+--
47+2.41.0
48+ 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+}
49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
50index 547587bef4..76975a6729 100644 50index 2dc352d479e..d937759f157 100644
51--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 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 52+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
53@@ -3,7 +3,9 @@ SECTION = "examples" 53@@ -3,7 +3,9 @@ SECTION = "examples"
@@ -56,18 +56,11 @@ index 547587bef4..76975a6729 100644
56 56
57-SRC_URI = "file://helloworld.c" 57-SRC_URI = "file://helloworld.c"
58+SRC_URI = "file://helloworld.c \ 58+SRC_URI = "file://helloworld.c \
59+ file://CVE-1234-56789.patch \ 59+ file://0001-Fix-CVE-1234-56789.patch \
60+ " 60+ "
61
62 S = "${WORKDIR}"
63
64@@ -16,4 +18,4 @@ do_install() {
65 install -m 0755 helloworld ${D}${bindir}
66 }
67 61
68-BBCLASSEXTEND = "native nativesdk" 62 S = "${WORKDIR}/sources"
69\ No newline at end of file 63 UNPACKDIR = "${S}"
70+BBCLASSEXTEND = "native nativesdk"
71-- 64--
722.41.0 652.45.1
73 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
index ef6017037c..4948e26afc 100644
--- a/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_format.pass
+++ b/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_format.pass
@@ -1,23 +1,25 @@
1From 35ccee3cee96fb29514475279248078d88907231 Mon Sep 17 00:00:00 2001 1From c9519f11502d5bb5c143ed43b4c981b6a211bdf9 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Tue, 29 Aug 2023 14:12:27 -0400 3Date: Fri, 31 May 2024 09:54:50 -0400
4Subject: [PATCH] selftest-hello: fix CVE-1234-56789 4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5 5
6This should pass the test_shortlog_format test.
7
6CVE: CVE-1234-56789 8CVE: CVE-1234-56789
7 9
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> 10Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9--- 11---
10 .../files/0001-Fix-CVE-1234-56789.patch | 27 +++++++++++++++++++ 12 .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++
11 .../selftest-hello/selftest-hello_1.0.bb | 6 +++-- 13 .../selftest-hello/selftest-hello_1.0.bb | 4 ++-
12 2 files changed, 31 insertions(+), 2 deletions(-) 14 2 files changed, 29 insertions(+), 1 deletion(-)
13 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch 15 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
14 16
15diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch 17diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
16new file mode 100644 18new file mode 100644
17index 0000000000..9219b8db62 19index 00000000000..8a4f9329303
18--- /dev/null 20--- /dev/null
19+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch 21+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
20@@ -0,0 +1,27 @@ 22@@ -0,0 +1,26 @@
21+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001 23+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
22+From: Trevor Gamblin <tgamblin@baylibre.com> 24+From: Trevor Gamblin <tgamblin@baylibre.com>
23+Date: Tue, 29 Aug 2023 14:08:20 -0400 25+Date: Tue, 29 Aug 2023 14:08:20 -0400
@@ -35,19 +37,17 @@ index 0000000000..9219b8db62
35+index 1788f38..83d7918 100644 37+index 1788f38..83d7918 100644
36+--- a/strlen.c 38+--- a/strlen.c
37++++ b/strlen.c 39++++ b/strlen.c
38+@@ -8,6 +8,7 @@ int main() {
39+
40+ printf("%d\n", str_len(string1));
41+ printf("%d\n", str_len(string2));
42++ printf("CVE FIXED!!!\n");
43+
44+ return 0;
45+ }
46+--
47+2.41.0
48+ 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+}
49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
50index 547587bef4..76975a6729 100644 50index 2dc352d479e..d937759f157 100644
51--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 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 52+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
53@@ -3,7 +3,9 @@ SECTION = "examples" 53@@ -3,7 +3,9 @@ SECTION = "examples"
@@ -56,18 +56,11 @@ index 547587bef4..76975a6729 100644
56 56
57-SRC_URI = "file://helloworld.c" 57-SRC_URI = "file://helloworld.c"
58+SRC_URI = "file://helloworld.c \ 58+SRC_URI = "file://helloworld.c \
59+ file://CVE-1234-56789.patch \ 59+ file://0001-Fix-CVE-1234-56789.patch \
60+ " 60+ "
61
62 S = "${WORKDIR}"
63
64@@ -16,4 +18,4 @@ do_install() {
65 install -m 0755 helloworld ${D}${bindir}
66 }
67 61
68-BBCLASSEXTEND = "native nativesdk" 62 S = "${WORKDIR}/sources"
69\ No newline at end of file 63 UNPACKDIR = "${S}"
70+BBCLASSEXTEND = "native nativesdk"
71-- 64--
722.41.0 652.45.1
73 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
index 629e78540b..4ed1242821 100644
--- a/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_length.fail
+++ b/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_length.fail
@@ -1,23 +1,25 @@
1From 35ccee3cee96fb29514475279248078d88907231 Mon Sep 17 00:00:00 2001 1From c9519f11502d5bb5c143ed43b4c981b6a211bdf9 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Tue, 29 Aug 2023 14:12:27 -0400 3Date: Fri, 31 May 2024 09:54:50 -0400
4Subject: [PATCH] selftest-hello: this is a very long commit shortlog with way too many words included in it to pass the test 4Subject: [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
6This should fail the test_shortlong_length test.
5 7
6CVE: CVE-1234-56789 8CVE: CVE-1234-56789
7 9
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> 10Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9--- 11---
10 .../files/0001-Fix-CVE-1234-56789.patch | 27 +++++++++++++++++++ 12 .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++
11 .../selftest-hello/selftest-hello_1.0.bb | 6 +++-- 13 .../selftest-hello/selftest-hello_1.0.bb | 4 ++-
12 2 files changed, 31 insertions(+), 2 deletions(-) 14 2 files changed, 29 insertions(+), 1 deletion(-)
13 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch 15 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
14 16
15diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch 17diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
16new file mode 100644 18new file mode 100644
17index 0000000000..9219b8db62 19index 00000000000..8a4f9329303
18--- /dev/null 20--- /dev/null
19+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch 21+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
20@@ -0,0 +1,27 @@ 22@@ -0,0 +1,26 @@
21+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001 23+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
22+From: Trevor Gamblin <tgamblin@baylibre.com> 24+From: Trevor Gamblin <tgamblin@baylibre.com>
23+Date: Tue, 29 Aug 2023 14:08:20 -0400 25+Date: Tue, 29 Aug 2023 14:08:20 -0400
@@ -35,19 +37,17 @@ index 0000000000..9219b8db62
35+index 1788f38..83d7918 100644 37+index 1788f38..83d7918 100644
36+--- a/strlen.c 38+--- a/strlen.c
37++++ b/strlen.c 39++++ b/strlen.c
38+@@ -8,6 +8,7 @@ int main() {
39+
40+ printf("%d\n", str_len(string1));
41+ printf("%d\n", str_len(string2));
42++ printf("CVE FIXED!!!\n");
43+
44+ return 0;
45+ }
46+--
47+2.41.0
48+ 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+}
49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
50index 547587bef4..76975a6729 100644 50index 2dc352d479e..d937759f157 100644
51--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 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 52+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
53@@ -3,7 +3,9 @@ SECTION = "examples" 53@@ -3,7 +3,9 @@ SECTION = "examples"
@@ -57,17 +57,10 @@ index 547587bef4..76975a6729 100644
57-SRC_URI = "file://helloworld.c" 57-SRC_URI = "file://helloworld.c"
58+SRC_URI = "file://helloworld.c \ 58+SRC_URI = "file://helloworld.c \
59+ file://0001-Fix-CVE-1234-56789.patch \ 59+ file://0001-Fix-CVE-1234-56789.patch \
60+ " 60+ "
61
62 S = "${WORKDIR}"
63
64@@ -16,4 +18,4 @@ do_install() {
65 install -m 0755 helloworld ${D}${bindir}
66 }
67 61
68-BBCLASSEXTEND = "native nativesdk" 62 S = "${WORKDIR}/sources"
69\ No newline at end of file 63 UNPACKDIR = "${S}"
70+BBCLASSEXTEND = "native nativesdk"
71-- 64--
722.41.0 652.45.1
73 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
index ef6017037c..ef5066a650 100644
--- a/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_length.pass
+++ b/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_length.pass
@@ -1,23 +1,25 @@
1From 35ccee3cee96fb29514475279248078d88907231 Mon Sep 17 00:00:00 2001 1From c9519f11502d5bb5c143ed43b4c981b6a211bdf9 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Tue, 29 Aug 2023 14:12:27 -0400 3Date: Fri, 31 May 2024 09:54:50 -0400
4Subject: [PATCH] selftest-hello: fix CVE-1234-56789 4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5 5
6This should pass the test_shortlog_length test.
7
6CVE: CVE-1234-56789 8CVE: CVE-1234-56789
7 9
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> 10Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9--- 11---
10 .../files/0001-Fix-CVE-1234-56789.patch | 27 +++++++++++++++++++ 12 .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++
11 .../selftest-hello/selftest-hello_1.0.bb | 6 +++-- 13 .../selftest-hello/selftest-hello_1.0.bb | 4 ++-
12 2 files changed, 31 insertions(+), 2 deletions(-) 14 2 files changed, 29 insertions(+), 1 deletion(-)
13 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch 15 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
14 16
15diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch 17diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
16new file mode 100644 18new file mode 100644
17index 0000000000..9219b8db62 19index 00000000000..8a4f9329303
18--- /dev/null 20--- /dev/null
19+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch 21+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
20@@ -0,0 +1,27 @@ 22@@ -0,0 +1,26 @@
21+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001 23+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
22+From: Trevor Gamblin <tgamblin@baylibre.com> 24+From: Trevor Gamblin <tgamblin@baylibre.com>
23+Date: Tue, 29 Aug 2023 14:08:20 -0400 25+Date: Tue, 29 Aug 2023 14:08:20 -0400
@@ -35,19 +37,17 @@ index 0000000000..9219b8db62
35+index 1788f38..83d7918 100644 37+index 1788f38..83d7918 100644
36+--- a/strlen.c 38+--- a/strlen.c
37++++ b/strlen.c 39++++ b/strlen.c
38+@@ -8,6 +8,7 @@ int main() {
39+
40+ printf("%d\n", str_len(string1));
41+ printf("%d\n", str_len(string2));
42++ printf("CVE FIXED!!!\n");
43+
44+ return 0;
45+ }
46+--
47+2.41.0
48+ 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+}
49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
50index 547587bef4..76975a6729 100644 50index 2dc352d479e..d937759f157 100644
51--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 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 52+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
53@@ -3,7 +3,9 @@ SECTION = "examples" 53@@ -3,7 +3,9 @@ SECTION = "examples"
@@ -56,18 +56,11 @@ index 547587bef4..76975a6729 100644
56 56
57-SRC_URI = "file://helloworld.c" 57-SRC_URI = "file://helloworld.c"
58+SRC_URI = "file://helloworld.c \ 58+SRC_URI = "file://helloworld.c \
59+ file://CVE-1234-56789.patch \ 59+ file://0001-Fix-CVE-1234-56789.patch \
60+ " 60+ "
61
62 S = "${WORKDIR}"
63
64@@ -16,4 +18,4 @@ do_install() {
65 install -m 0755 helloworld ${D}${bindir}
66 }
67 61
68-BBCLASSEXTEND = "native nativesdk" 62 S = "${WORKDIR}/sources"
69\ No newline at end of file 63 UNPACKDIR = "${S}"
70+BBCLASSEXTEND = "native nativesdk"
71-- 64--
722.41.0 652.45.1
73 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
index 35d92aeed7..4ede7271ee 100644
--- 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
@@ -1,22 +1,24 @@
1From 14d72f6973270f78455a8628143f2cff90e8f41e Mon Sep 17 00:00:00 2001 1From c9519f11502d5bb5c143ed43b4c981b6a211bdf9 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Tue, 29 Aug 2023 14:12:27 -0400 3Date: Fri, 31 May 2024 09:54:50 -0400
4Subject: [PATCH] selftest-hello: fix CVE-1234-56789 4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5 5
6This should fail the test_signed_off_by_presence test.
7
6CVE: CVE-1234-56789 8CVE: CVE-1234-56789
7 9
8--- 10---
9 .../selftest-hello/files/CVE-1234-56789.patch | 27 +++++++++++++++++++ 11 .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++
10 .../selftest-hello/selftest-hello_1.0.bb | 6 +++-- 12 .../selftest-hello/selftest-hello_1.0.bb | 4 ++-
11 2 files changed, 31 insertions(+), 2 deletions(-) 13 2 files changed, 29 insertions(+), 1 deletion(-)
12 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch 14 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
13 15
14diff --git a/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch 16diff --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
15new file mode 100644 17new file mode 100644
16index 0000000000..869cfb6fe5 18index 00000000000..8a4f9329303
17--- /dev/null 19--- /dev/null
18+++ b/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch 20+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
19@@ -0,0 +1,27 @@ 21@@ -0,0 +1,26 @@
20+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001 22+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
21+From: Trevor Gamblin <tgamblin@baylibre.com> 23+From: Trevor Gamblin <tgamblin@baylibre.com>
22+Date: Tue, 29 Aug 2023 14:08:20 -0400 24+Date: Tue, 29 Aug 2023 14:08:20 -0400
@@ -34,18 +36,17 @@ index 0000000000..869cfb6fe5
34+index 1788f38..83d7918 100644 36+index 1788f38..83d7918 100644
35+--- a/strlen.c 37+--- a/strlen.c
36++++ b/strlen.c 38++++ b/strlen.c
37+@@ -8,6 +8,7 @@ int main() { 39+
38+ 40+int main() {
39+ printf("%d\n", str_len(string1)); 41+
40+ printf("%d\n", str_len(string2)); 42+ printf("%d\n", str_len(string1));
41++ printf("CVE FIXED!!!\n"); 43+ printf("%d\n", str_len(string2));
42+ 44+ printf("CVE FIXED!!!\n");
43+ return 0; 45+
44+ } 46+ return 0;
45+-- 47+}
46+2.41.0
47diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 48diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
48index 547587bef4..76975a6729 100644 49index 2dc352d479e..d937759f157 100644
49--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 50--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
50+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 51+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
51@@ -3,7 +3,9 @@ SECTION = "examples" 52@@ -3,7 +3,9 @@ SECTION = "examples"
@@ -54,18 +55,11 @@ index 547587bef4..76975a6729 100644
54 55
55-SRC_URI = "file://helloworld.c" 56-SRC_URI = "file://helloworld.c"
56+SRC_URI = "file://helloworld.c \ 57+SRC_URI = "file://helloworld.c \
57+ file://CVE-1234-56789.patch \ 58+ file://0001-Fix-CVE-1234-56789.patch \
58+ " 59+ "
59
60 S = "${WORKDIR}"
61
62@@ -16,4 +18,4 @@ do_install() {
63 install -m 0755 helloworld ${D}${bindir}
64 }
65 60
66-BBCLASSEXTEND = "native nativesdk" 61 S = "${WORKDIR}/sources"
67\ No newline at end of file 62 UNPACKDIR = "${S}"
68+BBCLASSEXTEND = "native nativesdk"
69-- 63--
702.41.0 642.45.1
71 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
index 68f38dee06..f7c3f5145a 100644
--- 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
@@ -1,23 +1,25 @@
1From 14d72f6973270f78455a8628143f2cff90e8f41e Mon Sep 17 00:00:00 2001 1From c9519f11502d5bb5c143ed43b4c981b6a211bdf9 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Tue, 29 Aug 2023 14:12:27 -0400 3Date: Fri, 31 May 2024 09:54:50 -0400
4Subject: [PATCH] selftest-hello: fix CVE-1234-56789 4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5 5
6This should fail the test_signed_off_by_presence test.
7
6CVE: CVE-1234-56789 8CVE: CVE-1234-56789
7 9
8Approved: Trevor Gamblin <tgamblin@baylibre.com> 10Approved-of-by: Trevor Gamblin <tgamblin@baylibre.com>
9--- 11---
10 .../selftest-hello/files/CVE-1234-56789.patch | 27 +++++++++++++++++++ 12 .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++
11 .../selftest-hello/selftest-hello_1.0.bb | 6 +++-- 13 .../selftest-hello/selftest-hello_1.0.bb | 4 ++-
12 2 files changed, 31 insertions(+), 2 deletions(-) 14 2 files changed, 29 insertions(+), 1 deletion(-)
13 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch 15 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
14 16
15diff --git a/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch 17diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
16new file mode 100644 18new file mode 100644
17index 0000000000..869cfb6fe5 19index 00000000000..8a4f9329303
18--- /dev/null 20--- /dev/null
19+++ b/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch 21+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
20@@ -0,0 +1,27 @@ 22@@ -0,0 +1,26 @@
21+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001 23+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
22+From: Trevor Gamblin <tgamblin@baylibre.com> 24+From: Trevor Gamblin <tgamblin@baylibre.com>
23+Date: Tue, 29 Aug 2023 14:08:20 -0400 25+Date: Tue, 29 Aug 2023 14:08:20 -0400
@@ -35,18 +37,17 @@ index 0000000000..869cfb6fe5
35+index 1788f38..83d7918 100644 37+index 1788f38..83d7918 100644
36+--- a/strlen.c 38+--- a/strlen.c
37++++ b/strlen.c 39++++ b/strlen.c
38+@@ -8,6 +8,7 @@ int main() { 40+
39+ 41+int main() {
40+ printf("%d\n", str_len(string1)); 42+
41+ printf("%d\n", str_len(string2)); 43+ printf("%d\n", str_len(string1));
42++ printf("CVE FIXED!!!\n"); 44+ printf("%d\n", str_len(string2));
43+ 45+ printf("CVE FIXED!!!\n");
44+ return 0; 46+
45+ } 47+ return 0;
46+-- 48+}
47+2.41.0
48diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
49index 547587bef4..76975a6729 100644 50index 2dc352d479e..d937759f157 100644
50--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 51--- 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+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
52@@ -3,7 +3,9 @@ SECTION = "examples" 53@@ -3,7 +3,9 @@ SECTION = "examples"
@@ -55,18 +56,11 @@ index 547587bef4..76975a6729 100644
55 56
56-SRC_URI = "file://helloworld.c" 57-SRC_URI = "file://helloworld.c"
57+SRC_URI = "file://helloworld.c \ 58+SRC_URI = "file://helloworld.c \
58+ file://CVE-1234-56789.patch \ 59+ file://0001-Fix-CVE-1234-56789.patch \
59+ " 60+ "
60
61 S = "${WORKDIR}"
62
63@@ -16,4 +18,4 @@ do_install() {
64 install -m 0755 helloworld ${D}${bindir}
65 }
66 61
67-BBCLASSEXTEND = "native nativesdk" 62 S = "${WORKDIR}/sources"
68\ No newline at end of file 63 UNPACKDIR = "${S}"
69+BBCLASSEXTEND = "native nativesdk"
70-- 64--
712.41.0 652.45.1
72 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
index ea34c76f0d..2661c1416f 100644
--- 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
@@ -1,23 +1,25 @@
1From 14d72f6973270f78455a8628143f2cff90e8f41e Mon Sep 17 00:00:00 2001 1From c9519f11502d5bb5c143ed43b4c981b6a211bdf9 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Tue, 29 Aug 2023 14:12:27 -0400 3Date: Fri, 31 May 2024 09:54:50 -0400
4Subject: [PATCH] selftest-hello: fix CVE-1234-56789 4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5 5
6This should pass the test_signed_off_by_presence test.
7
6CVE: CVE-1234-56789 8CVE: CVE-1234-56789
7 9
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> 10Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9--- 11---
10 .../selftest-hello/files/CVE-1234-56789.patch | 27 +++++++++++++++++++ 12 .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++
11 .../selftest-hello/selftest-hello_1.0.bb | 6 +++-- 13 .../selftest-hello/selftest-hello_1.0.bb | 4 ++-
12 2 files changed, 31 insertions(+), 2 deletions(-) 14 2 files changed, 29 insertions(+), 1 deletion(-)
13 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch 15 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
14 16
15diff --git a/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch 17diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
16new file mode 100644 18new file mode 100644
17index 0000000000..869cfb6fe5 19index 00000000000..8a4f9329303
18--- /dev/null 20--- /dev/null
19+++ b/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch 21+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
20@@ -0,0 +1,27 @@ 22@@ -0,0 +1,26 @@
21+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001 23+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
22+From: Trevor Gamblin <tgamblin@baylibre.com> 24+From: Trevor Gamblin <tgamblin@baylibre.com>
23+Date: Tue, 29 Aug 2023 14:08:20 -0400 25+Date: Tue, 29 Aug 2023 14:08:20 -0400
@@ -35,18 +37,17 @@ index 0000000000..869cfb6fe5
35+index 1788f38..83d7918 100644 37+index 1788f38..83d7918 100644
36+--- a/strlen.c 38+--- a/strlen.c
37++++ b/strlen.c 39++++ b/strlen.c
38+@@ -8,6 +8,7 @@ int main() { 40+
39+ 41+int main() {
40+ printf("%d\n", str_len(string1)); 42+
41+ printf("%d\n", str_len(string2)); 43+ printf("%d\n", str_len(string1));
42++ printf("CVE FIXED!!!\n"); 44+ printf("%d\n", str_len(string2));
43+ 45+ printf("CVE FIXED!!!\n");
44+ return 0; 46+
45+ } 47+ return 0;
46+-- 48+}
47+2.41.0
48diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
49index 547587bef4..76975a6729 100644 50index 2dc352d479e..d937759f157 100644
50--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 51--- 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+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
52@@ -3,7 +3,9 @@ SECTION = "examples" 53@@ -3,7 +3,9 @@ SECTION = "examples"
@@ -55,18 +56,11 @@ index 547587bef4..76975a6729 100644
55 56
56-SRC_URI = "file://helloworld.c" 57-SRC_URI = "file://helloworld.c"
57+SRC_URI = "file://helloworld.c \ 58+SRC_URI = "file://helloworld.c \
58+ file://CVE-1234-56789.patch \ 59+ file://0001-Fix-CVE-1234-56789.patch \
59+ " 60+ "
60
61 S = "${WORKDIR}"
62
63@@ -16,4 +18,4 @@ do_install() {
64 install -m 0755 helloworld ${D}${bindir}
65 }
66 61
67-BBCLASSEXTEND = "native nativesdk" 62 S = "${WORKDIR}/sources"
68\ No newline at end of file 63 UNPACKDIR = "${S}"
69+BBCLASSEXTEND = "native nativesdk"
70-- 64--
712.41.0 652.45.1
72 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
index 3574463ade..dccafcd9bc 100644
--- a/meta/lib/patchtest/selftest/files/TestMetadata.test_cve_check_ignore.fail
+++ b/meta/lib/patchtest/selftest/files/TestMetadata.test_cve_check_ignore.fail
@@ -1,30 +1,25 @@
1From c4ca86b9cca3643097db0328e2f34dccffbba309 Mon Sep 17 00:00:00 2001 1From 60450eefbc2c438a37c5e08759d021b18f0df0a3 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Simone=20Wei=C3=9F?= <simone.p.weiss@posteo.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Sat, 10 Feb 2024 13:18:44 +0100 3Date: Fri, 31 May 2024 09:18:17 -0400
4Subject: [PATCH] selftest-hello: add CVE_CHECK_IGNORE 4Subject: [PATCH] selftest-hello: add CVE_CHECK_IGNORE
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8 5
9This should fail the test_cve_tag_format selftest. 6This should fail the test_cve_tag_format selftest.
10 7
11Signed-off-by: Simone Weiß <simone.p.weiss@posteo.com> 8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
12--- 9---
13 .../recipes-test/selftest-hello/selftest-hello_1.0.bb | 3 ++- 10 meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb | 1 +
14 1 file changed, 2 insertions(+), 1 deletion(-) 11 1 file changed, 1 insertion(+)
15 12
16diff --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 13diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
17index 547587bef4..3ef9b87c34 100644 14index 2dc352d479e..cc103de6e2e 100644
18--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 15--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
19+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 16+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
20@@ -16,4 +16,5 @@ do_install() { 17@@ -17,4 +17,5 @@ do_install() {
21 install -m 0755 helloworld ${D}${bindir} 18 install -m 0755 helloworld ${D}${bindir}
22 } 19 }
23 20
24-BBCLASSEXTEND = "native nativesdk"
25\ No newline at end of file
26+CVE_CHECK_IGNORE = "CVE-2024-12345" 21+CVE_CHECK_IGNORE = "CVE-2024-12345"
27+BBCLASSEXTEND = "native nativesdk" 22 BBCLASSEXTEND = "native nativesdk"
28-- 23--
292.39.2 242.45.1
30 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
index 10f942a6eb..93a6cc91fb 100644
--- a/meta/lib/patchtest/selftest/files/TestMetadata.test_cve_check_ignore.pass
+++ b/meta/lib/patchtest/selftest/files/TestMetadata.test_cve_check_ignore.pass
@@ -1,31 +1,25 @@
1From 7d4d3fee0c7111830ee9b2b049ae3ce265b26030 Mon Sep 17 00:00:00 2001 1From f91073242268d2b2c1a1a705e7fd585679f78a59 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Simone=20Wei=C3=9F?= <simone.p.weiss@posteo.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Sat, 10 Feb 2024 13:23:56 +0100 3Date: Fri, 31 May 2024 09:18:17 -0400
4Subject: [PATCH] selftest-hello: add CVE_STATUS 4Subject: [PATCH] selftest-hello: add CVE_STATUS
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8 5
9This should pass the test_cve_tag_format selftest. 6This should pass the test_cve_tag_format selftest.
10 7
11Signed-off-by: Simone Weiß <simone.p.weiss@posteo.com> 8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
12--- 9---
13 .../recipes-test/selftest-hello/selftest-hello_1.0.bb | 4 +++- 10 meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb | 1 +
14 1 file changed, 3 insertions(+), 1 deletion(-) 11 1 file changed, 1 insertion(+)
15 12
16diff --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 13diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
17index 547587bef4..9908b3b417 100644 14index 2dc352d479e..88c5c98608f 100644
18--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 15--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
19+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 16+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
20@@ -16,4 +16,6 @@ do_install() { 17@@ -17,4 +17,5 @@ do_install() {
21 install -m 0755 helloworld ${D}${bindir} 18 install -m 0755 helloworld ${D}${bindir}
22 } 19 }
23 20
24-BBCLASSEXTEND = "native nativesdk"
25\ No newline at end of file
26+CVE_STATUS[CVE-2024-12345] = "not-applicable-platform: Issue only applies on Windows" 21+CVE_STATUS[CVE-2024-12345] = "not-applicable-platform: Issue only applies on Windows"
27+ 22 BBCLASSEXTEND = "native nativesdk"
28+BBCLASSEXTEND = "native nativesdk"
29-- 23--
302.39.2 242.45.1
31 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
index ab6c52c374..61b3784e3c 100644
--- 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
@@ -1,19 +1,17 @@
1From f89919ea86d38404dd621521680a0162367bb965 Mon Sep 17 00:00:00 2001 1From 974c3a143bc67faaff9abcc0a06a3d5e692fc660 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Wed, 6 Sep 2023 09:09:27 -0400 3Date: Fri, 31 May 2024 11:51:15 -0400
4Subject: [PATCH] selftest-hello: update LIC_FILES_CHKSUM 4Subject: [PATCH] selftest-hello: update LIC_FILES_CHKSUM
5 5
6This test should fail the 6This should fail the test_lic_files_chksum_modified_not_mentioned test.
7test_metadata_lic_files_chksum.LicFilesChkSum.test_lic_files_chksum_modified_not_mentioned
8test.
9 7
10Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> 8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
11--- 9---
12 .../recipes-test/selftest-hello/selftest-hello_1.0.bb | 4 ++-- 10 meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb | 2 +-
13 1 file changed, 2 insertions(+), 2 deletions(-) 11 1 file changed, 1 insertion(+), 1 deletion(-)
14 12
15diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 13diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
16index 547587bef4..65dda40aba 100644 14index 2dc352d479e..356921db1dd 100644
17--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 15--- 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 16+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
19@@ -1,7 +1,7 @@ 17@@ -1,7 +1,7 @@
@@ -25,13 +23,6 @@ index 547587bef4..65dda40aba 100644
25 23
26 SRC_URI = "file://helloworld.c" 24 SRC_URI = "file://helloworld.c"
27 25
28@@ -16,4 +16,4 @@ do_install() {
29 install -m 0755 helloworld ${D}${bindir}
30 }
31
32-BBCLASSEXTEND = "native nativesdk"
33\ No newline at end of file
34+BBCLASSEXTEND = "native nativesdk"
35-- 26--
362.41.0 272.45.1
37 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
index 99d9f144da..b7be1e8e55 100644
--- 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
@@ -1,21 +1,19 @@
1From f89919ea86d38404dd621521680a0162367bb965 Mon Sep 17 00:00:00 2001 1From 974c3a143bc67faaff9abcc0a06a3d5e692fc660 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Wed, 6 Sep 2023 09:09:27 -0400 3Date: Fri, 31 May 2024 11:51:15 -0400
4Subject: [PATCH] selftest-hello: update LIC_FILES_CHKSUM 4Subject: [PATCH] selftest-hello: update LIC_FILES_CHKSUM
5 5
6License-Update: Fix checksum 6This should pass the test_lic_files_chksum_modified_not_mentioned test.
7 7
8This test should pass the 8License-Update: Stuff happened!
9test_metadata_lic_files_chksum.LicFilesChkSum.test_lic_files_chksum_modified_not_mentioned
10test.
11 9
12Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> 10Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
13--- 11---
14 .../recipes-test/selftest-hello/selftest-hello_1.0.bb | 4 ++-- 12 meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb | 2 +-
15 1 file changed, 2 insertions(+), 2 deletions(-) 13 1 file changed, 1 insertion(+), 1 deletion(-)
16 14
17diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 15diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
18index 547587bef4..65dda40aba 100644 16index 2dc352d479e..356921db1dd 100644
19--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 17--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
20+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 18+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
21@@ -1,7 +1,7 @@ 19@@ -1,7 +1,7 @@
@@ -27,13 +25,6 @@ index 547587bef4..65dda40aba 100644
27 25
28 SRC_URI = "file://helloworld.c" 26 SRC_URI = "file://helloworld.c"
29 27
30@@ -16,4 +16,4 @@ do_install() {
31 install -m 0755 helloworld ${D}${bindir}
32 }
33
34-BBCLASSEXTEND = "native nativesdk"
35\ No newline at end of file
36+BBCLASSEXTEND = "native nativesdk"
37-- 28--
382.41.0 292.45.1
39 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
index e14d644bb2..a7a0b0bacb 100644
--- 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
@@ -1,53 +1,42 @@
1From 66430e7c6fbd5187b66560909a510e136fed91c0 Mon Sep 17 00:00:00 2001 1From 74bc209a4fbe4da2f57e153ccfff3d2241dada8d Mon Sep 17 00:00:00 2001
2From: Daniela Plascencia <daniela.plascencia@linux.intel.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Thu, 23 Feb 2017 10:34:27 -0600 3Date: Fri, 31 May 2024 11:03:47 -0400
4Subject: [PATCH] meta: adding hello-yocto recipe 4Subject: [PATCH] selftest-hello: add selftest-hello-extra
5 5
6This is a sample recipe 6This should fail the test_lic_files_chksum_presence test.
7 7
8Signed-off-by: Daniela Plascencia <daniela.plascencia@linux.intel.com> 8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9--- 9---
10 .../hello-world/hello-world/hello_world.c | 5 +++++ 10 .../selftest-hello-extra_1.0.bb | 20 +++++++++++++++++++
11 .../hello-world/hello-world_1.0.bb | 18 ++++++++++++++++++ 11 1 file changed, 20 insertions(+)
12 2 files changed, 23 insertions(+) 12 create mode 100644 meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
13 create mode 100644 meta/recipes-devtools/hello-world/hello-world/hello_world.c
14 create mode 100644 meta/recipes-devtools/hello-world/hello-world_1.0.bb
15 13
16diff --git a/meta/recipes-devtools/hello-world/hello-world/hello_world.c b/meta/recipes-devtools/hello-world/hello-world/hello_world.c 14diff --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
17new file mode 100644 15new file mode 100644
18index 0000000000..0d59f57d4c 16index 00000000000..875bcbef859
19--- /dev/null 17--- /dev/null
20+++ b/meta/recipes-devtools/hello-world/hello-world/hello_world.c 18+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
21@@ -0,0 +1,5 @@ 19@@ -0,0 +1,20 @@
22+#include <stdio.h> 20+SUMMARY = "This is an example summary"
23+ 21+DESCRIPTION = "Simple helloworld application -- selftest variant"
24+int main(){ 22+SECTION = "examples"
25+ printf("Hello World\n");
26+}
27diff --git a/meta/recipes-devtools/hello-world/hello-world_1.0.bb b/meta/recipes-devtools/hello-world/hello-world_1.0.bb
28new file mode 100644
29index 0000000000..3c990c108a
30--- /dev/null
31+++ b/meta/recipes-devtools/hello-world/hello-world_1.0.bb
32@@ -0,0 +1,18 @@
33+SUMMARY = "This is a sample summary"
34+DESCRIPTION = "This is a sample description"
35+HOMEPAGE = "https://sample.com/this-is-a-sample"
36+LICENSE = "MIT" 23+LICENSE = "MIT"
37+ 24+
38+SRC_URI += "file://hello_world.c" 25+SRC_URI = "file://helloworld.c"
39+ 26+
40+SRC_URI[md5sum] = "4ee21e9dcc9b5b6012c23038734e1632" 27+S = "${WORKDIR}/sources"
41+SRC_URI[sha256sum] = "edef2bbde0fbf0d88232782a0eded323f483a0519d6fde9a3b1809056fd35f3e" 28+UNPACKDIR = "${S}"
42+ 29+
43+do_compile(){ 30+do_compile() {
44+ ${CC} -o hello_world ../hello_world.c 31+ ${CC} ${CFLAGS} ${LDFLAGS} helloworld.c -o helloworld
45+} 32+}
46+ 33+
47+do_install(){ 34+do_install() {
48+ install -d ${D}${bindir} 35+ install -d ${D}${bindir}
49+ install -m +x hello_world ${D}${bindir}/hello_world 36+ install -m 0755 helloworld ${D}${bindir}
50+} 37+}
38+
39+BBCLASSEXTEND = "native nativesdk"
51-- 40--
522.41.0 412.45.1
53 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
index b8da16dfe5..8ffa97ec56 100644
--- 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
@@ -1,54 +1,43 @@
1From 5144d2ba1aa763312c047dd5f8901368cff79da6 Mon Sep 17 00:00:00 2001 1From 04eb94a0134ef5eb5b5fd783b303104fbfcd8437 Mon Sep 17 00:00:00 2001
2From: Daniela Plascencia <daniela.plascencia@linux.intel.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Thu, 23 Feb 2017 10:34:27 -0600 3Date: Fri, 31 May 2024 11:03:47 -0400
4Subject: [PATCH] meta: adding hello-yocto recipe 4Subject: [PATCH] selftest-hello: add selftest-hello-extra
5 5
6This is a sample recipe 6This should pass the test_lic_files_chksum_presence test.
7 7
8Signed-off-by: Daniela Plascencia <daniela.plascencia@linux.intel.com> 8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9--- 9---
10 .../hello-world/hello-world/hello_world.c | 5 +++++ 10 .../selftest-hello-extra_1.0.bb | 21 +++++++++++++++++++
11 .../hello-world/hello-world_1.0.bb | 19 +++++++++++++++++++ 11 1 file changed, 21 insertions(+)
12 2 files changed, 24 insertions(+) 12 create mode 100644 meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
13 create mode 100644 meta/recipes-devtools/hello-world/hello-world/hello_world.c
14 create mode 100644 meta/recipes-devtools/hello-world/hello-world_1.0.bb
15 13
16diff --git a/meta/recipes-devtools/hello-world/hello-world/hello_world.c b/meta/recipes-devtools/hello-world/hello-world/hello_world.c 14diff --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
17new file mode 100644 15new file mode 100644
18index 0000000000..0d59f57d4c 16index 00000000000..f3dec1b220c
19--- /dev/null 17--- /dev/null
20+++ b/meta/recipes-devtools/hello-world/hello-world/hello_world.c 18+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
21@@ -0,0 +1,5 @@ 19@@ -0,0 +1,21 @@
22+#include <stdio.h> 20+SUMMARY = "This is an example summary"
23+ 21+DESCRIPTION = "Simple helloworld application -- selftest variant"
24+int main(){ 22+SECTION = "examples"
25+ printf("Hello World\n");
26+}
27diff --git a/meta/recipes-devtools/hello-world/hello-world_1.0.bb b/meta/recipes-devtools/hello-world/hello-world_1.0.bb
28new file mode 100644
29index 0000000000..44d888c82a
30--- /dev/null
31+++ b/meta/recipes-devtools/hello-world/hello-world_1.0.bb
32@@ -0,0 +1,19 @@
33+SUMMARY = "This is a sample summary"
34+DESCRIPTION = "This is a sample description"
35+HOMEPAGE = "https://sample.com/this-is-a-sample"
36+LICENSE = "MIT" 23+LICENSE = "MIT"
37+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 24+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
38+ 25+
39+SRC_URI += "file://hello_world.c" 26+SRC_URI = "file://helloworld.c"
40+ 27+
41+SRC_URI[md5sum] = "4ee21e9dcc9b5b6012c23038734e1632" 28+S = "${WORKDIR}/sources"
42+SRC_URI[sha256sum] = "edef2bbde0fbf0d88232782a0eded323f483a0519d6fde9a3b1809056fd35f3e" 29+UNPACKDIR = "${S}"
43+ 30+
44+do_compile(){ 31+do_compile() {
45+ ${CC} -o hello_world ../hello_world.c 32+ ${CC} ${CFLAGS} ${LDFLAGS} helloworld.c -o helloworld
46+} 33+}
47+ 34+
48+do_install(){ 35+do_install() {
49+ install -d ${D}${bindir} 36+ install -d ${D}${bindir}
50+ install -m +x hello_world ${D}${bindir}/hello_world 37+ install -m 0755 helloworld ${D}${bindir}
51+} 38+}
39+
40+BBCLASSEXTEND = "native nativesdk"
52-- 41--
532.41.0 422.45.1
54 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
index 983b6e0c2b..0a402d0a3e 100644
--- 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
@@ -1,17 +1,17 @@
1From 4ab06b5f81455249cd5e89d2cce9863803b5ecb5 Mon Sep 17 00:00:00 2001 1From f2f7b6bcb831289bc3ba2343ad7dc5bee6d6e0cd Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Fri, 8 Sep 2023 14:41:00 -0400 3Date: Fri, 31 May 2024 08:45:41 -0400
4Subject: [PATCH] selftest-hello: remove helloworld.c 4Subject: [PATCH] selftest-hello: remove helloworld.c
5 5
6This should fail the test_src_uri_left_files selftest. 6This should fail the test_src_uri_left_files selftest.
7 7
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> 8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9--- 9---
10 .../recipes-test/selftest-hello/selftest-hello_1.0.bb | 4 +--- 10 meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb | 2 --
11 1 file changed, 1 insertion(+), 3 deletions(-) 11 1 file changed, 2 deletions(-)
12 12
13diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 13diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
14index 547587bef4..f6817f05bc 100644 14index 2dc352d479e..e95270adaeb 100644
15--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 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 16+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
17@@ -3,8 +3,6 @@ SECTION = "examples" 17@@ -3,8 +3,6 @@ SECTION = "examples"
@@ -20,16 +20,9 @@ index 547587bef4..f6817f05bc 100644
20 20
21-SRC_URI = "file://helloworld.c" 21-SRC_URI = "file://helloworld.c"
22- 22-
23 S = "${WORKDIR}" 23 S = "${WORKDIR}/sources"
24 UNPACKDIR = "${S}"
24 25
25 do_compile() {
26@@ -16,4 +14,4 @@ do_install() {
27 install -m 0755 helloworld ${D}${bindir}
28 }
29
30-BBCLASSEXTEND = "native nativesdk"
31\ No newline at end of file
32+BBCLASSEXTEND = "native nativesdk"
33-- 26--
342.41.0 272.45.1
35 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
index 1f1a77e581..a675c028d0 100644
--- 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
@@ -1,6 +1,6 @@
1From 6c7ac367a873bf827c19b81085c943eace917a99 Mon Sep 17 00:00:00 2001 1From e79933e2fc68570066eca66f0b599d259b7a1731 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Fri, 8 Sep 2023 14:41:00 -0400 3Date: Fri, 31 May 2024 08:18:48 -0400
4Subject: [PATCH] selftest-hello: remove helloworld.c 4Subject: [PATCH] selftest-hello: remove helloworld.c
5 5
6This should pass the test_src_uri_left_files selftest. 6This should pass the test_src_uri_left_files selftest.
@@ -8,13 +8,13 @@ This should pass the test_src_uri_left_files selftest.
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> 8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9--- 9---
10 .../recipes-test/selftest-hello/files/helloworld.c | 8 -------- 10 .../recipes-test/selftest-hello/files/helloworld.c | 8 --------
11 .../recipes-test/selftest-hello/selftest-hello_1.0.bb | 4 +--- 11 .../recipes-test/selftest-hello/selftest-hello_1.0.bb | 2 --
12 2 files changed, 1 insertion(+), 11 deletions(-) 12 2 files changed, 10 deletions(-)
13 delete mode 100644 meta-selftest/recipes-test/selftest-hello/files/helloworld.c 13 delete mode 100644 meta-selftest/recipes-test/selftest-hello/files/helloworld.c
14 14
15diff --git a/meta-selftest/recipes-test/selftest-hello/files/helloworld.c b/meta-selftest/recipes-test/selftest-hello/files/helloworld.c 15diff --git a/meta-selftest/recipes-test/selftest-hello/files/helloworld.c b/meta-selftest/recipes-test/selftest-hello/files/helloworld.c
16deleted file mode 100644 16deleted file mode 100644
17index fc7169b7b8..0000000000 17index fc7169b7b83..00000000000
18--- a/meta-selftest/recipes-test/selftest-hello/files/helloworld.c 18--- a/meta-selftest/recipes-test/selftest-hello/files/helloworld.c
19+++ /dev/null 19+++ /dev/null
20@@ -1,8 +0,0 @@ 20@@ -1,8 +0,0 @@
@@ -27,7 +27,7 @@ index fc7169b7b8..0000000000
27- return 0; 27- return 0;
28-} 28-}
29diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 29diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
30index 547587bef4..f6817f05bc 100644 30index 2dc352d479e..e95270adaeb 100644
31--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 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 32+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
33@@ -3,8 +3,6 @@ SECTION = "examples" 33@@ -3,8 +3,6 @@ SECTION = "examples"
@@ -36,16 +36,9 @@ index 547587bef4..f6817f05bc 100644
36 36
37-SRC_URI = "file://helloworld.c" 37-SRC_URI = "file://helloworld.c"
38- 38-
39 S = "${WORKDIR}" 39 S = "${WORKDIR}/sources"
40 UNPACKDIR = "${S}"
40 41
41 do_compile() {
42@@ -16,4 +14,4 @@ do_install() {
43 install -m 0755 helloworld ${D}${bindir}
44 }
45
46-BBCLASSEXTEND = "native nativesdk"
47\ No newline at end of file
48+BBCLASSEXTEND = "native nativesdk"
49-- 42--
502.41.0 432.45.1
51 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
index 2d2b4e683d..1087843619 100644
--- a/meta/lib/patchtest/selftest/files/TestMetadata.test_summary_presence.fail
+++ b/meta/lib/patchtest/selftest/files/TestMetadata.test_summary_presence.fail
@@ -1,46 +1,42 @@
1From e29da5faa74409be394caa09d9f3b7b60f8592b9 Mon Sep 17 00:00:00 2001 1From f4b72cc24f5e2a290a8637775c4d41c16d5d83aa Mon Sep 17 00:00:00 2001
2From: Daniela Plascencia <daniela.plascencia@linux.intel.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Thu, 23 Feb 2017 10:34:27 -0600 3Date: Fri, 31 May 2024 11:03:47 -0400
4Subject: [PATCH] meta: adding hello-yocto recipe 4Subject: [PATCH] selftest-hello: add selftest-hello-extra
5 5
6This is a sample recipe 6This should fail the test_summary_presence test.
7 7
8Signed-off-by: Daniela Plascencia <daniela.plascencia@linux.intel.com> 8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9--- 9---
10 meta/recipes-devtools/hello-world/hello-world/hello_world.c | 5 +++++ 10 .../selftest-hello-extra_1.0.bb | 20 +++++++++++++++++++
11 meta/recipes-devtools/hello-world/hello-world_1.0.bb | 12 ++++++++++++ 11 1 file changed, 20 insertions(+)
12 2 files changed, 17 insertions(+) 12 create mode 100644 meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
13 create mode 100644 meta/recipes-devtools/hello-world/hello-world/hello_world.c
14 create mode 100644 meta/recipes-devtools/hello-world/hello-world_1.0.bb
15 13
16diff --git a/meta/recipes-devtools/hello-world/hello-world/hello_world.c b/meta/recipes-devtools/hello-world/hello-world/hello_world.c 14diff --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
17new file mode 100644 15new file mode 100644
18index 0000000000..0d59f57d4c 16index 00000000000..2dc352d479e
19--- /dev/null 17--- /dev/null
20+++ b/meta/recipes-devtools/hello-world/hello-world/hello_world.c 18+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
21@@ -0,0 +1,5 @@ 19@@ -0,0 +1,20 @@
22+#include <stdio.h> 20+DESCRIPTION = "Simple helloworld application -- selftest variant"
21+SECTION = "examples"
22+LICENSE = "MIT"
23+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
23+ 24+
24+int main(){ 25+SRC_URI = "file://helloworld.c"
25+ printf("Hello World\n");
26+}
27diff --git a/meta/recipes-devtools/hello-world/hello-world_1.0.bb b/meta/recipes-devtools/hello-world/hello-world_1.0.bb
28new file mode 100644
29index 0000000000..c4e1359217
30--- /dev/null
31+++ b/meta/recipes-devtools/hello-world/hello-world_1.0.bb
32@@ -0,0 +1,12 @@
33+LICENSE = "CLOSED"
34+ 26+
35+SRC_URI += "file://hello_world.c" 27+S = "${WORKDIR}/sources"
28+UNPACKDIR = "${S}"
36+ 29+
37+do_compile(){ 30+do_compile() {
38+ ${CC} -o hello_world ../hello_world.c 31+ ${CC} ${CFLAGS} ${LDFLAGS} helloworld.c -o helloworld
39+} 32+}
40+ 33+
41+do_install(){ 34+do_install() {
42+ install -d ${D}${bindir} 35+ install -d ${D}${bindir}
43+ install -m +x hello_world ${D}${bindir}/hello_world 36+ install -m 0755 helloworld ${D}${bindir}
44+} 37+}
45-- 38+
462.11.0 39+BBCLASSEXTEND = "native nativesdk"
40--
412.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
index 55f0309b3f..3d35a8d8fb 100644
--- a/meta/lib/patchtest/selftest/files/TestMetadata.test_summary_presence.pass
+++ b/meta/lib/patchtest/selftest/files/TestMetadata.test_summary_presence.pass
@@ -1,49 +1,43 @@
1From 0cd2fed12ce4b7b071edde12aec4481ad7a6f107 Mon Sep 17 00:00:00 2001 1From 04eb94a0134ef5eb5b5fd783b303104fbfcd8437 Mon Sep 17 00:00:00 2001
2From: Daniela Plascencia <daniela.plascencia@linux.intel.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Thu, 23 Feb 2017 10:34:27 -0600 3Date: Fri, 31 May 2024 11:03:47 -0400
4Subject: [PATCH] meta: adding hello-yocto recipe 4Subject: [PATCH] selftest-hello: add selftest-hello-extra
5 5
6This is a sample recipe 6This should pass the test_summary_presence test.
7 7
8Signed-off-by: Daniela Plascencia <daniela.plascencia@linux.intel.com> 8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9--- 9---
10 .../hello-world/hello-world/hello_world.c | 5 +++++ 10 .../selftest-hello-extra_1.0.bb | 21 +++++++++++++++++++
11 meta/recipes-devtools/hello-world/hello-world_1.0.bb | 15 +++++++++++++++ 11 1 file changed, 21 insertions(+)
12 2 files changed, 20 insertions(+) 12 create mode 100644 meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
13 create mode 100644 meta/recipes-devtools/hello-world/hello-world/hello_world.c
14 create mode 100644 meta/recipes-devtools/hello-world/hello-world_1.0.bb
15 13
16diff --git a/meta/recipes-devtools/hello-world/hello-world/hello_world.c b/meta/recipes-devtools/hello-world/hello-world/hello_world.c 14diff --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
17new file mode 100644 15new file mode 100644
18index 0000000000..0d59f57d4c 16index 00000000000..f3dec1b220c
19--- /dev/null 17--- /dev/null
20+++ b/meta/recipes-devtools/hello-world/hello-world/hello_world.c 18+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello-extra_1.0.bb
21@@ -0,0 +1,5 @@ 19@@ -0,0 +1,21 @@
22+#include <stdio.h> 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"
23+ 25+
24+int main(){ 26+SRC_URI = "file://helloworld.c"
25+ printf("Hello World\n");
26+}
27diff --git a/meta/recipes-devtools/hello-world/hello-world_1.0.bb b/meta/recipes-devtools/hello-world/hello-world_1.0.bb
28new file mode 100644
29index 0000000000..c54283eece
30--- /dev/null
31+++ b/meta/recipes-devtools/hello-world/hello-world_1.0.bb
32@@ -0,0 +1,15 @@
33+SUMMARY = "This is a sample summary"
34+DESCRIPTION = "This is a sample description"
35+HOMEPAGE = "https://sample.com/this-is-a-sample"
36+LICENSE = "CLOSED"
37+ 27+
38+SRC_URI += "file://hello_world.c" 28+S = "${WORKDIR}/sources"
29+UNPACKDIR = "${S}"
39+ 30+
40+do_compile(){ 31+do_compile() {
41+ ${CC} -o hello_world ../hello_world.c 32+ ${CC} ${CFLAGS} ${LDFLAGS} helloworld.c -o helloworld
42+} 33+}
43+ 34+
44+do_install(){ 35+do_install() {
45+ install -d ${D}${bindir} 36+ install -d ${D}${bindir}
46+ install -m +x hello_world ${D}${bindir}/hello_world 37+ install -m 0755 helloworld ${D}${bindir}
47+} 38+}
48-- 39+
492.11.0 40+BBCLASSEXTEND = "native nativesdk"
41--
422.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
index c763a7506e..f64f2a40b0 100644
--- a/meta/lib/patchtest/selftest/files/TestPatch.test_cve_tag_format.fail
+++ b/meta/lib/patchtest/selftest/files/TestPatch.test_cve_tag_format.fail
@@ -1,29 +1,31 @@
1From 35ccee3cee96fb29514475279248078d88907231 Mon Sep 17 00:00:00 2001 1From c9519f11502d5bb5c143ed43b4c981b6a211bdf9 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Tue, 29 Aug 2023 14:12:27 -0400 3Date: Fri, 31 May 2024 09:54:50 -0400
4Subject: [PATCH] selftest-hello: fix CVE-1234-56789 4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5 5
6CVE: CVE-BAD-FORMAT 6This should fail the test_cve_tag_format test.
7
8CVE: CVE-1234-56789
7 9
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> 10Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9--- 11---
10 .../files/0001-Fix-CVE-1234-56789.patch | 27 +++++++++++++++++++ 12 .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++
11 .../selftest-hello/selftest-hello_1.0.bb | 6 +++-- 13 .../selftest-hello/selftest-hello_1.0.bb | 4 ++-
12 2 files changed, 31 insertions(+), 2 deletions(-) 14 2 files changed, 29 insertions(+), 1 deletion(-)
13 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch 15 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
14 16
15diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch 17diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
16new file mode 100644 18new file mode 100644
17index 0000000000..9219b8db62 19index 00000000000..8a4f9329303
18--- /dev/null 20--- /dev/null
19+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch 21+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
20@@ -0,0 +1,27 @@ 22@@ -0,0 +1,26 @@
21+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001 23+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
22+From: Trevor Gamblin <tgamblin@baylibre.com> 24+From: Trevor Gamblin <tgamblin@baylibre.com>
23+Date: Tue, 29 Aug 2023 14:08:20 -0400 25+Date: Tue, 29 Aug 2023 14:08:20 -0400
24+Subject: [PATCH] Fix CVE-NOT-REAL 26+Subject: [PATCH] Fix CVE-NOT-REAL
25+ 27+
26+CVE: CVE-BAD-FORMAT 28+CVE: CVE-BAD_FORMAT
27+Upstream-Status: Backport(http://example.com/example) 29+Upstream-Status: Backport(http://example.com/example)
28+ 30+
29+Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> 31+Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
@@ -35,19 +37,17 @@ index 0000000000..9219b8db62
35+index 1788f38..83d7918 100644 37+index 1788f38..83d7918 100644
36+--- a/strlen.c 38+--- a/strlen.c
37++++ b/strlen.c 39++++ b/strlen.c
38+@@ -8,6 +8,7 @@ int main() {
39+
40+ printf("%d\n", str_len(string1));
41+ printf("%d\n", str_len(string2));
42++ printf("CVE FIXED!!!\n");
43+
44+ return 0;
45+ }
46+--
47+2.41.0
48+ 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+}
49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
50index 547587bef4..76975a6729 100644 50index 2dc352d479e..d937759f157 100644
51--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 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 52+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
53@@ -3,7 +3,9 @@ SECTION = "examples" 53@@ -3,7 +3,9 @@ SECTION = "examples"
@@ -56,18 +56,11 @@ index 547587bef4..76975a6729 100644
56 56
57-SRC_URI = "file://helloworld.c" 57-SRC_URI = "file://helloworld.c"
58+SRC_URI = "file://helloworld.c \ 58+SRC_URI = "file://helloworld.c \
59+ file://CVE-1234-56789.patch \ 59+ file://0001-Fix-CVE-1234-56789.patch \
60+ " 60+ "
61
62 S = "${WORKDIR}"
63
64@@ -16,4 +18,4 @@ do_install() {
65 install -m 0755 helloworld ${D}${bindir}
66 }
67 61
68-BBCLASSEXTEND = "native nativesdk" 62 S = "${WORKDIR}/sources"
69\ No newline at end of file 63 UNPACKDIR = "${S}"
70+BBCLASSEXTEND = "native nativesdk"
71-- 64--
722.41.0 652.45.1
73 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
index ef6017037c..3819487041 100644
--- a/meta/lib/patchtest/selftest/files/TestPatch.test_cve_tag_format.pass
+++ b/meta/lib/patchtest/selftest/files/TestPatch.test_cve_tag_format.pass
@@ -1,23 +1,25 @@
1From 35ccee3cee96fb29514475279248078d88907231 Mon Sep 17 00:00:00 2001 1From c9519f11502d5bb5c143ed43b4c981b6a211bdf9 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Tue, 29 Aug 2023 14:12:27 -0400 3Date: Fri, 31 May 2024 09:54:50 -0400
4Subject: [PATCH] selftest-hello: fix CVE-1234-56789 4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5 5
6This should pass the test_cve_tag format test.
7
6CVE: CVE-1234-56789 8CVE: CVE-1234-56789
7 9
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> 10Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9--- 11---
10 .../files/0001-Fix-CVE-1234-56789.patch | 27 +++++++++++++++++++ 12 .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++
11 .../selftest-hello/selftest-hello_1.0.bb | 6 +++-- 13 .../selftest-hello/selftest-hello_1.0.bb | 4 ++-
12 2 files changed, 31 insertions(+), 2 deletions(-) 14 2 files changed, 29 insertions(+), 1 deletion(-)
13 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch 15 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
14 16
15diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch 17diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
16new file mode 100644 18new file mode 100644
17index 0000000000..9219b8db62 19index 00000000000..8a4f9329303
18--- /dev/null 20--- /dev/null
19+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch 21+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
20@@ -0,0 +1,27 @@ 22@@ -0,0 +1,26 @@
21+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001 23+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
22+From: Trevor Gamblin <tgamblin@baylibre.com> 24+From: Trevor Gamblin <tgamblin@baylibre.com>
23+Date: Tue, 29 Aug 2023 14:08:20 -0400 25+Date: Tue, 29 Aug 2023 14:08:20 -0400
@@ -35,19 +37,17 @@ index 0000000000..9219b8db62
35+index 1788f38..83d7918 100644 37+index 1788f38..83d7918 100644
36+--- a/strlen.c 38+--- a/strlen.c
37++++ b/strlen.c 39++++ b/strlen.c
38+@@ -8,6 +8,7 @@ int main() {
39+
40+ printf("%d\n", str_len(string1));
41+ printf("%d\n", str_len(string2));
42++ printf("CVE FIXED!!!\n");
43+
44+ return 0;
45+ }
46+--
47+2.41.0
48+ 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+}
49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
50index 547587bef4..76975a6729 100644 50index 2dc352d479e..d937759f157 100644
51--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 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 52+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
53@@ -3,7 +3,9 @@ SECTION = "examples" 53@@ -3,7 +3,9 @@ SECTION = "examples"
@@ -56,18 +56,11 @@ index 547587bef4..76975a6729 100644
56 56
57-SRC_URI = "file://helloworld.c" 57-SRC_URI = "file://helloworld.c"
58+SRC_URI = "file://helloworld.c \ 58+SRC_URI = "file://helloworld.c \
59+ file://CVE-1234-56789.patch \ 59+ file://0001-Fix-CVE-1234-56789.patch \
60+ " 60+ "
61
62 S = "${WORKDIR}"
63
64@@ -16,4 +18,4 @@ do_install() {
65 install -m 0755 helloworld ${D}${bindir}
66 }
67 61
68-BBCLASSEXTEND = "native nativesdk" 62 S = "${WORKDIR}/sources"
69\ No newline at end of file 63 UNPACKDIR = "${S}"
70+BBCLASSEXTEND = "native nativesdk"
71-- 64--
722.41.0 652.45.1
73 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
index ce8bf7b7d1..b2d0fab9e3 100644
--- 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
@@ -1,23 +1,25 @@
1From 5a2d0ac780a0f4c046fb1a3c3463d3e726f191cb Mon Sep 17 00:00:00 2001 1From c9519f11502d5bb5c143ed43b4c981b6a211bdf9 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Tue, 29 Aug 2023 14:12:27 -0400 3Date: Fri, 31 May 2024 09:54:50 -0400
4Subject: [PATCH] selftest-hello: fix CVE-1234-56789 4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5 5
6This should fail the test_signed_off_by_presence test.
7
6CVE: CVE-1234-56789 8CVE: CVE-1234-56789
7 9
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> 10Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9--- 11---
10 .../selftest-hello/files/CVE-1234-56789.patch | 26 +++++++++++++++++++ 12 .../files/0001-Fix-CVE-1234-56789.patch | 25 +++++++++++++++++++
11 .../selftest-hello/selftest-hello_1.0.bb | 6 +++-- 13 .../selftest-hello/selftest-hello_1.0.bb | 4 ++-
12 2 files changed, 30 insertions(+), 2 deletions(-) 14 2 files changed, 28 insertions(+), 1 deletion(-)
13 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch 15 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
14 16
15diff --git a/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch 17diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
16new file mode 100644 18new file mode 100644
17index 0000000000..92a5b65a53 19index 00000000000..8a4f9329303
18--- /dev/null 20--- /dev/null
19+++ b/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch 21+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
20@@ -0,0 +1,26 @@ 22@@ -0,0 +1,25 @@
21+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001 23+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
22+From: Trevor Gamblin <tgamblin@baylibre.com> 24+From: Trevor Gamblin <tgamblin@baylibre.com>
23+Date: Tue, 29 Aug 2023 14:08:20 -0400 25+Date: Tue, 29 Aug 2023 14:08:20 -0400
@@ -34,18 +36,17 @@ index 0000000000..92a5b65a53
34+index 1788f38..83d7918 100644 36+index 1788f38..83d7918 100644
35+--- a/strlen.c 37+--- a/strlen.c
36++++ b/strlen.c 38++++ b/strlen.c
37+@@ -8,6 +8,7 @@ int main() { 39+
38+ 40+int main() {
39+ printf("%d\n", str_len(string1)); 41+
40+ printf("%d\n", str_len(string2)); 42+ printf("%d\n", str_len(string1));
41++ printf("CVE FIXED!!!\n"); 43+ printf("%d\n", str_len(string2));
42+ 44+ printf("CVE FIXED!!!\n");
43+ return 0; 45+
44+ } 46+ return 0;
45+-- 47+}
46+2.41.0
47diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 48diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
48index 547587bef4..76975a6729 100644 49index 2dc352d479e..d937759f157 100644
49--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 50--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
50+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 51+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
51@@ -3,7 +3,9 @@ SECTION = "examples" 52@@ -3,7 +3,9 @@ SECTION = "examples"
@@ -54,18 +55,11 @@ index 547587bef4..76975a6729 100644
54 55
55-SRC_URI = "file://helloworld.c" 56-SRC_URI = "file://helloworld.c"
56+SRC_URI = "file://helloworld.c \ 57+SRC_URI = "file://helloworld.c \
57+ file://CVE-1234-56789.patch \ 58+ file://0001-Fix-CVE-1234-56789.patch \
58+ " 59+ "
59
60 S = "${WORKDIR}"
61
62@@ -16,4 +18,4 @@ do_install() {
63 install -m 0755 helloworld ${D}${bindir}
64 }
65 60
66-BBCLASSEXTEND = "native nativesdk" 61 S = "${WORKDIR}/sources"
67\ No newline at end of file 62 UNPACKDIR = "${S}"
68+BBCLASSEXTEND = "native nativesdk"
69-- 63--
702.41.0 642.45.1
71 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
index ea34c76f0d..2661c1416f 100644
--- 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
@@ -1,23 +1,25 @@
1From 14d72f6973270f78455a8628143f2cff90e8f41e Mon Sep 17 00:00:00 2001 1From c9519f11502d5bb5c143ed43b4c981b6a211bdf9 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <tgamblin@baylibre.com> 2From: Trevor Gamblin <tgamblin@baylibre.com>
3Date: Tue, 29 Aug 2023 14:12:27 -0400 3Date: Fri, 31 May 2024 09:54:50 -0400
4Subject: [PATCH] selftest-hello: fix CVE-1234-56789 4Subject: [PATCH] selftest-hello: fix CVE-1234-56789
5 5
6This should pass the test_signed_off_by_presence test.
7
6CVE: CVE-1234-56789 8CVE: CVE-1234-56789
7 9
8Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> 10Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
9--- 11---
10 .../selftest-hello/files/CVE-1234-56789.patch | 27 +++++++++++++++++++ 12 .../files/0001-Fix-CVE-1234-56789.patch | 26 +++++++++++++++++++
11 .../selftest-hello/selftest-hello_1.0.bb | 6 +++-- 13 .../selftest-hello/selftest-hello_1.0.bb | 4 ++-
12 2 files changed, 31 insertions(+), 2 deletions(-) 14 2 files changed, 29 insertions(+), 1 deletion(-)
13 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch 15 create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
14 16
15diff --git a/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch 17diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
16new file mode 100644 18new file mode 100644
17index 0000000000..869cfb6fe5 19index 00000000000..8a4f9329303
18--- /dev/null 20--- /dev/null
19+++ b/meta-selftest/recipes-test/selftest-hello/files/CVE-1234-56789.patch 21+++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-CVE-1234-56789.patch
20@@ -0,0 +1,27 @@ 22@@ -0,0 +1,26 @@
21+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001 23+From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001
22+From: Trevor Gamblin <tgamblin@baylibre.com> 24+From: Trevor Gamblin <tgamblin@baylibre.com>
23+Date: Tue, 29 Aug 2023 14:08:20 -0400 25+Date: Tue, 29 Aug 2023 14:08:20 -0400
@@ -35,18 +37,17 @@ index 0000000000..869cfb6fe5
35+index 1788f38..83d7918 100644 37+index 1788f38..83d7918 100644
36+--- a/strlen.c 38+--- a/strlen.c
37++++ b/strlen.c 39++++ b/strlen.c
38+@@ -8,6 +8,7 @@ int main() { 40+
39+ 41+int main() {
40+ printf("%d\n", str_len(string1)); 42+
41+ printf("%d\n", str_len(string2)); 43+ printf("%d\n", str_len(string1));
42++ printf("CVE FIXED!!!\n"); 44+ printf("%d\n", str_len(string2));
43+ 45+ printf("CVE FIXED!!!\n");
44+ return 0; 46+
45+ } 47+ return 0;
46+-- 48+}
47+2.41.0
48diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 49diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
49index 547587bef4..76975a6729 100644 50index 2dc352d479e..d937759f157 100644
50--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb 51--- 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+++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb
52@@ -3,7 +3,9 @@ SECTION = "examples" 53@@ -3,7 +3,9 @@ SECTION = "examples"
@@ -55,18 +56,11 @@ index 547587bef4..76975a6729 100644
55 56
56-SRC_URI = "file://helloworld.c" 57-SRC_URI = "file://helloworld.c"
57+SRC_URI = "file://helloworld.c \ 58+SRC_URI = "file://helloworld.c \
58+ file://CVE-1234-56789.patch \ 59+ file://0001-Fix-CVE-1234-56789.patch \
59+ " 60+ "
60
61 S = "${WORKDIR}"
62
63@@ -16,4 +18,4 @@ do_install() {
64 install -m 0755 helloworld ${D}${bindir}
65 }
66 61
67-BBCLASSEXTEND = "native nativesdk" 62 S = "${WORKDIR}/sources"
68\ No newline at end of file 63 UNPACKDIR = "${S}"
69+BBCLASSEXTEND = "native nativesdk"
70-- 64--
712.41.0 652.45.1
72 66
diff --git a/meta/lib/patchtest/selftest/selftest b/meta/lib/patchtest/selftest/selftest
index 6fad50ce61..3cf1c361f7 100755
--- a/meta/lib/patchtest/selftest/selftest
+++ b/meta/lib/patchtest/selftest/selftest
@@ -38,7 +38,7 @@ def test(root, patch):
38 res = True 38 res = True
39 patchpath = os.path.abspath(os.path.join(root, patch)) 39 patchpath = os.path.abspath(os.path.join(root, patch))
40 40
41 cmd = 'patchtest --repodir %s --testdir %s/tests --patch %s' % (repodir, topdir, patchpath) 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) 42 results = subprocess.check_output(cmd, stderr=subprocess.STDOUT, universal_newlines=True, shell=True)
43 43
44 return results 44 return results
diff --git a/meta/lib/patchtest/tests/base.py b/meta/lib/patchtest/tests/base.py
index 424e61b5be..919ca136bb 100644
--- a/meta/lib/patchtest/tests/base.py
+++ b/meta/lib/patchtest/tests/base.py
@@ -8,20 +8,23 @@ import unittest
8import logging 8import logging
9import json 9import json
10import unidiff 10import unidiff
11from data import PatchTestInput 11from patchtest_parser import PatchtestParser
12import mailbox 12import mailbox
13import patchtest_patterns
13import collections 14import collections
14import sys 15import sys
15import os 16import os
16import re 17import re
17 18
18sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'pyparsing')) 19logger = logging.getLogger("patchtest")
20debug = logger.debug
21info = logger.info
22warn = logger.warn
23error = logger.error
19 24
20logger = logging.getLogger('patchtest') 25Commit = collections.namedtuple(
21debug=logger.debug 26 "Commit", ["author", "subject", "commit_message", "shortlog", "payload"]
22info=logger.info 27)
23warn=logger.warn
24error=logger.error
25 28
26Commit = collections.namedtuple('Commit', ['author', 'subject', 'commit_message', 'shortlog', 'payload']) 29Commit = collections.namedtuple('Commit', ['author', 'subject', 'commit_message', 'shortlog', 'payload'])
27 30
@@ -34,10 +37,6 @@ class PatchtestOEError(Exception):
34class Base(unittest.TestCase): 37class Base(unittest.TestCase):
35 # if unit test fails, fail message will throw at least the following JSON: {"id": <testid>} 38 # if unit test fails, fail message will throw at least the following JSON: {"id": <testid>}
36 39
37 endcommit_messages_regex = re.compile(r'\(From \w+-\w+ rev:|(?<!\S)Signed-off-by|(?<!\S)---\n')
38 patchmetadata_regex = re.compile(r'-{3} \S+|\+{3} \S+|@{2} -\d+,\d+ \+\d+,\d+ @{2} \S+')
39
40
41 @staticmethod 40 @staticmethod
42 def msg_to_commit(msg): 41 def msg_to_commit(msg):
43 payload = msg.get_payload() 42 payload = msg.get_payload()
@@ -50,7 +49,7 @@ class Base(unittest.TestCase):
50 @staticmethod 49 @staticmethod
51 def commit_message(payload): 50 def commit_message(payload):
52 commit_message = payload.__str__() 51 commit_message = payload.__str__()
53 match = Base.endcommit_messages_regex.search(payload) 52 match = patchtest_patterns.endcommit_messages_regex.search(payload)
54 if match: 53 if match:
55 commit_message = payload[:match.start()] 54 commit_message = payload[:match.start()]
56 return commit_message 55 return commit_message
@@ -66,13 +65,15 @@ class Base(unittest.TestCase):
66 def setUpClass(cls): 65 def setUpClass(cls):
67 66
68 # General objects: mailbox.mbox and patchset 67 # General objects: mailbox.mbox and patchset
69 cls.mbox = mailbox.mbox(PatchTestInput.repo.patch) 68 cls.mbox = mailbox.mbox(PatchtestParser.repo.patch.path)
70 69
71 # Patch may be malformed, so try parsing it 70 # Patch may be malformed, so try parsing it
72 cls.unidiff_parse_error = '' 71 cls.unidiff_parse_error = ''
73 cls.patchset = None 72 cls.patchset = None
74 try: 73 try:
75 cls.patchset = unidiff.PatchSet.from_filename(PatchTestInput.repo.patch, encoding=u'UTF-8') 74 cls.patchset = unidiff.PatchSet.from_filename(
75 PatchtestParser.repo.patch.path, encoding="UTF-8"
76 )
76 except unidiff.UnidiffParseError as upe: 77 except unidiff.UnidiffParseError as upe:
77 cls.patchset = [] 78 cls.patchset = []
78 cls.unidiff_parse_error = str(upe) 79 cls.unidiff_parse_error = str(upe)
@@ -149,7 +150,7 @@ class Metadata(Base):
149 150
150 # import relevant libraries 151 # import relevant libraries
151 try: 152 try:
152 scripts_path = os.path.join(PatchTestInput.repodir, 'scripts', 'lib') 153 scripts_path = os.path.join(PatchtestParser.repodir, "scripts", "lib")
153 if scripts_path not in sys.path: 154 if scripts_path not in sys.path:
154 sys.path.insert(0, scripts_path) 155 sys.path.insert(0, scripts_path)
155 import scriptpath 156 import scriptpath
@@ -224,11 +225,23 @@ class Metadata(Base):
224 for patch in patchset: 225 for patch in patchset:
225 if patch.path.endswith('.bb') or patch.path.endswith('.bbappend') or patch.path.endswith('.inc'): 226 if patch.path.endswith('.bb') or patch.path.endswith('.bbappend') or patch.path.endswith('.inc'):
226 if patch.is_added_file: 227 if patch.is_added_file:
227 added_paths.append(os.path.join(os.path.abspath(PatchTestInput.repodir), patch.path)) 228 added_paths.append(
229 os.path.join(
230 os.path.abspath(PatchtestParser.repodir), patch.path
231 )
232 )
228 elif patch.is_modified_file: 233 elif patch.is_modified_file:
229 modified_paths.append(os.path.join(os.path.abspath(PatchTestInput.repodir), patch.path)) 234 modified_paths.append(
235 os.path.join(
236 os.path.abspath(PatchtestParser.repodir), patch.path
237 )
238 )
230 elif patch.is_removed_file: 239 elif patch.is_removed_file:
231 removed_paths.append(os.path.join(os.path.abspath(PatchTestInput.repodir), patch.path)) 240 removed_paths.append(
241 os.path.join(
242 os.path.abspath(PatchtestParser.repodir), patch.path
243 )
244 )
232 245
233 data = cls.tinfoil.cooker.recipecaches[''].pkg_fn.items() 246 data = cls.tinfoil.cooker.recipecaches[''].pkg_fn.items()
234 247
diff --git a/meta/lib/patchtest/tests/pyparsing/common.py b/meta/lib/patchtest/tests/pyparsing/common.py
deleted file mode 100644
index cbce4c38bc..0000000000
--- a/meta/lib/patchtest/tests/pyparsing/common.py
+++ /dev/null
@@ -1,26 +0,0 @@
1# common pyparsing variables
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0-only
6
7import pyparsing
8
9# general
10colon = pyparsing.Literal(":")
11start = pyparsing.LineStart()
12end = pyparsing.LineEnd()
13at = pyparsing.Literal("@")
14lessthan = pyparsing.Literal("<")
15greaterthan = pyparsing.Literal(">")
16opensquare = pyparsing.Literal("[")
17closesquare = pyparsing.Literal("]")
18inappropriate = pyparsing.CaselessLiteral("Inappropriate")
19submitted = pyparsing.CaselessLiteral("Submitted")
20
21# word related
22nestexpr = pyparsing.nestedExpr(opener='[', closer=']')
23inappropriateinfo = pyparsing.Literal("Inappropriate") + nestexpr
24submittedinfo = pyparsing.Literal("Submitted") + nestexpr
25word = pyparsing.Word(pyparsing.alphas)
26worddot = pyparsing.Word(pyparsing.alphas+".")
diff --git a/meta/lib/patchtest/tests/pyparsing/parse_cve_tags.py b/meta/lib/patchtest/tests/pyparsing/parse_cve_tags.py
deleted file mode 100644
index f7fb82ec2b..0000000000
--- a/meta/lib/patchtest/tests/pyparsing/parse_cve_tags.py
+++ /dev/null
@@ -1,18 +0,0 @@
1# signed-off-by pyparsing definition
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0-only
6
7
8import pyparsing
9import common
10
11name = pyparsing.Regex('\S+.*(?= <)')
12username = pyparsing.OneOrMore(common.worddot)
13domain = pyparsing.OneOrMore(common.worddot)
14cve = pyparsing.Regex('CVE\-\d{4}\-\d+')
15cve_mark = pyparsing.Literal("CVE:")
16
17cve_tag = pyparsing.AtLineStart(cve_mark + cve)
18patch_cve_tag = pyparsing.AtLineStart("+" + cve_mark + cve)
diff --git a/meta/lib/patchtest/tests/pyparsing/parse_shortlog.py b/meta/lib/patchtest/tests/pyparsing/parse_shortlog.py
deleted file mode 100644
index 30d3ab35b3..0000000000
--- a/meta/lib/patchtest/tests/pyparsing/parse_shortlog.py
+++ /dev/null
@@ -1,14 +0,0 @@
1# subject pyparsing definition
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0-only
6
7# NOTE:This is an oversimplified syntax of the mbox's summary
8
9import pyparsing
10import common
11
12target = pyparsing.OneOrMore(pyparsing.Word(pyparsing.printables.replace(':','')))
13summary = pyparsing.OneOrMore(pyparsing.Word(pyparsing.printables))
14shortlog = common.start + target + common.colon + summary + common.end
diff --git a/meta/lib/patchtest/tests/pyparsing/parse_signed_off_by.py b/meta/lib/patchtest/tests/pyparsing/parse_signed_off_by.py
deleted file mode 100644
index 692ebec3ff..0000000000
--- a/meta/lib/patchtest/tests/pyparsing/parse_signed_off_by.py
+++ /dev/null
@@ -1,22 +0,0 @@
1# signed-off-by pyparsing definition
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0-only
6
7
8import pyparsing
9import common
10
11name = pyparsing.Regex('\S+.*(?= <)')
12username = pyparsing.OneOrMore(common.worddot)
13domain = pyparsing.OneOrMore(common.worddot)
14
15# taken from https://pyparsing-public.wikispaces.com/Helpful+Expressions
16email = pyparsing.Regex(r"(?P<user>[A-Za-z0-9._%+-]+)@(?P<hostname>[A-Za-z0-9.-]+)\.(?P<domain>[A-Za-z]{2,})")
17
18email_enclosed = common.lessthan + email + common.greaterthan
19
20signed_off_by_mark = pyparsing.Literal("Signed-off-by:")
21signed_off_by = pyparsing.AtLineStart(signed_off_by_mark + name + email_enclosed)
22patch_signed_off_by = pyparsing.AtLineStart("+" + signed_off_by_mark + name + email_enclosed)
diff --git a/meta/lib/patchtest/tests/pyparsing/parse_upstream_status.py b/meta/lib/patchtest/tests/pyparsing/parse_upstream_status.py
deleted file mode 100644
index bc6c427c4c..0000000000
--- a/meta/lib/patchtest/tests/pyparsing/parse_upstream_status.py
+++ /dev/null
@@ -1,24 +0,0 @@
1# upstream-status pyparsing definition
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0-only
6
7
8import common
9import pyparsing
10
11upstream_status_literal_valid_status = ["Pending", "Backport", "Denied", "Inappropriate", "Submitted"]
12upstream_status_nonliteral_valid_status = ["Pending", "Backport", "Denied", "Inappropriate [reason]", "Submitted [where]"]
13
14upstream_status_valid_status = pyparsing.Or(
15 [pyparsing.Literal(status) for status in upstream_status_literal_valid_status]
16)
17
18upstream_status_mark = pyparsing.Literal("Upstream-Status")
19inappropriate_status_mark = common.inappropriate
20submitted_status_mark = common.submitted
21
22upstream_status = common.start + upstream_status_mark + common.colon + upstream_status_valid_status
23upstream_status_inappropriate_info = common.start + upstream_status_mark + common.colon + common.inappropriateinfo
24upstream_status_submitted_info = common.start + upstream_status_mark + common.colon + common.submittedinfo
diff --git a/meta/lib/patchtest/tests/test_mbox.py b/meta/lib/patchtest/tests/test_mbox.py
index 0b623b7d17..dab733ea77 100644
--- a/meta/lib/patchtest/tests/test_mbox.py
+++ b/meta/lib/patchtest/tests/test_mbox.py
@@ -6,15 +6,15 @@
6 6
7import base 7import base
8import collections 8import collections
9import parse_shortlog 9import patchtest_patterns
10import parse_signed_off_by
11import pyparsing 10import pyparsing
11import re
12import subprocess 12import subprocess
13from data import PatchTestInput 13from patchtest_parser import PatchtestParser
14 14
15def headlog(): 15def headlog():
16 output = subprocess.check_output( 16 output = subprocess.check_output(
17 "cd %s; git log --pretty='%%h#%%aN#%%cD:#%%s' -1" % PatchTestInput.repodir, 17 "cd %s; git log --pretty='%%h#%%aN#%%cD:#%%s' -1" % PatchtestParser.repodir,
18 universal_newlines=True, 18 universal_newlines=True,
19 shell=True 19 shell=True
20 ) 20 )
@@ -22,20 +22,6 @@ def headlog():
22 22
23class TestMbox(base.Base): 23class TestMbox(base.Base):
24 24
25 auh_email = 'auh@auh.yoctoproject.org'
26
27 invalids = [pyparsing.Regex("^Upgrade Helper.+"),
28 pyparsing.Regex(auh_email),
29 pyparsing.Regex("uh@not\.set"),
30 pyparsing.Regex("\S+@example\.com")]
31
32 rexp_detect = pyparsing.Regex('\[\s?YOCTO.*\]')
33 rexp_validation = pyparsing.Regex('\[(\s?YOCTO\s?#\s?(\d+)\s?,?)+\]')
34 revert_shortlog_regex = pyparsing.Regex('Revert\s+".*"')
35 signoff_prog = parse_signed_off_by.signed_off_by
36 revert_shortlog_regex = pyparsing.Regex('Revert\s+".*"')
37 maxlength = 90
38
39 # base paths of main yocto project sub-projects 25 # base paths of main yocto project sub-projects
40 paths = { 26 paths = {
41 'oe-core': ['meta-selftest', 'meta-skeleton', 'meta', 'scripts'], 27 'oe-core': ['meta-selftest', 'meta-skeleton', 'meta', 'scripts'],
@@ -57,16 +43,18 @@ class TestMbox(base.Base):
57 43
58 44
59 def test_signed_off_by_presence(self): 45 def test_signed_off_by_presence(self):
60 for commit in TestMbox.commits: 46 for commit in self.commits:
61 # skip those patches that revert older commits, these do not required the tag presence 47 # skip those patches that revert older commits, these do not required the tag presence
62 if self.revert_shortlog_regex.search_string(commit.shortlog): 48 if patchtest_patterns.mbox_revert_shortlog_regex.search_string(commit.shortlog):
63 continue 49 continue
64 if not self.signoff_prog.search_string(commit.payload): 50 if not patchtest_patterns.signed_off_by.search_string(commit.payload):
65 self.fail('Mbox is missing Signed-off-by. Add it manually or with "git commit --amend -s"', 51 self.fail(
66 commit=commit) 52 'Mbox is missing Signed-off-by. Add it manually or with "git commit --amend -s"',
53 commit=commit,
54 )
67 55
68 def test_shortlog_format(self): 56 def test_shortlog_format(self):
69 for commit in TestMbox.commits: 57 for commit in self.commits:
70 shortlog = commit.shortlog 58 shortlog = commit.shortlog
71 if not shortlog.strip(): 59 if not shortlog.strip():
72 self.skip('Empty shortlog, no reason to execute shortlog format test') 60 self.skip('Empty shortlog, no reason to execute shortlog format test')
@@ -75,40 +63,54 @@ class TestMbox(base.Base):
75 if shortlog.startswith('Revert "'): 63 if shortlog.startswith('Revert "'):
76 continue 64 continue
77 try: 65 try:
78 parse_shortlog.shortlog.parseString(shortlog) 66 patchtest_patterns.shortlog.parseString(shortlog)
79 except pyparsing.ParseException as pe: 67 except pyparsing.ParseException as pe:
80 self.fail('Commit shortlog (first line of commit message) should follow the format "<target>: <summary>"', 68 self.fail('Commit shortlog (first line of commit message) should follow the format "<target>: <summary>"',
81 commit=commit) 69 commit=commit)
82 70
83 def test_shortlog_length(self): 71 def test_shortlog_length(self):
84 for commit in TestMbox.commits: 72 for commit in self.commits:
85 # no reason to re-check on revert shortlogs 73 # no reason to re-check on revert shortlogs
86 shortlog = commit.shortlog 74 shortlog = re.sub('^(\[.*?\])+ ', '', commit.shortlog)
87 if shortlog.startswith('Revert "'): 75 if shortlog.startswith('Revert "'):
88 continue 76 continue
89 l = len(shortlog) 77 l = len(shortlog)
90 if l > self.maxlength: 78 if l > patchtest_patterns.mbox_shortlog_maxlength:
91 self.fail('Edit shortlog so that it is %d characters or less (currently %d characters)' % (self.maxlength, l), 79 self.fail(
92 commit=commit) 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 )
93 84
94 def test_series_merge_on_head(self): 85 def test_series_merge_on_head(self):
95 self.skip("Merge test is disabled for now") 86 self.skip("Merge test is disabled for now")
96 if PatchTestInput.repo.branch != "master": 87 if PatchtestParser.repo.patch.branch != "master":
97 self.skip("Skipping merge test since patch is not intended for master branch. Target detected is %s" % PatchTestInput.repo.branch) 88 self.skip(
98 if not PatchTestInput.repo.ismerged: 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:
99 commithash, author, date, shortlog = headlog() 94 commithash, author, date, shortlog = headlog()
100 self.fail('Series does not apply on top of target branch %s' % PatchTestInput.repo.branch, 95 self.fail(
101 data=[('Targeted branch', '%s (currently at %s)' % (PatchTestInput.repo.branch, commithash))]) 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 )
102 106
103 def test_target_mailing_list(self): 107 def test_target_mailing_list(self):
104 """In case of merge failure, check for other targeted projects""" 108 """Check for other targeted projects"""
105 if PatchTestInput.repo.ismerged:
106 self.skip('Series merged, no reason to check other mailing lists')
107 109
108 # a meta project may be indicted in the message subject, if this is the case, just fail 110 # a meta project may be indicted in the message subject, if this is the case, just fail
109 # TODO: there may be other project with no-meta prefix, we also need to detect these 111 # TODO: there may be other project with no-meta prefix, we also need to detect these
110 project_regex = pyparsing.Regex("\[(?P<project>meta-.+)\]") 112 project_regex = pyparsing.Regex("\[(?P<project>meta-.+)\]")
111 for commit in TestMbox.commits: 113 for commit in self.commits:
112 match = project_regex.search_string(commit.subject) 114 match = project_regex.search_string(commit.subject)
113 if match: 115 if match:
114 self.fail('Series sent to the wrong mailing list or some patches from the series correspond to different mailing lists', 116 self.fail('Series sent to the wrong mailing list or some patches from the series correspond to different mailing lists',
@@ -136,24 +138,42 @@ class TestMbox(base.Base):
136 data=[('Diff line',self.unidiff_parse_error)]) 138 data=[('Diff line',self.unidiff_parse_error)])
137 139
138 def test_commit_message_presence(self): 140 def test_commit_message_presence(self):
139 for commit in TestMbox.commits: 141 for commit in self.commits:
140 if not commit.commit_message.strip(): 142 if not commit.commit_message.strip():
141 self.fail('Please include a commit message on your patch explaining the change', commit=commit) 143 self.fail('Please include a commit message on your patch explaining the change', commit=commit)
142 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
143 def test_bugzilla_entry_format(self): 154 def test_bugzilla_entry_format(self):
144 for commit in TestMbox.commits: 155 for commit in self.commits:
145 if not self.rexp_detect.search_string(commit.commit_message): 156 if not patchtest_patterns.mbox_bugzilla.search_string(commit.commit_message):
146 self.skip("No bug ID found") 157 self.skip("No bug ID found")
147 elif not self.rexp_validation.search_string(commit.commit_message): 158 elif not patchtest_patterns.mbox_bugzilla_validation.search_string(
148 self.fail('Bugzilla issue ID is not correctly formatted - specify it with format: "[YOCTO #<bugzilla ID>]"', commit=commit) 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 )
149 165
150 def test_author_valid(self): 166 def test_author_valid(self):
151 for commit in self.commits: 167 for commit in self.commits:
152 for invalid in self.invalids: 168 for invalid in patchtest_patterns.invalid_submitters:
153 if invalid.search_string(commit.author): 169 if invalid.search_string(commit.author):
154 self.fail('Invalid author %s. Resend the series with a valid patch author' % commit.author, commit=commit) 170 self.fail('Invalid author %s. Resend the series with a valid patch author' % commit.author, commit=commit)
155 171
156 def test_non_auh_upgrade(self): 172 def test_non_auh_upgrade(self):
157 for commit in self.commits: 173 for commit in self.commits:
158 if self.auh_email in commit.payload: 174 if patchtest_patterns.auh_email in commit.commit_message:
159 self.fail('Invalid author %s. Resend the series with a valid patch author' % self.auh_email, commit=commit) 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
index f5dbcf01ed..2dee80b002 100644
--- a/meta/lib/patchtest/tests/test_metadata.py
+++ b/meta/lib/patchtest/tests/test_metadata.py
@@ -5,28 +5,16 @@
5# SPDX-License-Identifier: GPL-2.0-only 5# SPDX-License-Identifier: GPL-2.0-only
6 6
7import base 7import base
8import collections
8import os 9import os
10import patchtest_patterns
9import pyparsing 11import pyparsing
10from data import PatchTestInput, PatchTestDataStore 12from patchtest_parser import PatchtestParser
13
14# Data store commonly used to share values between pre and post-merge tests
15PatchTestDataStore = collections.defaultdict(str)
11 16
12class TestMetadata(base.Metadata): 17class TestMetadata(base.Metadata):
13 metadata_lic = 'LICENSE'
14 invalid_license = 'PATCHTESTINVALID'
15 metadata_chksum = 'LIC_FILES_CHKSUM'
16 license_var = 'LICENSE'
17 closed = 'CLOSED'
18 lictag_re = pyparsing.AtLineStart("License-Update:")
19 lic_chksum_added = pyparsing.AtLineStart("+" + metadata_chksum)
20 lic_chksum_removed = pyparsing.AtLineStart("-" + metadata_chksum)
21 add_mark = pyparsing.Regex('\\+ ')
22 max_length = 200
23 metadata_src_uri = 'SRC_URI'
24 md5sum = 'md5sum'
25 sha256sum = 'sha256sum'
26 git_regex = pyparsing.Regex('^git\\:\\/\\/.*')
27 metadata_summary = 'SUMMARY'
28 cve_check_ignore_var = 'CVE_CHECK_IGNORE'
29 cve_status_var = 'CVE_STATUS'
30 18
31 def test_license_presence(self): 19 def test_license_presence(self):
32 if not self.added: 20 if not self.added:
@@ -41,13 +29,13 @@ class TestMetadata(base.Metadata):
41 open_flag = 'a' 29 open_flag = 'a'
42 with open(auto_conf, open_flag) as fd: 30 with open(auto_conf, open_flag) as fd:
43 for pn in self.added: 31 for pn in self.added:
44 fd.write('LICENSE ??= "%s"\n' % self.invalid_license) 32 fd.write('LICENSE ??= "%s"\n' % patchtest_patterns.invalid_license)
45 33
46 no_license = False 34 no_license = False
47 for pn in self.added: 35 for pn in self.added:
48 rd = self.tinfoil.parse_recipe(pn) 36 rd = self.tinfoil.parse_recipe(pn)
49 license = rd.getVar(self.metadata_lic) 37 license = rd.getVar(patchtest_patterns.metadata_lic)
50 if license == self.invalid_license: 38 if license == patchtest_patterns.invalid_license:
51 no_license = True 39 no_license = True
52 break 40 break
53 41
@@ -74,11 +62,13 @@ class TestMetadata(base.Metadata):
74 # we are not interested in images 62 # we are not interested in images
75 if '/images/' in pathname: 63 if '/images/' in pathname:
76 continue 64 continue
77 lic_files_chksum = rd.getVar(self.metadata_chksum) 65 lic_files_chksum = rd.getVar(patchtest_patterns.metadata_chksum)
78 if rd.getVar(self.license_var) == self.closed: 66 if rd.getVar(patchtest_patterns.license_var) == patchtest_patterns.closed:
79 continue 67 continue
80 if not lic_files_chksum: 68 if not lic_files_chksum:
81 self.fail('%s is missing in newly added recipe' % self.metadata_chksum) 69 self.fail(
70 "%s is missing in newly added recipe" % patchtest_patterns.metadata_chksum
71 )
82 72
83 def test_lic_files_chksum_modified_not_mentioned(self): 73 def test_lic_files_chksum_modified_not_mentioned(self):
84 if not self.modified: 74 if not self.modified:
@@ -89,11 +79,13 @@ class TestMetadata(base.Metadata):
89 if patch.path.endswith('.patch'): 79 if patch.path.endswith('.patch'):
90 continue 80 continue
91 payload = str(patch) 81 payload = str(patch)
92 if (self.lic_chksum_added.search_string(payload) or self.lic_chksum_removed.search_string(payload)): 82 if patchtest_patterns.lic_chksum_added.search_string(
83 payload
84 ) or patchtest_patterns.lic_chksum_removed.search_string(payload):
93 # if any patch on the series contain reference on the metadata, fail 85 # if any patch on the series contain reference on the metadata, fail
94 for commit in self.commits: 86 for commit in self.commits:
95 if self.lictag_re.search_string(commit.commit_message): 87 if patchtest_patterns.lictag_re.search_string(commit.commit_message):
96 break 88 break
97 else: 89 else:
98 self.fail('LIC_FILES_CHKSUM changed without "License-Update:" tag and description in commit message') 90 self.fail('LIC_FILES_CHKSUM changed without "License-Update:" tag and description in commit message')
99 91
@@ -104,16 +96,22 @@ class TestMetadata(base.Metadata):
104 continue 96 continue
105 payload = str(patch) 97 payload = str(patch)
106 for line in payload.splitlines(): 98 for line in payload.splitlines():
107 if self.add_mark.search_string(line): 99 if patchtest_patterns.add_mark.search_string(line):
108 current_line_length = len(line[1:]) 100 current_line_length = len(line[1:])
109 if current_line_length > self.max_length: 101 if current_line_length > patchtest_patterns.patch_max_line_length:
110 self.fail('Patch line too long (current length %s, maximum is %s)' % (current_line_length, self.max_length), 102 self.fail(
111 data=[('Patch', patch.path), ('Line', '%s ...' % line[0:80])]) 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 )
112 110
113 def pretest_src_uri_left_files(self): 111 def pretest_src_uri_left_files(self):
114 # these tests just make sense on patches that can be merged 112 # these tests just make sense on patches that can be merged
115 if not PatchTestInput.repo.canbemerged: 113 if not PatchtestParser.repo.canbemerged:
116 self.skip('Patch cannot be merged') 114 self.skip("Patch cannot be merged")
117 if not self.modified: 115 if not self.modified:
118 self.skip('No modified recipes, skipping pretest') 116 self.skip('No modified recipes, skipping pretest')
119 117
@@ -123,12 +121,14 @@ class TestMetadata(base.Metadata):
123 if 'core-image' in pn: 121 if 'core-image' in pn:
124 continue 122 continue
125 rd = self.tinfoil.parse_recipe(pn) 123 rd = self.tinfoil.parse_recipe(pn)
126 PatchTestDataStore['%s-%s-%s' % (self.shortid(), self.metadata_src_uri, pn)] = rd.getVar(self.metadata_src_uri) 124 PatchTestDataStore[
125 "%s-%s-%s" % (self.shortid(), patchtest_patterns.metadata_src_uri, pn)
126 ] = rd.getVar(patchtest_patterns.metadata_src_uri)
127 127
128 def test_src_uri_left_files(self): 128 def test_src_uri_left_files(self):
129 # these tests just make sense on patches that can be merged 129 # these tests just make sense on patches that can be merged
130 if not PatchTestInput.repo.canbemerged: 130 if not PatchtestParser.repo.canbemerged:
131 self.skip('Patch cannot be merged') 131 self.skip("Patch cannot be merged")
132 if not self.modified: 132 if not self.modified:
133 self.skip('No modified recipes, skipping pretest') 133 self.skip('No modified recipes, skipping pretest')
134 134
@@ -138,11 +138,17 @@ class TestMetadata(base.Metadata):
138 if 'core-image' in pn: 138 if 'core-image' in pn:
139 continue 139 continue
140 rd = self.tinfoil.parse_recipe(pn) 140 rd = self.tinfoil.parse_recipe(pn)
141 PatchTestDataStore['%s-%s-%s' % (self.shortid(), self.metadata_src_uri, pn)] = rd.getVar(self.metadata_src_uri) 141 PatchTestDataStore[
142 "%s-%s-%s" % (self.shortid(), patchtest_patterns.metadata_src_uri, pn)
143 ] = rd.getVar(patchtest_patterns.metadata_src_uri)
142 144
143 for pn in self.modified: 145 for pn in self.modified:
144 pretest_src_uri = PatchTestDataStore['pre%s-%s-%s' % (self.shortid(), self.metadata_src_uri, pn)].split() 146 pretest_src_uri = PatchTestDataStore[
145 test_src_uri = PatchTestDataStore['%s-%s-%s' % (self.shortid(), self.metadata_src_uri, pn)].split() 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()
146 152
147 pretest_files = set([os.path.basename(patch) for patch in pretest_src_uri if patch.startswith('file://')]) 153 pretest_files = set([os.path.basename(patch) for patch in pretest_src_uri if patch.startswith('file://')])
148 test_files = set([os.path.basename(patch) for patch in test_src_uri if patch.startswith('file://')]) 154 test_files = set([os.path.basename(patch) for patch in test_src_uri if patch.startswith('file://')])
@@ -175,23 +181,32 @@ class TestMetadata(base.Metadata):
175 if 'core-image' in pn: 181 if 'core-image' in pn:
176 continue 182 continue
177 rd = self.tinfoil.parse_recipe(pn) 183 rd = self.tinfoil.parse_recipe(pn)
178 summary = rd.getVar(self.metadata_summary) 184 summary = rd.getVar(patchtest_patterns.metadata_summary)
179 185
180 # "${PN} version ${PN}-${PR}" is the default, so fail if default 186 # "${PN} version ${PN}-${PR}" is the default, so fail if default
181 if summary.startswith('%s version' % pn): 187 if summary.startswith("%s version" % pn):
182 self.fail('%s is missing in newly added recipe' % self.metadata_summary) 188 self.fail(
189 "%s is missing in newly added recipe" % patchtest_patterns.metadata_summary
190 )
183 191
184 def test_cve_check_ignore(self): 192 def test_cve_check_ignore(self):
185 # Skip if we neither modified a recipe or target branches are not 193 # Skip if we neither modified a recipe or target branches are not
186 # Nanbield and newer. CVE_CHECK_IGNORE was first deprecated in Nanbield. 194 # Nanbield and newer. CVE_CHECK_IGNORE was first deprecated in Nanbield.
187 if not self.modified or PatchTestInput.repo.branch == "kirkstone" or PatchTestInput.repo.branch == "dunfell": 195 if (
188 self.skip('No modified recipes or older target branch, skipping test') 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")
189 for pn in self.modified: 201 for pn in self.modified:
190 # we are not interested in images 202 # we are not interested in images
191 if 'core-image' in pn: 203 if 'core-image' in pn:
192 continue 204 continue
193 rd = self.tinfoil.parse_recipe(pn) 205 rd = self.tinfoil.parse_recipe(pn)
194 cve_check_ignore = rd.getVar(self.cve_check_ignore_var) 206 cve_check_ignore = rd.getVar(patchtest_patterns.cve_check_ignore_var)
195 207
196 if cve_check_ignore is not None: 208 if cve_check_ignore is not None:
197 self.fail('%s is deprecated and should be replaced by %s' % (self.cve_check_ignore_var, self.cve_status_var)) 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
index d7187a0cb1..d08b8a5019 100644
--- a/meta/lib/patchtest/tests/test_patch.py
+++ b/meta/lib/patchtest/tests/test_patch.py
@@ -7,16 +7,11 @@
7 7
8import base 8import base
9import os 9import os
10import parse_signed_off_by 10import patchtest_patterns
11import parse_upstream_status
12import pyparsing 11import pyparsing
13 12
14class TestPatch(base.Base): 13class TestPatch(base.Base):
15 14
16 re_cve_pattern = pyparsing.Regex("CVE\-\d{4}\-\d+")
17 re_cve_payload_tag = pyparsing.Regex("\+CVE:(\s+CVE\-\d{4}\-\d+)+")
18 upstream_status_regex = pyparsing.AtLineStart("+" + "Upstream-Status")
19
20 @classmethod 15 @classmethod
21 def setUpClassLocal(cls): 16 def setUpClassLocal(cls):
22 cls.newpatches = [] 17 cls.newpatches = []
@@ -25,17 +20,17 @@ class TestPatch(base.Base):
25 if patch.path.endswith('.patch') and patch.is_added_file: 20 if patch.path.endswith('.patch') and patch.is_added_file:
26 cls.newpatches.append(patch) 21 cls.newpatches.append(patch)
27 22
28 cls.mark = str(parse_signed_off_by.signed_off_by_mark).strip('"') 23 cls.mark = str(patchtest_patterns.signed_off_by_prefix).strip('"')
29 24
30 # match PatchSignedOffBy.mark with '+' preceding it 25 # match PatchSignedOffBy.mark with '+' preceding it
31 cls.prog = parse_signed_off_by.patch_signed_off_by 26 cls.prog = patchtest_patterns.patch_signed_off_by
32 27
33 def setUp(self): 28 def setUp(self):
34 if self.unidiff_parse_error: 29 if self.unidiff_parse_error:
35 self.skip('Parse error %s' % self.unidiff_parse_error) 30 self.skip('Parse error %s' % self.unidiff_parse_error)
36 31
37 self.valid_status = ', '.join(parse_upstream_status.upstream_status_nonliteral_valid_status) 32 self.valid_status = ", ".join(patchtest_patterns.upstream_status_nonliteral_valid_status)
38 self.standard_format = 'Upstream-Status: <Valid status>' 33 self.standard_format = "Upstream-Status: <Valid status>"
39 34
40 # we are just interested in series that introduce CVE patches, thus discard other 35 # we are just interested in series that introduce CVE patches, thus discard other
41 # possibilities: modification to current CVEs, patch directly introduced into the 36 # possibilities: modification to current CVEs, patch directly introduced into the
@@ -50,31 +45,62 @@ class TestPatch(base.Base):
50 45
51 for newpatch in TestPatch.newpatches: 46 for newpatch in TestPatch.newpatches:
52 payload = newpatch.__str__() 47 payload = newpatch.__str__()
53 if not self.upstream_status_regex.search_string(payload): 48 if not patchtest_patterns.upstream_status_regex.search_string(payload):
54 self.fail('Added patch file is missing Upstream-Status: <Valid status> in the commit message', 49 self.fail(
55 data=[('Standard format', self.standard_format), ('Valid status', self.valid_status)]) 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(): 56 for line in payload.splitlines():
57 if self.patchmetadata_regex.match(line): 57 if patchtest_patterns.patchmetadata_regex.match(line):
58 continue 58 continue
59 if self.upstream_status_regex.search_string(line): 59 if patchtest_patterns.upstream_status_regex.search_string(line):
60 if parse_upstream_status.inappropriate_status_mark.searchString(line): 60 if patchtest_patterns.inappropriate.searchString(line):
61 try: 61 try:
62 parse_upstream_status.upstream_status_inappropriate_info.parseString(line.lstrip('+')) 62 patchtest_patterns.upstream_status_inappropriate_info.parseString(
63 except pyparsing.ParseException as pe: 63 line.lstrip("+")
64 self.fail('Upstream-Status is Inappropriate, but no reason was provided', 64 )
65 data=[('Current', pe.pstr), ('Standard format', 'Upstream-Status: Inappropriate [reason]')]) 65 except pyparsing.ParseException as pe:
66 elif parse_upstream_status.submitted_status_mark.searchString(line): 66 self.fail(
67 try: 67 "Upstream-Status is Inappropriate, but no reason was provided",
68 parse_upstream_status.upstream_status_submitted_info.parseString(line.lstrip('+')) 68 data=[
69 except pyparsing.ParseException as pe: 69 ("Current", pe.pstr),
70 self.fail('Upstream-Status is Submitted, but it is not mentioned where', 70 (
71 data=[('Current', pe.pstr), ('Standard format', 'Upstream-Status: Submitted [where]')]) 71 "Standard format",
72 else: 72 "Upstream-Status: Inappropriate [reason]",
73 try: 73 ),
74 parse_upstream_status.upstream_status.parseString(line.lstrip('+')) 74 ],
75 except pyparsing.ParseException as pe: 75 )
76 self.fail('Upstream-Status is in incorrect format', 76 elif patchtest_patterns.submitted.searchString(line):
77 data=[('Current', pe.pstr), ('Standard format', self.standard_format), ('Valid status', self.valid_status)]) 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 )
78 104
79 def test_signed_off_by_presence(self): 105 def test_signed_off_by_presence(self):
80 if not TestPatch.newpatches: 106 if not TestPatch.newpatches:
@@ -83,7 +109,7 @@ class TestPatch(base.Base):
83 for newpatch in TestPatch.newpatches: 109 for newpatch in TestPatch.newpatches:
84 payload = newpatch.__str__() 110 payload = newpatch.__str__()
85 for line in payload.splitlines(): 111 for line in payload.splitlines():
86 if self.patchmetadata_regex.match(line): 112 if patchtest_patterns.patchmetadata_regex.match(line):
87 continue 113 continue
88 if TestPatch.prog.search_string(payload): 114 if TestPatch.prog.search_string(payload):
89 break 115 break
@@ -92,10 +118,12 @@ class TestPatch(base.Base):
92 118
93 def test_cve_tag_format(self): 119 def test_cve_tag_format(self):
94 for commit in TestPatch.commits: 120 for commit in TestPatch.commits:
95 if self.re_cve_pattern.search_string(commit.shortlog) or self.re_cve_pattern.search_string(commit.commit_message): 121 if patchtest_patterns.cve.search_string(
122 commit.shortlog
123 ) or patchtest_patterns.cve.search_string(commit.commit_message):
96 tag_found = False 124 tag_found = False
97 for line in commit.payload.splitlines(): 125 for line in commit.payload.splitlines():
98 if self.re_cve_payload_tag.search_string(line): 126 if patchtest_patterns.cve_payload_tag.search_string(line):
99 tag_found = True 127 tag_found = True
100 break 128 break
101 if not tag_found: 129 if not tag_found:
diff --git a/meta/lib/patchtest/tests/test_python_pylint.py b/meta/lib/patchtest/tests/test_python_pylint.py
index ef315e591c..ec9129bc79 100644
--- a/meta/lib/patchtest/tests/test_python_pylint.py
+++ b/meta/lib/patchtest/tests/test_python_pylint.py
@@ -6,7 +6,7 @@
6 6
7import base 7import base
8from io import StringIO 8from io import StringIO
9from data import PatchTestInput 9from patchtest_parser import PatchtestParser
10from pylint.reporters.text import TextReporter 10from pylint.reporters.text import TextReporter
11import pylint.lint as lint 11import pylint.lint as lint
12 12
diff --git a/meta/lib/patchtest/utils.py b/meta/lib/patchtest/utils.py
deleted file mode 100644
index 8eddf3e85f..0000000000
--- a/meta/lib/patchtest/utils.py
+++ /dev/null
@@ -1,61 +0,0 @@
1# ex:ts=4:sw=4:sts=4:et
2# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
3#
4# utils: common methods used by the patchtest framework
5#
6# Copyright (C) 2016 Intel Corporation
7#
8# SPDX-License-Identifier: GPL-2.0-only
9#
10
11import os
12import subprocess
13import logging
14import re
15import mailbox
16
17def logger_create(name):
18 logger = logging.getLogger(name)
19 loggerhandler = logging.StreamHandler()
20 loggerhandler.setFormatter(logging.Formatter("%(message)s"))
21 logger.addHandler(loggerhandler)
22 logger.setLevel(logging.INFO)
23 return logger
24
25def valid_branch(branch):
26 """ Check if branch is valid name """
27 lbranch = branch.lower()
28
29 invalid = lbranch.startswith('patch') or \
30 lbranch.startswith('rfc') or \
31 lbranch.startswith('resend') or \
32 re.search(r'^v\d+', lbranch) or \
33 re.search(r'^\d+/\d+', lbranch)
34
35 return not invalid
36
37def get_branch(path):
38 """ Get the branch name from mbox """
39 fullprefix = ""
40 mbox = mailbox.mbox(path)
41
42 if len(mbox):
43 subject = mbox[0]['subject']
44 if subject:
45 pattern = re.compile(r"(\[.*\])", re.DOTALL)
46 match = pattern.search(subject)
47 if match:
48 fullprefix = match.group(1)
49
50 branch, branches, valid_branches = None, [], []
51
52 if fullprefix:
53 prefix = fullprefix.strip('[]')
54 branches = [ b.strip() for b in prefix.split(',')]
55 valid_branches = [b for b in branches if valid_branch(b)]
56
57 if len(valid_branches):
58 branch = valid_branches[0]
59
60 return branch
61