summaryrefslogtreecommitdiff
path: root/contrib/test_mklog.py
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2020-05-27 20:03:50 +0200
committerMartin Liska <mliska@suse.cz>2020-05-28 10:27:09 +0200
commiteb78da45ab82753b78bf062c6f3e982f68274913 (patch)
tree4403f656a3ec732534de3a6186b94fa823b466f7 /contrib/test_mklog.py
parent4a948703db483c3ba3df67816425d951c0268623 (diff)
downloadgcc-eb78da45ab82753b78bf062c6f3e982f68274913.tar.gz
mklog: support renaming of files
contrib/ChangeLog: * mklog.py: Support renaming of files. One needs unidiff 0.6.0+. * test_mklog.py: Test it.
Diffstat (limited to 'contrib/test_mklog.py')
-rwxr-xr-xcontrib/test_mklog.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/contrib/test_mklog.py b/contrib/test_mklog.py
index ef7f2b1a594..344b7a2c771 100755
--- a/contrib/test_mklog.py
+++ b/contrib/test_mklog.py
@@ -30,6 +30,11 @@ import unittest
from mklog import generate_changelog
+import unidiff
+
+unidiff_supports_renaming = hasattr(unidiff.PatchedFile(), 'is_rename')
+
+
PATCH1 = '''\
diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h
index 567c23380fe..e6209ede9d6 100644
@@ -379,6 +384,21 @@ gcc/testsuite/ChangeLog:
'''
+PATCH8 = '''\
+diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf2.c
+similarity index 100%
+rename from gcc/ipa-icf.c
+rename to gcc/ipa-icf2.c
+'''
+
+EXPECTED8 = '''\
+gcc/ChangeLog:
+
+ * ipa-icf.c: Moved to...
+ * ipa-icf2.c: ...here.
+
+'''
+
class TestMklog(unittest.TestCase):
def test_macro_definition(self):
changelog = generate_changelog(PATCH1)
@@ -411,3 +431,9 @@ class TestMklog(unittest.TestCase):
def test_dr_detection_in_test_case(self):
changelog = generate_changelog(PATCH7)
assert changelog == EXPECTED7
+
+ @unittest.skipIf(not unidiff_supports_renaming,
+ 'Newer version of unidiff is needed (0.6.0+)')
+ def test_renaming(self):
+ changelog = generate_changelog(PATCH8)
+ assert changelog == EXPECTED8