| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2015 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2015 The Native Client 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 # This script runs the tests for compiler_rt. It is meant to run on a | 6 # This script runs the tests for compiler_rt. It is meant to run on a |
| 7 # fully-constructed toolchain (as opposed to being run during the compiler-rt | 7 # fully-constructed toolchain (as opposed to being run during the compiler-rt |
| 8 # build process) because the tests need libc/libnacl to link. | 8 # build process) because the tests need libc/libnacl to link. |
| 9 | 9 |
| 10 import os | 10 import os |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 tests = get_tests(functions, test_src_dir) | 57 tests = get_tests(functions, test_src_dir) |
| 58 run_py = find_run_py() | 58 run_py = find_run_py() |
| 59 failures = 0 | 59 failures = 0 |
| 60 workdir = tempfile.mkdtemp() | 60 workdir = tempfile.mkdtemp() |
| 61 | 61 |
| 62 for test in tests: | 62 for test in tests: |
| 63 flags = ['-lm'] | 63 flags = ['-lm'] |
| 64 exe_suffix = '.pexe' if 'pnacl-clang' in cc else '.nexe' | 64 exe_suffix = '.pexe' if 'pnacl-clang' in cc else '.nexe' |
| 65 nexe = os.path.join(workdir, os.path.basename(test + exe_suffix)) | 65 nexe = os.path.join(workdir, os.path.basename(test + exe_suffix)) |
| 66 build_cmd = [cc, '-I' + inc_dir, '-o', nexe, test] + flags | 66 build_cmd = [cc, '-I' + inc_dir, '-o', nexe, test] + flags |
| 67 run_cmd = [run_py, nexe] | 67 run_cmd = [run_py, '-arch', 'env', nexe] |
| 68 try: | 68 try: |
| 69 print ' '.join(build_cmd) | 69 print ' '.join(build_cmd) |
| 70 subprocess.check_call(build_cmd) | 70 subprocess.check_call(build_cmd) |
| 71 print ' '.join(run_cmd) | 71 print ' '.join(run_cmd) |
| 72 subprocess.check_call(run_cmd) | 72 subprocess.check_call(run_cmd) |
| 73 except subprocess.CalledProcessError, e: | 73 except subprocess.CalledProcessError, e: |
| 74 print '[ FAILED ]:', test | 74 print '[ FAILED ]:', test |
| 75 print e | 75 print e |
| 76 failures += 1 | 76 failures += 1 |
| 77 | 77 |
| 78 shutil.rmtree(workdir) | 78 shutil.rmtree(workdir) |
| 79 return failures | 79 return failures |
| 80 | 80 |
| 81 if __name__ == '__main__': | 81 if __name__ == '__main__': |
| 82 sys.exit(main(sys.argv)) | 82 sys.exit(main(sys.argv)) |
| OLD | NEW |