| Index: native_client_sdk/src/test_all.py
|
| diff --git a/native_client_sdk/src/test_all.py b/native_client_sdk/src/test_all.py
|
| index c91e64e59c98eafa0aec8aef9da2c029b367b956..034be0db656190beb0c011d104fdab7f723f8c50 100755
|
| --- a/native_client_sdk/src/test_all.py
|
| +++ b/native_client_sdk/src/test_all.py
|
| @@ -4,14 +4,26 @@
|
| # found in the LICENSE file.
|
|
|
| import os
|
| +import shutil
|
| import sys
|
| +import tarfile
|
| import unittest
|
|
|
| # add tools folder to sys.path
|
| SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
| -sys.path.append(os.path.join(SCRIPT_DIR, 'tools', 'tests'))
|
| -sys.path.append(os.path.join(SCRIPT_DIR, 'tools', 'lib', 'tests'))
|
| -sys.path.append(os.path.join(SCRIPT_DIR, 'build_tools', 'tests'))
|
| +TOOLS_DIR = os.path.join(SCRIPT_DIR, 'tools')
|
| +BUILD_TOOLS_DIR = os.path.join(SCRIPT_DIR, 'build_tools')
|
| +sys.path.append(TOOLS_DIR)
|
| +sys.path.append(os.path.join(TOOLS_DIR, 'tests'))
|
| +sys.path.append(os.path.join(TOOLS_DIR, 'lib', 'tests'))
|
| +sys.path.append(BUILD_TOOLS_DIR)
|
| +sys.path.append(os.path.join(BUILD_TOOLS_DIR, 'tests'))
|
| +
|
| +import build_paths
|
| +import getos
|
| +
|
| +TOOLCHAIN_OUT = os.path.join(build_paths.OUT_DIR, 'sdk_tests', 'toolchain')
|
| +NACL_X86_GLIBC_TOOLCHAIN = os.path.join(TOOLCHAIN_OUT, 'nacl_x86_glibc')
|
|
|
| TEST_MODULES = [
|
| 'create_html_test',
|
| @@ -35,7 +47,45 @@ TEST_MODULES = [
|
| 'verify_ppapi_test',
|
| ]
|
|
|
| +def ExtractToolchain():
|
| + # TODO(dyen): This function is basically all temporary code. After the DEPS
|
| + # roll, replace this untar with package_version.py which will do the
|
| + # untarring and be able to check whether or not the toolchain is out of date.
|
| + platform_name = getos.GetPlatform()
|
| + nacl_x86_glibc_tar = os.path.join(build_paths.NACL_DIR, 'toolchain', '.tars',
|
| + 'toolchain_%s_x86.tar.bz2' % platform_name)
|
| + assert os.path.isfile(nacl_x86_glibc_tar), 'Could not locate toolchain tar'
|
| +
|
| + stamp_file = os.path.join(NACL_X86_GLIBC_TOOLCHAIN, 'extract.stamp')
|
| + if (not os.path.isfile(stamp_file) or
|
| + os.path.getmtime(stamp_file) < os.path.getmtime(nacl_x86_glibc_tar)):
|
| +
|
| + print 'Extracting nacl_x86_glibc...'
|
| + temp_dir = os.path.join(TOOLCHAIN_OUT, 'temp')
|
| + if os.path.isdir(temp_dir):
|
| + shutil.rmtree(temp_dir)
|
| + os.makedirs(temp_dir)
|
| + with tarfile.open(nacl_x86_glibc_tar) as f:
|
| + f.extractall(temp_dir)
|
| +
|
| + if os.path.isdir(NACL_X86_GLIBC_TOOLCHAIN):
|
| + shutil.rmtree(NACL_X86_GLIBC_TOOLCHAIN)
|
| + parent_dir = os.path.dirname(NACL_X86_GLIBC_TOOLCHAIN)
|
| + if not os.path.isdir(parent_dir):
|
| + os.makedirs(parent_dir)
|
| +
|
| + extracted_path = os.path.join(temp_dir, 'toolchain',
|
| + '%s_x86' % platform_name)
|
| + os.rename(extracted_path, NACL_X86_GLIBC_TOOLCHAIN)
|
| +
|
| + with open(stamp_file, 'wt') as f:
|
| + f.write(nacl_x86_glibc_tar)
|
| +
|
| def main():
|
| + # Some of the unit tests utilize nacl_x86_glibc. Untar a copy in the output
|
| + # directory for the tests to use.
|
| + ExtractToolchain()
|
| +
|
| suite = unittest.TestSuite()
|
| for module_name in TEST_MODULES:
|
| module = __import__(module_name)
|
|
|