diff options
author | David Brazdil <dbrazdil@google.com> | 2015-01-27 15:54:30 +0000 |
---|---|---|
committer | David Brazdil <dbrazdil@google.com> | 2015-01-27 18:19:37 +0000 |
commit | b86e77937e824940d087b7c5999c79e5c38b00c8 (patch) | |
tree | f2559877c27148e1a2d0b5baf4df8a0d304b5c52 /tools/checker_test.py | |
parent | 8c776cd9186e68c23b0983415ae14798e5ea5ab3 (diff) | |
download | art-b86e77937e824940d087b7c5999c79e5c38b00c8.zip art-b86e77937e824940d087b7c5999c79e5c38b00c8.tar.gz art-b86e77937e824940d087b7c5999c79e5c38b00c8.tar.bz2 |
Checker: Allow don't-care output on a line
This patch changes the behaviour of whitespace characters in CHECK
lines, allowing for additional content between verified parts of the
matched output line. Tests therefore won't need to explicitly match
attributes which are not tested.
The way attributes are printed ensures that the right part of the
line is matched against.
Example:
- output line: i32 Div [ i4 i8 ] ( loop_header:null )
- CHECK before: Div [ {{i\d+}} {{i\d+}} ] ( loop_header:null )
- CHECK now: Div ( loop_header:null )
Change-Id: Icf6bacfb285ae288bea21640e860a871a94cc386
Diffstat (limited to 'tools/checker_test.py')
-rwxr-xr-x | tools/checker_test.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/checker_test.py b/tools/checker_test.py index 18152b5..667ca90 100755 --- a/tools/checker_test.py +++ b/tools/checker_test.py @@ -60,8 +60,14 @@ class TestCheckFile_PrefixExtraction(unittest.TestCase): class TestCheckLine_Parse(unittest.TestCase): + def __getPartPattern(self, linePart): + if linePart.variant == checker.CheckElement.Variant.Separator: + return "\s+" + else: + return linePart.pattern + def __getRegex(self, checkLine): - return "".join(map(lambda x: "(" + x.pattern + ")", checkLine.lineParts)) + return "".join(map(lambda x: "(" + self.__getPartPattern(x) + ")", checkLine.lineParts)) def __tryParse(self, string): return checker.CheckLine(string) @@ -188,14 +194,17 @@ class TestCheckLine_Match(unittest.TestCase): def test_TextAndWhitespace(self): self.__matchSingle("foo", "foo") - self.__matchSingle("foo", "XfooX") + self.__matchSingle("foo", " foo ") self.__matchSingle("foo", "foo bar") + self.__notMatchSingle("foo", "XfooX") self.__notMatchSingle("foo", "zoo") self.__matchSingle("foo bar", "foo bar") self.__matchSingle("foo bar", "abc foo bar def") self.__matchSingle("foo bar", "foo foo bar bar") - self.__notMatchSingle("foo bar", "foo abc bar") + + self.__matchSingle("foo bar", "foo X bar") + self.__notMatchSingle("foo bar", "foo Xbar") def test_Pattern(self): self.__matchSingle("foo{{A|B}}bar", "fooAbar") |