summaryrefslogtreecommitdiffstats
path: root/meta/lib/patchtest/tests/test_mbox.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/patchtest/tests/test_mbox.py')
-rw-r--r--meta/lib/patchtest/tests/test_mbox.py36
1 files changed, 11 insertions, 25 deletions
diff --git a/meta/lib/patchtest/tests/test_mbox.py b/meta/lib/patchtest/tests/test_mbox.py
index cd76e58a71..e6b8ad21f8 100644
--- a/meta/lib/patchtest/tests/test_mbox.py
+++ b/meta/lib/patchtest/tests/test_mbox.py
@@ -6,8 +6,7 @@
6 6
7import base 7import base
8import collections 8import collections
9import parse_shortlog 9import patterns
10import parse_signed_off_by
11import pyparsing 10import pyparsing
12import re 11import re
13import subprocess 12import subprocess
@@ -23,19 +22,6 @@ def headlog():
23 22
24class TestMbox(base.Base): 23class TestMbox(base.Base):
25 24
26 auh_email = 'auh@yoctoproject.org'
27
28 invalids = [pyparsing.Regex("^Upgrade Helper.+"),
29 pyparsing.Regex(auh_email),
30 pyparsing.Regex("uh@not\.set"),
31 pyparsing.Regex("\S+@example\.com")]
32
33 rexp_detect = pyparsing.Regex('\[\s?YOCTO.*\]')
34 rexp_validation = pyparsing.Regex('\[(\s?YOCTO\s?#\s?(\d+)\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'],
@@ -59,9 +45,9 @@ class TestMbox(base.Base):
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 TestMbox.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 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 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('Mbox is missing Signed-off-by. Add it manually or with "git commit --amend -s"',
66 commit=commit) 52 commit=commit)
67 53
@@ -75,7 +61,7 @@ class TestMbox(base.Base):
75 if shortlog.startswith('Revert "'): 61 if shortlog.startswith('Revert "'):
76 continue 62 continue
77 try: 63 try:
78 parse_shortlog.shortlog.parseString(shortlog) 64 patterns.shortlog.parseString(shortlog)
79 except pyparsing.ParseException as pe: 65 except pyparsing.ParseException as pe:
80 self.fail('Commit shortlog (first line of commit message) should follow the format "<target>: <summary>"', 66 self.fail('Commit shortlog (first line of commit message) should follow the format "<target>: <summary>"',
81 commit=commit) 67 commit=commit)
@@ -87,8 +73,8 @@ class TestMbox(base.Base):
87 if shortlog.startswith('Revert "'): 73 if shortlog.startswith('Revert "'):
88 continue 74 continue
89 l = len(shortlog) 75 l = len(shortlog)
90 if l > self.maxlength: 76 if l > patterns.mbox_shortlog_maxlength:
91 self.fail('Edit shortlog so that it is %d characters or less (currently %d characters)' % (self.maxlength, l), 77 self.fail('Edit shortlog so that it is %d characters or less (currently %d characters)' % (patterns.mbox_shortlog_maxlength, l),
92 commit=commit) 78 commit=commit)
93 79
94 def test_series_merge_on_head(self): 80 def test_series_merge_on_head(self):
@@ -142,18 +128,18 @@ class TestMbox(base.Base):
142 128
143 def test_bugzilla_entry_format(self): 129 def test_bugzilla_entry_format(self):
144 for commit in TestMbox.commits: 130 for commit in TestMbox.commits:
145 if not self.rexp_detect.search_string(commit.commit_message): 131 if not patterns.mbox_bugzilla.search_string(commit.commit_message):
146 self.skip("No bug ID found") 132 self.skip("No bug ID found")
147 elif not self.rexp_validation.search_string(commit.commit_message): 133 elif not patterns.mbox_bugzilla_validation.search_string(commit.commit_message):
148 self.fail('Bugzilla issue ID is not correctly formatted - specify it with format: "[YOCTO #<bugzilla ID>]"', commit=commit) 134 self.fail('Bugzilla issue ID is not correctly formatted - specify it with format: "[YOCTO #<bugzilla ID>]"', commit=commit)
149 135
150 def test_author_valid(self): 136 def test_author_valid(self):
151 for commit in self.commits: 137 for commit in self.commits:
152 for invalid in self.invalids: 138 for invalid in patterns.invalid_submitters:
153 if invalid.search_string(commit.author): 139 if invalid.search_string(commit.author):
154 self.fail('Invalid author %s. Resend the series with a valid patch author' % commit.author, commit=commit) 140 self.fail('Invalid author %s. Resend the series with a valid patch author' % commit.author, commit=commit)
155 141
156 def test_non_auh_upgrade(self): 142 def test_non_auh_upgrade(self):
157 for commit in self.commits: 143 for commit in self.commits:
158 if self.auh_email in commit.commit_message: 144 if 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) 145 self.fail('Invalid author %s. Resend the series with a valid patch author' % patterns.auh_email, commit=commit)