ART: Stricter matching of Checker lines
This patch refactors the MatchLines function of Checker and changes it
so that regular expressions must match entire words of C1vis output.
Previously, this could lead to false positives because assertion 'xyz'
translated to 'xyz.*' and hence testing for id 'i12' could be satisfied
by the presence of 'i123'.
Change-Id: Iaeb486c53519b450ea0cd40042ff3048b38d5a7b
diff --git a/tools/checker/match/test.py b/tools/checker/match/test.py
index bb3b1af..0215f50 100644
--- a/tools/checker/match/test.py
+++ b/tools/checker/match/test.py
@@ -137,8 +137,8 @@
// CHECK: abc<<X>>def
""",
"""
- foo bar
- abc def
+ foo0bar
+ abc0def
"""))
self.assertTrue(self.matches(
"""
@@ -161,6 +161,12 @@
abc1235def
"""))
+ def test_WholeWordMustMatch(self):
+ self.assertTrue(self.matches( "// CHECK: b{{.}}r", "abc bar def"))
+ self.assertFalse(self.matches( "// CHECK: b{{.}}r", "abc Xbar def"))
+ self.assertFalse(self.matches( "// CHECK: b{{.}}r", "abc barX def"))
+ self.assertFalse(self.matches( "// CHECK: b{{.}}r", "abc b r def"))
+
def test_InOrderAssertions(self):
self.assertTrue(self.matches(
"""