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
4 # found in the LICENSE file.
11 # add tools folder to sys.path
12 SCRIPT_DIR
= os
.path
.dirname(os
.path
.abspath(__file__
))
13 TOOLS_DIR
= os
.path
.join(SCRIPT_DIR
, 'tools')
14 BUILD_TOOLS_DIR
= os
.path
.join(SCRIPT_DIR
, 'build_tools')
16 sys
.path
.append(TOOLS_DIR
)
17 sys
.path
.append(os
.path
.join(TOOLS_DIR
, 'tests'))
18 sys
.path
.append(os
.path
.join(TOOLS_DIR
, 'lib', 'tests'))
19 sys
.path
.append(BUILD_TOOLS_DIR
)
20 sys
.path
.append(os
.path
.join(BUILD_TOOLS_DIR
, 'tests'))
24 PKG_VER_DIR
= os
.path
.join(build_paths
.NACL_DIR
, 'build', 'package_version')
25 TAR_DIR
= os
.path
.join(build_paths
.NACL_DIR
, 'toolchain', '.tars')
27 PKG_VER
= os
.path
.join(PKG_VER_DIR
, 'package_version.py')
29 EXTRACT_PACKAGES
= ['nacl_x86_glibc']
30 TOOLCHAIN_OUT
= os
.path
.join(build_paths
.OUT_DIR
, 'sdk_tests', 'toolchain')
39 'get_shared_deps_test',
45 'sdktools_commands_test',
46 'sdktools_config_test',
49 'update_nacl_manifest_test',
50 'verify_filelist_test',
54 def ExtractToolchains():
55 subprocess
.check_output([sys
.executable
, PKG_VER
,
56 '--packages', ','.join(EXTRACT_PACKAGES
),
58 '--dest-dir', TOOLCHAIN_OUT
,
62 # Some of the unit tests use parts of toolchains. Extract to TOOLCHAIN_OUT.
65 suite
= unittest
.TestSuite()
66 for module_name
in TEST_MODULES
:
67 module
= __import__(module_name
)
68 suite
.addTests(unittest
.defaultTestLoader
.loadTestsFromModule(module
))
70 result
= unittest
.TextTestRunner(verbosity
=2).run(suite
)
71 return int(not result
.wasSuccessful())
73 if __name__
== '__main__':