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 arch = context['default_scons_platform'] |
| 26 | |
| 27 with Step('build_all ' + arch, status): | |
| 31 SCons(context, parallel=True, args=flags_build) | 28 SCons(context, parallel=True, args=flags_build) |
| 32 | 29 |
| 33 # Normal pexe-mode tests | 30 # Normal pexe-mode tests |
| 34 with Step('smoke_tests', status, halt_on_fail=False): | 31 with Step('smoke_tests ' + arch, status, halt_on_fail=False): |
| 35 SCons(context, parallel=True, args=flags_run + smoke_tests) | 32 SCons(context, parallel=True, args=flags_run + smoke_tests) |
| 36 # Large tests cannot be run in parallel | 33 # Large tests cannot be run in parallel |
| 37 with Step('large_tests', status, halt_on_fail=False): | 34 with Step('large_tests ' + arch, status, halt_on_fail=False): |
| 38 SCons(context, parallel=False, args=flags_run + ['large_tests']) | 35 SCons(context, parallel=False, args=flags_run + ['large_tests']) |
| 39 | 36 |
| 40 # non-pexe-mode tests. Build everything to make sure it all builds in nonpexe | 37 # non-pexe-mode tests. Build everything to make sure it all builds in nonpexe |
| 41 # mode, but just run the nonpexe_tests | 38 # mode, but just run the nonpexe_tests |
| 42 with Step('build_nonpexe', status): | 39 with Step('build_nonpexe ' + arch, status): |
| 43 SCons(context, parallel=True, args=flags_build + ['pnacl_generate_pexe=0']) | 40 SCons(context, parallel=True, args=flags_build + ['pnacl_generate_pexe=0']) |
| 44 with Step('nonpexe_tests', status, halt_on_fail=False): | 41 with Step('nonpexe_tests ' + arch, status, halt_on_fail=False): |
| 45 SCons(context, parallel=True, | 42 SCons(context, parallel=True, |
| 46 args=flags_run + ['pnacl_generate_pexe=0', 'nonpexe_tests']) | 43 args=flags_run + ['pnacl_generate_pexe=0', 'nonpexe_tests']) |
| 47 | 44 |
| 48 irt_mode = context['default_scons_mode'] + ['nacl_irt_test'] | 45 irt_mode = context['default_scons_mode'] + ['nacl_irt_test'] |
| 49 smoke_tests_irt = ['small_tests_irt', 'medium_tests_irt'] | 46 smoke_tests_irt = ['small_tests_irt', 'medium_tests_irt'] |
| 50 # Run some tests with the IRT | 47 # Run some tests with the IRT |
| 51 with Step('smoke_tests_irt', status, halt_on_fail=False): | 48 with Step('smoke_tests_irt ' + arch, status, halt_on_fail=False): |
| 52 SCons(context, parallel=True, mode=irt_mode, | 49 SCons(context, parallel=True, mode=irt_mode, |
| 53 args=flags_run + smoke_tests_irt) | 50 args=flags_run + smoke_tests_irt) |
| 54 | 51 |
| 55 # Test sandboxed translation | 52 # Test sandboxed translation |
| 56 if not context.Windows() and not context.Mac(): | 53 if not context.Windows() and not context.Mac(): |
| 57 # TODO(dschuff): The standalone sandboxed translator driver does not have | 54 # 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 | 55 # 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 | 56 # 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. | 57 # on the ARM bots where we don't have the pnacl_newlib drivers. |
| 61 # The mac standalone sandboxed translator is flaky. | 58 # The mac standalone sandboxed translator is flaky. |
| 62 # https://code.google.com/p/nativeclient/issues/detail?id=3856 | 59 # https://code.google.com/p/nativeclient/issues/detail?id=3856 |
| 63 | 60 |
| 64 with Step('toolchain_tests_sandboxed_translator', status, | 61 if arch == 'arm': |
| 62 # The ARM sandboxed translator is flaky under qemu, so run a very small | |
| 63 # set of tests there. | |
| 64 sbtc_tests = ['run_hello_world_test_irt'] | |
| 65 else: | |
| 66 sbtc_tests = ['toolchain_tests_irt', 'large_code'] | |
| 67 | |
| 68 with Step('sandboxed_translator_tests ' + arch, status, | |
| 69 halt_on_fail=False): | |
| 70 SCons(context, parallel=True, mode=irt_mode, | |
| 71 args=flags_run + ['use_sandboxed_translator=1'] + sbtc_tests) | |
| 72 with Step('sandboxed_translator_fast_tests' + arch, status, | |
|
Mark Seaborn
2014/07/31 15:52:03
Missing space
Derek Schuff
2014/07/31 16:18:09
Done.
| |
| 65 halt_on_fail=False): | 73 halt_on_fail=False): |
| 66 SCons(context, parallel=True, mode=irt_mode, | 74 SCons(context, parallel=True, mode=irt_mode, |
| 67 args=flags_run + ['use_sandboxed_translator=1', | 75 args=flags_run + ['use_sandboxed_translator=1', |
| 68 'toolchain_tests_irt']) | 76 'translate_fast=1'] + sbtc_tests) |
| 69 with Step('toolchain_tests_sandboxed_fast', status, halt_on_fail=False): | 77 |
| 78 if context.Linux() and (arch == 'x86-32' or arch == 'arm'): | |
| 79 # Test Non-SFI Mode. | |
| 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 | |
|
Mark Seaborn
2014/07/31 15:52:03
Need to remove "ARM testing is covered buildbot_pn
Derek Schuff
2014/07/31 16:18:09
Done.
| |
| 82 # by buildbot_pnacl.sh rather than this Python script. | |
| 83 # The x86-64 toolchain bot also runs these tests from buildbot_pnacl.sh | |
| 84 | |
| 85 # TODO(mseaborn): Run small_tests_irt with nonsfi_nacl=1 when it passes, | |
| 86 # instead of the following whitelists of tests. | |
| 87 # These tests pass with both host libc and newlib, on x86-32 and ARM. | |
| 88 nonsfi_tests_common = ['run_' + test + '_test_irt' for test in | |
|
Mark Seaborn
2014/07/31 15:52:03
I found the Non-SFI part of the refactoring really
Derek Schuff
2014/07/31 16:18:09
looks good.
| |
| 89 'dup', | |
| 90 'float', | |
| 91 'hello_world', | |
| 92 'irt_futex', | |
| 93 'malloc_realloc_calloc_free', | |
| 94 'mmap', | |
| 95 'stack_alignment', | |
| 96 'syscall'] | |
| 97 # These tests pass with the host libc, on x86-32 and ARM. | |
| 98 nonsfi_tests_host_libc = (nonsfi_tests_common + | |
| 99 ['run_getpid_test_irt', 'toolchain_tests_irt'] + | |
| 100 ['run_' + test + '_test' for test in | |
| 101 'clock_get', | |
| 102 'dup', | |
| 103 'fcntl', | |
| 104 'fork', | |
| 105 'hello_world', | |
| 106 'nanosleep', | |
| 107 'prctl', | |
| 108 'printf', | |
| 109 'pwrite', | |
| 110 'stack_alignment', | |
| 111 'syscall']) | |
| 112 # These tests pass (with host libc) on x86-32 but not ARM | |
| 113 nonsfi_tests_host_libc_x8632 = (nonsfi_tests_host_libc + | |
| 114 ['run_mmap_test', 'run_socket_test']) | |
| 115 | |
| 116 # This uses the newlib-based nonsfi_loader, for which only a subset of | |
| 117 # the tests works so far. | |
| 118 # TODO(hamaji): Enable more tests. | |
| 119 with Step('nonsfi_tests_newlib ' + arch, status, halt_on_fail=False): | |
| 70 SCons(context, parallel=True, mode=irt_mode, | 120 SCons(context, parallel=True, mode=irt_mode, |
| 71 args=flags_run + ['use_sandboxed_translator=1', 'translate_fast=1', | 121 args=flags_run + ['nonsfi_nacl=1'] + nonsfi_tests_common) |
| 72 'toolchain_tests_irt']) | |
| 73 | 122 |
| 74 # Translator memory consumption regression test | 123 if arch == 'x86-32': |
| 75 with Step('large_code_test', status, halt_on_fail=False): | 124 # Use x86-32 host libc tests. |
| 76 SCons(context, parallel=True, mode=irt_mode, | 125 host_libc_tests = nonsfi_tests_host_libc_x8632 |
| 77 args=flags_run + ['use_sandboxed_translator=1', 'large_code']) | 126 else: |
| 78 | 127 # Use ARM host libc tests. |
| 79 # Test Non-SFI Mode. | 128 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 'mmap', | |
| 94 'stack_alignment', | |
| 95 'syscall', | |
| 96 'thread']] | |
| 97 # Extra non-IRT-using test to run for x86-32 | |
| 98 tests.extend(['run_clock_get_test', | |
| 99 'run_dup_test', | |
| 100 'run_fcntl_test', | |
| 101 'run_fork_test', | |
| 102 'run_hello_world_test', | |
| 103 'run_mmap_test', | |
| 104 'run_nanosleep_test', | |
| 105 'run_prctl_test', | |
| 106 'run_printf_test', | |
| 107 'run_pwrite_test', | |
| 108 'run_socket_test', | |
| 109 'run_stack_alignment_test', | |
| 110 'run_syscall_test', | |
| 111 'run_thread_test']) | |
| 112 SCons(context, parallel=True, mode=irt_mode, | |
| 113 args=flags_run + ['nonsfi_nacl=1'] + tests) | |
| 114 | |
| 115 # Test nonsfi_loader linked against host's libc. | 129 # Test nonsfi_loader linked against host's libc. |
| 116 with Step('nonsfi_tests_host_libc', status, halt_on_fail=False): | 130 with Step('nonsfi_tests_host_libc ' + arch, status, halt_on_fail=False): |
| 117 tests = ['run_' + test + '_test_irt' for test in | |
| 118 ['dup', | |
| 119 'float', | |
| 120 'getpid', | |
| 121 'hello_world', | |
| 122 'irt_futex', | |
| 123 'malloc_realloc_calloc_free', | |
| 124 'syscall', | |
| 125 'thread']] | |
| 126 # Using skip_nonstable_bitcode=1 here disables the tests for | 131 # Using skip_nonstable_bitcode=1 here disables the tests for |
| 127 # zero-cost C++ exception handling, which don't pass for Non-SFI | 132 # zero-cost C++ exception handling, which don't pass for Non-SFI |
| 128 # mode yet because we don't build libgcc_eh for Non-SFI mode. | 133 # mode yet because we don't build libgcc_eh for Non-SFI mode. |
| 129 tests.extend(['toolchain_tests_irt', | |
| 130 'skip_nonstable_bitcode=1']) | |
| 131 SCons(context, parallel=True, mode=irt_mode, | 134 SCons(context, parallel=True, mode=irt_mode, |
| 132 args=(flags_run + ['nonsfi_nacl=1', 'use_newlib_nonsfi_loader=0'] + | 135 args=(flags_run + ['nonsfi_nacl=1', |
| 133 tests)) | 136 'skip_nonstable_bitcode=1', |
| 137 'use_newlib_nonsfi_loader=0'] + | |
| 138 host_libc_tests)) | |
| 134 | 139 |
| 135 # Test unsandboxed mode. | 140 # Test unsandboxed mode. |
| 136 if ((context.Linux() or context.Mac()) and | 141 if (context.Linux() or context.Mac()) and arch == 'x86-32': |
| 137 context['default_scons_platform'] == 'x86-32'): | |
| 138 if context.Linux(): | 142 if context.Linux(): |
| 139 tests = ['run_' + test + '_test_irt' for test in | 143 tests = ['run_' + test + '_test_irt' for test in |
| 140 ['hello_world', 'irt_futex', 'thread', 'float', | 144 ['hello_world', 'irt_futex', 'thread', 'float', |
| 141 'malloc_realloc_calloc_free', 'dup', 'cond_timedwait', | 145 'malloc_realloc_calloc_free', 'dup', 'cond_timedwait', |
| 142 'getpid']] | 146 'getpid']] |
| 143 else: | 147 else: |
| 144 # TODO(mseaborn): Use the same test list as on Linux when the threading | 148 # TODO(mseaborn): Use the same test list as on Linux when the threading |
| 145 # tests pass for Mac. | 149 # tests pass for Mac. |
| 146 tests = ['run_hello_world_test_irt'] | 150 tests = ['run_hello_world_test_irt'] |
| 147 with Step('unsandboxed_tests', status, halt_on_fail=False): | 151 with Step('unsandboxed_tests ' + arch, status, halt_on_fail=False): |
| 148 SCons(context, parallel=True, mode=irt_mode, | 152 SCons(context, parallel=True, mode=irt_mode, |
| 149 args=flags_run + ['pnacl_unsandboxed=1'] + tests) | 153 args=flags_run + ['pnacl_unsandboxed=1'] + tests) |
| 150 | 154 |
| 151 | 155 |
| 152 def Main(): | 156 def Main(): |
| 153 context = BuildContext() | 157 context = BuildContext() |
| 154 status = BuildStatus(context) | 158 status = BuildStatus(context) |
| 155 ParseStandardCommandLine(context) | 159 ParseStandardCommandLine(context) |
| 156 | 160 |
| 157 if context.Linux(): | 161 if context.Linux(): |
| 158 SetupLinuxEnvironment(context) | 162 SetupLinuxEnvironment(context) |
| 159 elif context.Windows(): | 163 elif context.Windows(): |
| 160 SetupWindowsEnvironment(context) | 164 SetupWindowsEnvironment(context) |
| 161 elif context.Mac(): | 165 elif context.Mac(): |
| 162 SetupMacEnvironment(context) | 166 SetupMacEnvironment(context) |
| 163 else: | 167 else: |
| 164 raise Exception('Unsupported platform') | 168 raise Exception('Unsupported platform') |
| 165 | 169 |
| 166 RunBuild(BuildScriptX86, status) | 170 RunBuild(RunSconsTests, status) |
| 167 | 171 |
| 168 if __name__ == '__main__': | 172 if __name__ == '__main__': |
| 169 Main() | 173 Main() |
| OLD | NEW |