OSDN Git Service

ART: Fixed subsequent CHECK-NOTs Checker bug
authorDavid Brazdil <dbrazdil@google.com>
Thu, 8 Jan 2015 01:49:53 +0000 (01:49 +0000)
committerDavid Brazdil <dbrazdil@google.com>
Thu, 8 Jan 2015 19:50:17 +0000 (19:50 +0000)
Matching a group of CHECK-NOT lines caused Checker to crash due to
incorrectly overwriting the varState variable. The second use of the
variable was renamed and a regression test added.

Change-Id: I1a879cf5368acca6b5092f69a9caa47b89a79532

tools/checker.py
tools/checker_test.py

index 5e910ec..0813d0c 100755 (executable)
@@ -440,9 +440,9 @@ class CheckGroup(CommonEqualityMixin):
   def __matchNotLines(self, checkLines, outputLines, startLineNo, varState):
     for checkLine in checkLines:
       assert checkLine.variant == CheckLine.Variant.Not
-      matchLineNo, varState = \
+      matchLineNo, matchVarState = \
         self.__findFirstMatch(checkLine, outputLines, startLineNo, [], varState)
-      if varState is not None:
+      if matchVarState is not None:
         Logger.testFailed("CHECK-NOT line \"" + checkLine.content + "\" matches output line " + \
                           str(matchLineNo), self.fileName, checkLine.lineNo)
 
index 9b04ab0..2846a9c 100755 (executable)
@@ -342,6 +342,10 @@ class TestCheckGroup_Match(unittest.TestCase):
     self.__notMatchMulti([("foo", CheckVariant.Not)],
                          """abc foo
                             def""")
+    self.__notMatchMulti([("foo", CheckVariant.Not),
+                          ("bar", CheckVariant.Not)],
+                         """abc
+                            def bar""")
 
   def test_LineOnlyMatchesOnce(self):
     self.__matchMulti([("foo", CheckVariant.DAG),