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

Side by Side Diff: tools/isolate/trace_test_cases_smoke_test.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, 4 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 unified diff | Download patch
« no previous file with comments | « tools/isolate/run_test_cases_smoke_test.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import json 6 import json
7 import logging 7 import logging
8 import os 8 import os
9 import re 9 import re
10 import subprocess 10 import subprocess
11 import sys 11 import sys
12 import tempfile 12 import tempfile
13 import unittest 13 import unittest
14 14
15 import trace_inputs 15 import trace_inputs
16 16
17 FILE_PATH = os.path.realpath(unicode(os.path.abspath(__file__))) 17 FILE_PATH = os.path.realpath(unicode(os.path.abspath(__file__)))
18 ROOT_DIR = os.path.dirname(FILE_PATH) 18 ROOT_DIR = os.path.dirname(FILE_PATH)
19 TARGET_PATH = os.path.join(ROOT_DIR, 'data', 'gtest_fake', 'gtest_fake.py') 19 TARGET_UTIL_PATH = os.path.join(ROOT_DIR, 'data', 'gtest_fake',
20 'gtest_fake_base.py')
21 TARGET_PATH = os.path.join(ROOT_DIR, 'data', 'gtest_fake', 'gtest_fake_fail.py')
20 22
21 23
22 class TraceTestCases(unittest.TestCase): 24 class TraceTestCases(unittest.TestCase):
23 def setUp(self): 25 def setUp(self):
24 self.temp_file = None 26 self.temp_file = None
25 27
26 self.initial_cwd = ROOT_DIR 28 self.initial_cwd = ROOT_DIR
27 if sys.platform == 'win32': 29 if sys.platform == 'win32':
28 # Windows has no kernel mode concept of current working directory. 30 # Windows has no kernel mode concept of current working directory.
29 self.initial_cwd = None 31 self.initial_cwd = None
(...skipping 26 matching lines...) Expand all
56 u'root': { 58 u'root': {
57 u'children': [], 59 u'children': [],
58 u'command': [ 60 u'command': [
59 self.executable, 61 self.executable,
60 TARGET_PATH, 62 TARGET_PATH,
61 u'--gtest_filter=%s' % test_case, 63 u'--gtest_filter=%s' % test_case,
62 ], 64 ],
63 u'executable': self.real_executable, 65 u'executable': self.real_executable,
64 u'files': [ 66 u'files': [
65 { 67 {
66 u'path': os.path.join(u'data', 'gtest_fake', 'gtest_fake.py'), 68 u'path': os.path.join(u'data', 'gtest_fake',
69 'gtest_fake_base.py'),
70 u'size': os.stat(TARGET_UTIL_PATH).st_size,
71 },
72 {
73 u'path': os.path.join(u'data', 'gtest_fake',
74 'gtest_fake_fail.py'),
67 u'size': os.stat(TARGET_PATH).st_size, 75 u'size': os.stat(TARGET_PATH).st_size,
68 }, 76 },
69 ], 77 ],
70 u'initial_cwd': self.initial_cwd, 78 u'initial_cwd': self.initial_cwd,
71 }, 79 },
72 }, 80 },
73 u'valid': True, 81 u'valid': True,
74 u'variables': { 82 u'variables': {
75 u'isolate_dependency_tracked': [ 83 u'isolate_dependency_tracked': [
76 u'<(PRODUCT_DIR)/gtest_fake/gtest_fake.py', 84 u'<(PRODUCT_DIR)/gtest_fake/gtest_fake_base.py',
85 u'<(PRODUCT_DIR)/gtest_fake/gtest_fake_fail.py',
77 ], 86 ],
78 }, 87 },
79 } 88 }
80 89
81 def _strip_result(self, result): 90 def _strip_result(self, result):
82 """Strips mutable information from a flattened test case Results.""" 91 """Strips mutable information from a flattened test case Results."""
83 self.assertTrue(result.pop('duration') > 0.) 92 self.assertTrue(result.pop('duration') > 0.)
84 self.assertTrue(len(result.pop('output')) > 10) 93 self.assertTrue(len(result.pop('output')) > 10)
85 def strip_pid(proc): 94 def strip_pid(proc):
86 self.assertTrue(proc.pop('pid') > 100) 95 self.assertTrue(proc.pop('pid') > 100)
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 # Trim off 'duration' and 'output', they don't have a constant value. 155 # Trim off 'duration' and 'output', they don't have a constant value.
147 for value in result.itervalues(): 156 for value in result.itervalues():
148 self._strip_result(value) 157 self._strip_result(value)
149 self.assertEquals(expected_json, result) 158 self.assertEquals(expected_json, result)
150 159
151 160
152 if __name__ == '__main__': 161 if __name__ == '__main__':
153 VERBOSE = '-v' in sys.argv 162 VERBOSE = '-v' in sys.argv
154 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR) 163 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR)
155 unittest.main() 164 unittest.main()
OLDNEW
« no previous file with comments | « tools/isolate/run_test_cases_smoke_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698