aboutsummaryrefslogtreecommitdiff
path: root/contrib/gcc-changelog/test_email.py
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/gcc-changelog/test_email.py')
-rwxr-xr-xcontrib/gcc-changelog/test_email.py42
1 files changed, 31 insertions, 11 deletions
diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py
index 9d052e0..319e065 100755
--- a/contrib/gcc-changelog/test_email.py
+++ b/contrib/gcc-changelog/test_email.py
@@ -62,17 +62,17 @@ class TestGccChangelog(unittest.TestCase):
assert t.endswith('.patch')
os.remove(t)
- def get_git_email(self, filename, strict=False):
+ def get_git_email(self, filename):
with tempfile.NamedTemporaryFile(mode='w+', suffix='.patch',
delete=False) as f:
f.write('\n'.join(self.patches[filename]))
self.temps.append(f.name)
- return GitEmail(f.name, strict)
+ return GitEmail(f.name)
- def from_patch_glob(self, name, strict=False):
+ def from_patch_glob(self, name):
files = [f for f in self.patches.keys() if f.startswith(name)]
assert len(files) == 1
- return self.get_git_email(files[0], strict)
+ return self.get_git_email(files[0])
def test_simple_patch_format(self):
email = self.get_git_email('0577-aarch64-Add-an-and.patch')
@@ -247,7 +247,7 @@ class TestGccChangelog(unittest.TestCase):
assert email.changelog_entries[1].prs == []
def test_multiple_prs_not_added(self):
- email = self.from_patch_glob('0001-Add-patch_are')
+ email = self.from_patch_glob('0002-Add-patch_are')
assert not email.errors
assert email.changelog_entries[0].prs == ['PR target/93492']
assert email.changelog_entries[1].prs == ['PR target/12345']
@@ -255,18 +255,17 @@ class TestGccChangelog(unittest.TestCase):
assert email.changelog_entries[2].folder == 'gcc/testsuite'
def test_strict_mode(self):
- email = self.from_patch_glob('0001-Add-patch_are',
- True)
+ email = self.from_patch_glob('0001-Add-patch_are')
msg = 'ChangeLog, DATESTAMP, BASE-VER and DEV-PHASE updates should ' \
'be done separately from normal commits'
- assert email.errors[0].message == msg
+ assert email.errors[0].message.startswith(msg)
def test_strict_mode_normal_patch(self):
- email = self.get_git_email('0001-Just-test-it.patch', True)
+ email = self.get_git_email('0001-Just-test-it.patch')
assert not email.errors
def test_strict_mode_datestamp_only(self):
- email = self.get_git_email('0002-Bump-date.patch', True)
+ email = self.get_git_email('0002-Bump-date.patch')
assert not email.errors
def test_wrong_changelog_entry(self):
@@ -418,5 +417,26 @@ class TestGccChangelog(unittest.TestCase):
assert email.errors[0].message == 'bad parentheses wrapping'
def test_changelog_removal(self):
- email = self.from_patch_glob('0001-ChangeLog-removal.patch', strict=True)
+ email = self.from_patch_glob('0001-ChangeLog-removal.patch')
+ assert not email.errors
+
+ def test_long_filenames(self):
+ email = self.from_patch_glob('0001-long-filenames')
+ assert not email.errors
+
+ def test_multi_same_file(self):
+ email = self.from_patch_glob('0001-OpenMP-Fix-SIMT')
+ assert email.errors[0].message == 'same file specified multiple times'
+
+ def test_pr_only_in_subject(self):
+ email = self.from_patch_glob('0001-rs6000-Support-doubleword')
+ assert (email.errors[0].message ==
+ 'PR 100085 in subject but not in changelog')
+
+ def test_wrong_pr_comp_in_subject(self):
+ email = self.from_patch_glob('pr-wrong-comp.patch')
+ assert email.errors[0].message == 'invalid PR component in subject'
+
+ def test_copyright_years(self):
+ email = self.from_patch_glob('copyright-years.patch')
assert not email.errors