summaryrefslogtreecommitdiffstats
path: root/meta/lib/patchtest/tests/test_mbox_cve.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/patchtest/tests/test_mbox_cve.py')
-rw-r--r--meta/lib/patchtest/tests/test_mbox_cve.py38
1 files changed, 0 insertions, 38 deletions
diff --git a/meta/lib/patchtest/tests/test_mbox_cve.py b/meta/lib/patchtest/tests/test_mbox_cve.py
deleted file mode 100644
index 29ab12cbb5..0000000000
--- a/meta/lib/patchtest/tests/test_mbox_cve.py
+++ /dev/null
@@ -1,38 +0,0 @@
1# Checks related to the patch's CVE lines
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0-only
6#
7
8import base
9import parse_cve_tags
10import pyparsing
11
12class CVE(base.Base):
13
14 revert_shortlog_regex = pyparsing.Regex('Revert\s+".*"')
15 prog = parse_cve_tags.cve_tag
16 patch_prog = parse_cve_tags.patch_cve_tag
17
18 def setUp(self):
19 if self.unidiff_parse_error:
20 self.skip('Parse error %s' % self.unidiff_parse_error)
21
22 # we are just interested in series that introduce CVE patches, thus discard other
23 # possibilities: modification to current CVEs, patch directly introduced into the
24 # recipe, upgrades already including the CVE, etc.
25 new_patches = [p for p in self.patchset if p.path.endswith('.patch') and p.is_added_file]
26 if not new_patches:
27 self.skip('No new patches introduced')
28
29 def test_cve_presence_in_commit_message(self):
30 for commit in CVE.commits:
31 # skip those patches that revert older commits, these do not required the tag presence
32 if self.revert_shortlog_regex.search_string(commit.shortlog):
33 continue
34 if not self.patch_prog.search_string(commit.payload):
35 self.skip("No CVE tag in added patch, so not needed in mbox")
36 elif not self.prog.search_string(commit.payload):
37 self.fail('Missing or incorrectly formatted CVE tag in mbox. Correct or include the CVE tag in the mbox with format: "CVE: CVE-YYYY-XXXX"',
38 commit=commit)