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

Side by Side Diff: native_client_sdk/src/test_all.py

Issue 835773003: [NaCl SDK] Store python coverage output data in 'out' directory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « native_client_sdk/src/Makefile ('k') | native_client_sdk/src/tools/tests/httpd_test.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 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 """Top level script for running all python unittests in the NaCl SDK 6 """Top level script for running all python unittests in the NaCl SDK.
7 """ 7 """
8 8
9 from __future__ import print_function 9 from __future__ import print_function
10 10
11 import argparse 11 import argparse
12 import os 12 import os
13 import subprocess 13 import subprocess
14 import sys 14 import sys
15 import unittest 15 import unittest
16 16
(...skipping 11 matching lines...) Expand all
28 import build_paths 28 import build_paths
29 29
30 PKG_VER_DIR = os.path.join(build_paths.NACL_DIR, 'build', 'package_version') 30 PKG_VER_DIR = os.path.join(build_paths.NACL_DIR, 'build', 'package_version')
31 TAR_DIR = os.path.join(build_paths.NACL_DIR, 'toolchain', '.tars') 31 TAR_DIR = os.path.join(build_paths.NACL_DIR, 'toolchain', '.tars')
32 32
33 PKG_VER = os.path.join(PKG_VER_DIR, 'package_version.py') 33 PKG_VER = os.path.join(PKG_VER_DIR, 'package_version.py')
34 34
35 EXTRACT_PACKAGES = ['nacl_x86_glibc'] 35 EXTRACT_PACKAGES = ['nacl_x86_glibc']
36 TOOLCHAIN_OUT = os.path.join(build_paths.OUT_DIR, 'sdk_tests', 'toolchain') 36 TOOLCHAIN_OUT = os.path.join(build_paths.OUT_DIR, 'sdk_tests', 'toolchain')
37 37
38 # List of modules containing unittests. The goal is to keep the total
39 # runtime of these tests under 2 seconds. Any slower tests should go
40 # in TEST_MODULES_BIG.
38 TEST_MODULES = [ 41 TEST_MODULES = [
39 'build_artifacts_test', 42 'build_artifacts_test',
40 'build_version_test', 43 'build_version_test',
41 'create_html_test', 44 'create_html_test',
42 'create_nmf_test', 45 'create_nmf_test',
43 'easy_template_test', 46 'easy_template_test',
44 'elf_test', 47 'elf_test',
45 'fix_deps_test', 48 'fix_deps_test',
46 'getos_test', 49 'getos_test',
47 'get_shared_deps_test', 50 'get_shared_deps_test',
48 'httpd_test', 51 'httpd_test',
49 'nacl_config_test', 52 'nacl_config_test',
50 'oshelpers_test', 53 'oshelpers_test',
51 'parse_dsc_test', 54 'parse_dsc_test',
52 'quote_test', 55 'quote_test',
53 'sdktools_commands_test',
54 'sdktools_config_test', 56 'sdktools_config_test',
55 'sdktools_test',
56 'sel_ldr_test', 57 'sel_ldr_test',
57 'update_nacl_manifest_test', 58 'update_nacl_manifest_test',
58 'verify_filelist_test', 59 'verify_filelist_test',
59 'verify_ppapi_test', 60 'verify_ppapi_test',
60 ] 61 ]
61 62
63
64 # Slower tests. For example the 'sdktools' are mostly slower system tests
65 # that longer to run. If --quick is passed then we don't run these.
66 TEST_MODULES_BIG = [
67 'sdktools_commands_test',
68 'sdktools_test',
69 ]
70
71
62 def ExtractToolchains(): 72 def ExtractToolchains():
63 subprocess.check_output([sys.executable, PKG_VER, 73 cmd = [sys.executable, PKG_VER,
64 '--packages', ','.join(EXTRACT_PACKAGES), 74 '--packages', ','.join(EXTRACT_PACKAGES),
65 '--tar-dir', TAR_DIR, 75 '--tar-dir', TAR_DIR,
66 '--dest-dir', TOOLCHAIN_OUT, 76 '--dest-dir', TOOLCHAIN_OUT,
67 'extract']) 77 'extract']
78 subprocess.check_call(cmd)
79
68 80
69 def main(args): 81 def main(args):
70 parser = argparse.ArgumentParser(description=__doc__) 82 parser = argparse.ArgumentParser(description=__doc__)
71 parser.add_argument('-v', '--verbose', action='store_true') 83 parser.add_argument('-v', '--verbose', action='store_true')
84 parser.add_argument('--quick', action='store_true')
72 options = parser.parse_args(args) 85 options = parser.parse_args(args)
73 86
74 # Some of the unit tests use parts of toolchains. Extract to TOOLCHAIN_OUT. 87 # Some of the unit tests use parts of toolchains. Extract to TOOLCHAIN_OUT.
75 print('Extracting toolchains...') 88 print('Extracting toolchains...')
76 ExtractToolchains() 89 ExtractToolchains()
77 90
78 suite = unittest.TestSuite() 91 suite = unittest.TestSuite()
79 for module_name in TEST_MODULES: 92 modules = TEST_MODULES
93 if not options.quick:
94 modules += TEST_MODULES_BIG
95
96 for module_name in modules:
80 module = __import__(module_name) 97 module = __import__(module_name)
81 suite.addTests(unittest.defaultTestLoader.loadTestsFromModule(module)) 98 suite.addTests(unittest.defaultTestLoader.loadTestsFromModule(module))
82 99
83 if options.verbose: 100 if options.verbose:
84 verbosity = 2 101 verbosity = 2
85 else: 102 else:
86 verbosity = 1 103 verbosity = 1
87 104
88 print('Running unittests...') 105 print('Running unittests...')
89 result = unittest.TextTestRunner(verbosity=verbosity).run(suite) 106 result = unittest.TextTestRunner(verbosity=verbosity).run(suite)
90 return int(not result.wasSuccessful()) 107 return int(not result.wasSuccessful())
91 108
109
92 if __name__ == '__main__': 110 if __name__ == '__main__':
93 sys.exit(main(sys.argv[1:])) 111 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « native_client_sdk/src/Makefile ('k') | native_client_sdk/src/tools/tests/httpd_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698