Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: tools/isolate/data/gtest_fake/gtest_fake_fail.py

Issue 10825010: Run_test_case.py now returns 1 when at least 1 test fails. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/isolate/data/gtest_fake/gtest_fake_fail.py
diff --git a/tools/isolate/data/gtest_fake/gtest_fake.py b/tools/isolate/data/gtest_fake/gtest_fake_fail.py
old mode 100755
new mode 100644
similarity index 53%
rename from tools/isolate/data/gtest_fake/gtest_fake.py
rename to tools/isolate/data/gtest_fake/gtest_fake_fail.py
index 32a285c529bf442f82314ba88d8246988a1a6829..953cf30e76970fb7d9644bb5923c8e25afaa73da
--- a/tools/isolate/data/gtest_fake/gtest_fake.py
+++ b/tools/isolate/data/gtest_fake/gtest_fake_fail.py
@@ -3,7 +3,7 @@
# 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.
+"""Simulate a failing google-test executable.
http://code.google.com/p/googletest/
"""
@@ -11,6 +11,8 @@ http://code.google.com/p/googletest/
import optparse
import sys
+import gtest_fake_base
+
TESTS = {
'Foo': ['Bar1', 'Bar2', 'Bar3'],
@@ -18,36 +20,6 @@ TESTS = {
}
TOTAL = sum(len(v) for v in TESTS.itervalues())
-
-def get_test_output(test_name):
- fixture, case = test_name.split('.', 1)
- return (
- '[==========] Running 1 test from 1 test case.\n'
- '[----------] Global test environment set-up.\n'
- '[----------] 1 test from %(fixture)s\n'
- '[ RUN ] %(fixture)s.%(case)s\n'
- '[ OK ] %(fixture)s.%(case)s (0 ms)\n'
- '[----------] 1 test from %(fixture)s (0 ms total)\n'
- '\n') % {
- 'fixture': fixture,
- 'case': case,
- }
-
-
-def get_footer(number):
- return (
- '[----------] Global test environment tear-down\n'
- '[==========] %(number)d test from %(total)d test case ran. (0 ms total)\n'
- '[ PASSED ] %(number)d test.\n'
- '\n'
- ' YOU HAVE 5 DISABLED TESTS\n'
- '\n'
- ' YOU HAVE 2 tests with ignored failures (FAILS prefix)\n') % {
- 'number': number,
- 'total': TOTAL,
- }
-
-
def main():
parser = optparse.OptionParser()
parser.add_option('--gtest_list_tests', action='store_true')
@@ -68,15 +40,15 @@ def main():
if options.gtest_filter:
# Simulate running one test.
print 'Note: Google Test filter = %s\n' % options.gtest_filter
- print get_test_output(options.gtest_filter)
- print get_footer(1)
+ print gtest_fake_base.get_test_output(options.gtest_filter)
+ print gtest_fake_base.get_footer(1, 1)
# Make Baz.Fail fail.
return options.gtest_filter == 'Baz.Fail'
for fixture, cases in TESTS.iteritems():
for case in cases:
- print get_test_output('%s.%s' % (fixture, case))
- print get_footer(TOTAL)
+ print gtest_fake_base.get_test_output('%s.%s' % (fixture, case))
+ print gtest_fake_base.get_footer(TOTAL, TOTAL)
return 1

Powered by Google App Engine
This is Rietveld 408576698