Skip to content

Commit

Permalink
[Android] Fix type-parameterized gtest parsing.
Browse files Browse the repository at this point in the history
BUG=

Review URL: https://codereview.chromium.org/441023002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287701 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
jbudorick@chromium.org committed Aug 6, 2014
1 parent 3ea5a0d commit a210052
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 18 deletions.
17 changes: 7 additions & 10 deletions build/android/pylib/gtest/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,11 @@ def _ParseGTestListTests(raw_list):
for test in raw_list:
if not test:
continue
if test[0] != ' ' and not test.endswith('.'):
# Ignore any lines with unexpected format.
continue
if test[0] != ' ' and test.endswith('.'):
current = test
continue
if 'YOU HAVE' in test:
break
test_name = test.split(None, 1)[0]
ret += [current + test_name]
if test[0] != ' ':
test_case = test.split()[0]
if test_case.endswith('.'):
current = test_case
elif not 'YOU HAVE' in test:
test_name = test.split()[0]
ret += [current + test_name]
return ret
42 changes: 34 additions & 8 deletions build/android/pylib/gtest/test_package_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,55 @@ def testParseGTestListTests_simple(self):
]
self.assertEqual(expected, actual)

def testParseGTestListTests_parameterized_old(self):
def testParseGTestListTests_typeParameterized_old(self):
raw_output = [
'PTestCase.',
'TPTestCase/WithTypeParam/0.',
' testOne',
' testTwo',
]
actual = test_package.TestPackage._ParseGTestListTests(raw_output)
expected = [
'TPTestCase/WithTypeParam/0.testOne',
'TPTestCase/WithTypeParam/0.testTwo',
]
self.assertEqual(expected, actual)

def testParseGTestListTests_typeParameterized_new(self):
raw_output = [
'TPTestCase/WithTypeParam/0. # TypeParam = TypeParam0',
' testOne',
' testTwo',
]
actual = test_package.TestPackage._ParseGTestListTests(raw_output)
expected = [
'TPTestCase/WithTypeParam/0.testOne',
'TPTestCase/WithTypeParam/0.testTwo',
]
self.assertEqual(expected, actual)

def testParseGTestListTests_valueParameterized_old(self):
raw_output = [
'VPTestCase.',
' testWithValueParam/0',
' testWithValueParam/1',
]
actual = test_package.TestPackage._ParseGTestListTests(raw_output)
expected = [
'PTestCase.testWithValueParam/0',
'PTestCase.testWithValueParam/1',
'VPTestCase.testWithValueParam/0',
'VPTestCase.testWithValueParam/1',
]
self.assertEqual(expected, actual)

def testParseGTestListTests_parameterized_new(self):
def testParseGTestListTests_valueParameterized_new(self):
raw_output = [
'PTestCase.',
'VPTestCase.',
' testWithValueParam/0 # GetParam() = 0',
' testWithValueParam/1 # GetParam() = 1',
]
actual = test_package.TestPackage._ParseGTestListTests(raw_output)
expected = [
'PTestCase.testWithValueParam/0',
'PTestCase.testWithValueParam/1',
'VPTestCase.testWithValueParam/0',
'VPTestCase.testWithValueParam/1',
]
self.assertEqual(expected, actual)

Expand Down

0 comments on commit a210052

Please sign in to comment.