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

Side by Side Diff: systrace/bin/run_tests

Issue 2295913002: Enable some profile_chrome unit tests on Trybots (Closed) Base URL: https://chromium.googlesource.com/external/github.com/catapult-project/catapult.git@master
Patch Set: Add Chris as owner of Systrace bin directory Created 4 years, 3 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 | « systrace/bin/OWNERS ('k') | systrace/profile_chrome/agents_unittest.py » ('j') | 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 python2.7 1 #!/usr/bin/env python2.7
2 2
3 # Copyright 2015 The Chromium Authors. All rights reserved. 3 # Copyright 2015 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Runs the unit test suite for systrace.""" 7 """Runs the unit test suite for systrace."""
8 8
9 import optparse 9 import optparse
10 import os 10 import os
11 import sys 11 import sys
12 import unittest 12 import unittest
13 13
14 _SYSTRACE_DIR = os.path.abspath( 14 _SYSTRACE_DIR = os.path.abspath(
15 os.path.join(os.path.dirname(__file__), os.path.pardir)) 15 os.path.join(os.path.dirname(__file__), os.path.pardir))
16 sys.path.insert(0, _SYSTRACE_DIR) 16 sys.path.insert(0, _SYSTRACE_DIR)
17 from systrace import decorators 17 from systrace import decorators
18 18
19 19
20 def main(): 20 def main():
21 parser = optparse.OptionParser() 21 parser = optparse.OptionParser()
22 parser.add_option("-d", "--device", dest="device", 22 parser.add_option("-d", "--device", dest="device",
23 help="device the test runs on", metavar="DEVICE") 23 help="device the test runs on", metavar="DEVICE")
24 options, _args = parser.parse_args() # pylint: disable=unused-variable 24 options, _args = parser.parse_args() # pylint: disable=unused-variable
25 systrace_package_path = os.path.join(_SYSTRACE_DIR, 'systrace')
26 unfiltered_suite = unittest.TestLoader().discover( 25 unfiltered_suite = unittest.TestLoader().discover(
27 systrace_package_path, 26 _SYSTRACE_DIR,
28 pattern = '*_unittest.py', 27 pattern = '*_unittest.py',
29 top_level_dir=_SYSTRACE_DIR) 28 top_level_dir=_SYSTRACE_DIR)
30 suite = unittest.TestSuite() 29 suite = unittest.TestSuite()
31 30
32 for test_group in unfiltered_suite._tests: 31 for test_group in unfiltered_suite._tests:
33 for inner_group in test_group: 32 for inner_group in test_group:
34 for test in inner_group: 33 for test in inner_group:
35 method = getattr( 34 method = getattr(
36 test, test._testMethodName) # pylint: disable=protected-access 35 test, test._testMethodName) # pylint: disable=protected-access
37 if not decorators.ShouldSkip(method, options.device): 36 if not decorators.ShouldSkip(method, options.device):
38 suite.addTest(test) 37 suite.addTest(test)
39 38
40 result = unittest.TextTestRunner(verbosity=2).run(suite) 39 result = unittest.TextTestRunner(verbosity=2).run(suite)
41 if result.wasSuccessful(): 40 if result.wasSuccessful():
42 sys.exit(0) 41 sys.exit(0)
43 else: 42 else:
44 sys.exit(1) 43 sys.exit(1)
45 44
46 if __name__ == '__main__': 45 if __name__ == '__main__':
47 main() 46 main()
OLDNEW
« no previous file with comments | « systrace/bin/OWNERS ('k') | systrace/profile_chrome/agents_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698