Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2013 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2013 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 import os | |
| 7 | |
| 8 from buildbot_lib import ( | 6 from buildbot_lib import ( |
| 9 BuildContext, BuildStatus, ParseStandardCommandLine, | 7 BuildContext, BuildStatus, ParseStandardCommandLine, |
| 10 RemoveSconsBuildDirectories, RemoveGypBuildDirectories, RunBuild, | 8 RemoveSconsBuildDirectories, RunBuild, SetupLinuxEnvironment, |
| 11 SetupLinuxEnvironment, SetupMacEnvironment, SetupWindowsEnvironment, SCons, | 9 SetupMacEnvironment, SetupWindowsEnvironment, SCons, Step ) |
| 12 Step ) | |
| 13 | 10 |
| 14 | 11 |
| 15 | 12 def RunSconsTests(status, context): |
| 16 def BuildScriptX86(status, context): | |
| 17 # Clean out build directories. | 13 # Clean out build directories. |
| 18 with Step('clobber', status): | 14 with Step('clobber scons', status): |
| 19 RemoveSconsBuildDirectories() | 15 RemoveSconsBuildDirectories() |
| 20 RemoveGypBuildDirectories() | |
| 21 | 16 |
| 22 # Unlike their arm counterparts we do not run trusted tests on x86 bots. | 17 # Unlike their arm counterparts we do not run trusted tests on x86 bots. |
| 23 # Trusted tests get plenty of coverage by other bots, e.g. nacl-gcc bots. | 18 # Trusted tests get plenty of coverage by other bots, e.g. nacl-gcc bots. |
| 24 # We make the assumption here that there are no "exotic tests" which | 19 # We make the assumption here that there are no "exotic tests" which |
| 25 # are trusted in nature but are somehow depedent on the untrusted TC. | 20 # are trusted in nature but are somehow depedent on the untrusted TC. |
| 26 flags_build = ['skip_trusted_tests=1', 'do_not_run_tests=1'] | 21 flags_build = ['skip_trusted_tests=1', 'do_not_run_tests=1'] |
| 27 flags_run = ['skip_trusted_tests=1'] | 22 flags_run = ['skip_trusted_tests=1'] |
| 28 smoke_tests = ['small_tests', 'medium_tests'] | 23 smoke_tests = ['small_tests', 'medium_tests'] |
| 29 | 24 |
| 30 with Step('build_all', status): | 25 with Step('build_all', status): |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 54 | 49 |
| 55 # Test sandboxed translation | 50 # Test sandboxed translation |
| 56 if not context.Windows() and not context.Mac(): | 51 if not context.Windows() and not context.Mac(): |
| 57 # TODO(dschuff): The standalone sandboxed translator driver does not have | 52 # TODO(dschuff): The standalone sandboxed translator driver does not have |
| 58 # the batch script wrappers, so it can't run on Windows. Either add them to | 53 # the batch script wrappers, so it can't run on Windows. Either add them to |
| 59 # the translator package or make SCons use the pnacl_newlib drivers except | 54 # the translator package or make SCons use the pnacl_newlib drivers except |
| 60 # on the ARM bots where we don't have the pnacl_newlib drivers. | 55 # on the ARM bots where we don't have the pnacl_newlib drivers. |
| 61 # The mac standalone sandboxed translator is flaky. | 56 # The mac standalone sandboxed translator is flaky. |
| 62 # https://code.google.com/p/nativeclient/issues/detail?id=3856 | 57 # https://code.google.com/p/nativeclient/issues/detail?id=3856 |
| 63 | 58 |
| 64 with Step('toolchain_tests_sandboxed_translator', status, | 59 if context['default_scons_platform'] == 'arm': |
| 60 # The ARM sandboxed translator is flaky under qemu. | |
|
Mark Seaborn
2014/07/29 17:11:32
Maybe add "...so run a very small set of tests the
Derek Schuff
2014/07/29 18:41:50
Done.
| |
| 61 sbtc_tests = ['run_hello_world_test_irt'] | |
| 62 else: | |
| 63 sbtc_tests = ['toolchain_tests_irt', 'large_code'] | |
| 64 | |
| 65 with Step('sandboxed_translator_tests', status, | |
| 65 halt_on_fail=False): | 66 halt_on_fail=False): |
| 66 SCons(context, parallel=True, mode=irt_mode, | 67 SCons(context, parallel=True, mode=irt_mode, |
| 68 args=flags_run + ['use_sandboxed_translator=1'] + sbtc_tests) | |
| 69 with Step('sandboxed_translator_fast_tests', status, halt_on_fail=False): | |
| 70 SCons(context, parallel=True, mode=irt_mode, | |
| 67 args=flags_run + ['use_sandboxed_translator=1', | 71 args=flags_run + ['use_sandboxed_translator=1', |
| 68 'toolchain_tests_irt']) | 72 'translate_fast=1'] + sbtc_tests) |
| 69 with Step('toolchain_tests_sandboxed_fast', status, halt_on_fail=False): | 73 |
| 74 if context.Linux() and (context['default_scons_platform'] == 'x86-32' or | |
| 75 context['default_scons_platform'] == 'arm'): | |
| 76 # Test Non-SFI Mode. | |
| 77 # The only architectures that the PNaCl toolchain supports Non-SFI | |
| 78 # versions of are currently x86-32 and ARM, and ARM testing is covered | |
| 79 # by buildbot_pnacl.sh rather than this Python script. | |
| 80 # The x86-64 toolchain bot also runs these tests from buildbot_pnacl.sh | |
| 81 | |
| 82 # TODO(mseaborn): Run small_tests_irt with nonsfi_nacl=1 when it passes, | |
| 83 # instead of the following whitelists of tests. | |
| 84 # These tests pass with both host libc and newlib, on x86-32 and ARM. | |
| 85 nonsfi_tests_common = ['run_' + test + '_test_irt' for test in | |
| 86 'dup', | |
| 87 'float', | |
| 88 'hello_world', | |
| 89 'malloc_realloc_calloc_free', | |
| 90 'stack_alignment', | |
| 91 'syscall'] | |
| 92 # These tests pass with the host libc, on x86-32 and ARM. | |
| 93 nonsfi_tests_host_libc = (nonsfi_tests_common + | |
| 94 ['run_getpid_test_irt', 'toolchain_tests_irt'] + | |
| 95 ['run_' + test + '_test' for test in | |
| 96 'clock_get', | |
| 97 'dup', | |
| 98 'fcntl', | |
| 99 'fork', | |
| 100 'hello_world', | |
| 101 'nanosleep', | |
| 102 'prctl', | |
| 103 'printf', | |
| 104 'pwrite', | |
| 105 'stack_alignment', | |
| 106 'syscall']) | |
| 107 # These tests pass (with host libc) on x86-32 but not ARM | |
| 108 nonsfi_tests_host_libc_x8632 = (nonsfi_tests_host_libc + | |
| 109 ['run_mmap_test', 'run_socket_test']) | |
| 110 | |
| 111 # This uses the newlib-based nonsfi_loader, for which only a subset of | |
| 112 # the tests works so far. | |
| 113 # TODO(hamaji): Enable more tests. | |
| 114 with Step('nonsfi_tests_newlib', status, halt_on_fail=False): | |
| 70 SCons(context, parallel=True, mode=irt_mode, | 115 SCons(context, parallel=True, mode=irt_mode, |
| 71 args=flags_run + ['use_sandboxed_translator=1', 'translate_fast=1', | 116 args=flags_run + ['nonsfi_nacl=1'] + nonsfi_tests_common) |
| 72 'toolchain_tests_irt']) | |
| 73 | 117 |
| 74 # Translator memory consumption regression test | 118 if context['default_scons_platform'] == 'x86-32': |
| 75 with Step('large_code_test', status, halt_on_fail=False): | 119 # Use x86-32 host libc tests. |
| 76 SCons(context, parallel=True, mode=irt_mode, | 120 host_libc_tests = nonsfi_tests_host_libc_x8632 |
| 77 args=flags_run + ['use_sandboxed_translator=1', 'large_code']) | 121 else: |
| 78 | 122 # Use ARM host libc tests. |
| 79 # Test Non-SFI Mode. | 123 host_libc_tests = nonsfi_tests_host_libc |
| 80 # The only architectures that the PNaCl toolchain supports Non-SFI | |
| 81 # versions of are currently x86-32 and ARM, and ARM testing is covered | |
| 82 # by buildbot_pnacl.sh rather than this Python script. | |
| 83 # The x86-64 toolchain bot currently also runs these tests from | |
| 84 # buildbot_pnacl.sh | |
| 85 if context.Linux() and context['default_scons_platform'] == 'x86-32': | |
| 86 with Step('nonsfi_tests', status, halt_on_fail=False): | |
| 87 # TODO(mseaborn): Enable more tests here when they pass. | |
| 88 tests = ['run_' + test + '_test_irt' for test in | |
| 89 ['float', | |
| 90 'hello_world', | |
| 91 'irt_futex', | |
| 92 'malloc_realloc_calloc_free', | |
| 93 'stack_alignment', | |
| 94 'syscall', | |
| 95 'thread']] | |
| 96 # Extra non-IRT-using test to run for x86-32 | |
| 97 tests.extend(['run_clock_get_test', | |
| 98 'run_dup_test', | |
| 99 'run_fcntl_test', | |
| 100 'run_fork_test', | |
| 101 'run_hello_world_test', | |
| 102 'run_mmap_test', | |
| 103 'run_nanosleep_test', | |
| 104 'run_prctl_test', | |
| 105 'run_printf_test', | |
| 106 'run_pwrite_test', | |
| 107 'run_socket_test', | |
| 108 'run_stack_alignment_test', | |
| 109 'run_syscall_test', | |
| 110 'run_thread_test']) | |
| 111 SCons(context, parallel=True, mode=irt_mode, | |
| 112 args=flags_run + ['nonsfi_nacl=1'] + tests) | |
| 113 | |
| 114 # Test nonsfi_loader linked against host's libc. | 124 # Test nonsfi_loader linked against host's libc. |
| 115 with Step('nonsfi_tests_host_libc', status, halt_on_fail=False): | 125 with Step('nonsfi_tests_host_libc', status, halt_on_fail=False): |
| 116 tests = ['run_' + test + '_test_irt' for test in | |
| 117 ['dup', | |
| 118 'float', | |
| 119 'getpid', | |
| 120 'hello_world', | |
| 121 'irt_futex', | |
| 122 'malloc_realloc_calloc_free', | |
| 123 'syscall', | |
| 124 'thread']] | |
| 125 # Using skip_nonstable_bitcode=1 here disables the tests for | 126 # Using skip_nonstable_bitcode=1 here disables the tests for |
| 126 # zero-cost C++ exception handling, which don't pass for Non-SFI | 127 # zero-cost C++ exception handling, which don't pass for Non-SFI |
| 127 # mode yet because we don't build libgcc_eh for Non-SFI mode. | 128 # mode yet because we don't build libgcc_eh for Non-SFI mode. |
| 128 tests.extend(['toolchain_tests_irt', | |
| 129 'skip_nonstable_bitcode=1']) | |
| 130 SCons(context, parallel=True, mode=irt_mode, | 129 SCons(context, parallel=True, mode=irt_mode, |
| 131 args=(flags_run + ['nonsfi_nacl=1', 'use_newlib_nonsfi_loader=0'] + | 130 args=(flags_run + ['nonsfi_nacl=1', |
| 132 tests)) | 131 'skip_nonstable_bitcode=1', |
| 132 'use_newlib_nonsfi_loader=0'] + | |
| 133 host_libc_tests)) | |
| 133 | 134 |
| 134 # Test unsandboxed mode. | 135 # Test unsandboxed mode. |
| 135 if ((context.Linux() or context.Mac()) and | 136 if ((context.Linux() or context.Mac()) and |
| 136 context['default_scons_platform'] == 'x86-32'): | 137 context['default_scons_platform'] == 'x86-32'): |
| 137 if context.Linux(): | 138 if context.Linux(): |
| 138 tests = ['run_' + test + '_test_irt' for test in | 139 tests = ['run_' + test + '_test_irt' for test in |
| 139 ['hello_world', 'irt_futex', 'thread', 'float', | 140 ['hello_world', 'irt_futex', 'thread', 'float', |
| 140 'malloc_realloc_calloc_free', 'dup', 'cond_timedwait', | 141 'malloc_realloc_calloc_free', 'dup', 'cond_timedwait', |
| 141 'getpid']] | 142 'getpid']] |
| 142 else: | 143 else: |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 155 | 156 |
| 156 if context.Linux(): | 157 if context.Linux(): |
| 157 SetupLinuxEnvironment(context) | 158 SetupLinuxEnvironment(context) |
| 158 elif context.Windows(): | 159 elif context.Windows(): |
| 159 SetupWindowsEnvironment(context) | 160 SetupWindowsEnvironment(context) |
| 160 elif context.Mac(): | 161 elif context.Mac(): |
| 161 SetupMacEnvironment(context) | 162 SetupMacEnvironment(context) |
| 162 else: | 163 else: |
| 163 raise Exception('Unsupported platform') | 164 raise Exception('Unsupported platform') |
| 164 | 165 |
| 165 RunBuild(BuildScriptX86, status) | 166 RunBuild(RunSconsTests, status) |
| 166 | 167 |
| 167 if __name__ == '__main__': | 168 if __name__ == '__main__': |
| 168 Main() | 169 Main() |
| OLD | NEW |