summaryrefslogtreecommitdiffstats
path: root/tools/checker_test.py
diff options
context:
space:
mode:
authorDavid Brazdil <dbrazdil@google.com>2015-01-08 18:44:19 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-01-08 18:44:20 +0000
commit7e1a34386368d2bb3dc89bf5aa0519cafc326095 (patch)
tree2be00ab22edf157aec29bae06f2d185fe096b298 /tools/checker_test.py
parentd1382174c76ede94cfbc78cc02476f9a1c254813 (diff)
parent2e15cd2cf19753e5d72ddad607efea6ae7617e80 (diff)
downloadandroid_art-7e1a34386368d2bb3dc89bf5aa0519cafc326095.tar.gz
android_art-7e1a34386368d2bb3dc89bf5aa0519cafc326095.tar.bz2
android_art-7e1a34386368d2bb3dc89bf5aa0519cafc326095.zip
Merge "ART: Improved fail reporting in Checker"
Diffstat (limited to 'tools/checker_test.py')
-rwxr-xr-xtools/checker_test.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/tools/checker_test.py b/tools/checker_test.py
index 8947d8a076..9b04ab0d91 100755
--- a/tools/checker_test.py
+++ b/tools/checker_test.py
@@ -21,6 +21,11 @@ import checker
import io
import unittest
+# The parent type of exception expected to be thrown by Checker during tests.
+# It must be specific enough to not cover exceptions thrown due to actual flaws
+# in Checker..
+CheckerException = SystemExit
+
class TestCheckFile_PrefixExtraction(unittest.TestCase):
def __tryParse(self, string):
@@ -65,7 +70,7 @@ class TestCheckLine_Parse(unittest.TestCase):
self.assertEqual(expected, self.__getRegex(self.__tryParse(string)))
def __tryParseNot(self, string):
- return checker.CheckLine(string, checker.CheckLine.Variant.UnorderedNot)
+ return checker.CheckLine(string, checker.CheckLine.Variant.Not)
def __parsesPattern(self, string, pattern):
line = self.__tryParse(string)
@@ -167,7 +172,7 @@ class TestCheckLine_Parse(unittest.TestCase):
self.__parsesTo("[[ABC:abc]][[DEF:def]]", "(abc)(def)")
def test_NoVarDefsInNotChecks(self):
- with self.assertRaises(Exception):
+ with self.assertRaises(CheckerException):
self.__tryParseNot("[[ABC:abc]]")
class TestCheckLine_Match(unittest.TestCase):
@@ -203,7 +208,7 @@ class TestCheckLine_Match(unittest.TestCase):
self.__matchSingle("foo[[X]]bar", "fooBbar", {"X": "B"})
self.__notMatchSingle("foo[[X]]bar", "foobar", {"X": "A"})
self.__notMatchSingle("foo[[X]]bar", "foo bar", {"X": "A"})
- with self.assertRaises(Exception):
+ with self.assertRaises(CheckerException):
self.__matchSingle("foo[[X]]bar", "foobar", {})
def test_VariableDefinition(self):
@@ -221,7 +226,7 @@ class TestCheckLine_Match(unittest.TestCase):
self.__notMatchSingle("foo[[X:A|B]]bar[[X]]baz", "fooAbarBbaz")
def test_NoVariableRedefinition(self):
- with self.assertRaises(Exception):
+ with self.assertRaises(CheckerException):
self.__matchSingle("[[X:...]][[X]][[X:...]][[X]]", "foofoobarbar")
def test_EnvNotChangedOnPartialMatch(self):
@@ -255,7 +260,7 @@ class TestCheckGroup_Match(unittest.TestCase):
return checkGroup.match(outputGroup)
def __notMatchMulti(self, checkString, outputString):
- with self.assertRaises(Exception):
+ with self.assertRaises(CheckerException):
self.__matchMulti(checkString, outputString)
def test_TextAndPattern(self):
@@ -448,4 +453,5 @@ class TestCheckFile_Parse(unittest.TestCase):
("def", CheckVariant.DAG) ])) ])
if __name__ == '__main__':
+ checker.Logger.SilentMode = True
unittest.main()