Commit 704f767d authored by csharp@chromium.org's avatar csharp@chromium.org

Get run_test_cases.py to fail if it fails to get the list of tests it should run.

BUG=


Review URL: https://chromiumcodereview.appspot.com/10826306

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151556 0039d316-1c4b-4281-b951-d872f2087c98
parent 310f3286
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Simulate a google-test executable that has an error when listing tests.
http://code.google.com/p/googletest/
"""
import optparse
import sys
def main():
parser = optparse.OptionParser()
parser.add_option('--gtest_list_tests', action='store_true')
parser.add_option('--gtest_filter')
options, args = parser.parse_args()
if args:
parser.error('Failed to process args %s' % args)
if options.gtest_list_tests:
sys.stderr.write('Unable to list tests')
return 1
sys.stderr.write('Unable to run tests')
return 1
if __name__ == '__main__':
sys.exit(main())
...@@ -707,7 +707,9 @@ def main(argv): ...@@ -707,7 +707,9 @@ def main(argv):
options.shards) options.shards)
if not test_cases: if not test_cases:
return 0 # If test_cases is None then there was a problem generating the tests to
# run, so this should be considered a failure.
return int(test_cases is None)
if options.no_dump: if options.no_dump:
result_file = None result_file = None
......
...@@ -99,6 +99,17 @@ class TraceTestCases(unittest.TestCase): ...@@ -99,6 +99,17 @@ class TraceTestCases(unittest.TestCase):
] ]
self._check_results(expected_out_re, out, err) self._check_results(expected_out_re, out, err)
def test_simple_gtest_list_error(self):
out, err, return_code = RunTest('gtest_fake_error.py')
expected_out_re = [
'Failed to run .+gtest_fake_error.py',
'Unable to list tests'
]
self.assertEqual(1, return_code)
self._check_results(expected_out_re, out, err)
if __name__ == '__main__': if __name__ == '__main__':
VERBOSE = '-v' in sys.argv VERBOSE = '-v' in sys.argv
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment