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, | |
| 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): | |
| 70 SCons(context, parallel=True, mode=irt_mode, | |
| 71 args=flags_run + ['use_sandboxed_translator=1', 'translate_fast=1', | |
| 72 'toolchain_tests_irt']) | |
| 73 | |
| 74 # Translator memory consumption regression test | |
| 75 with Step('large_code_test', status, halt_on_fail=False): | |
| 76 SCons(context, parallel=True, mode=irt_mode, | |
| 77 args=flags_run + ['use_sandboxed_translator=1', 'large_code']) | |
| 78 | 77 |
| 79 # Test Non-SFI Mode. | 78 # Test Non-SFI Mode. |
| 80 # The only architectures that the PNaCl toolchain supports Non-SFI | 79 # The only architectures that the PNaCl toolchain supports Non-SFI |
| 81 # versions of are currently x86-32 and ARM, and ARM testing is covered | 80 # versions of are currently x86-32 and ARM. |
| 82 # by buildbot_pnacl.sh rather than this Python script. | |
| 83 # The x86-64 toolchain bot currently also runs these tests from | 81 # The x86-64 toolchain bot currently also runs these tests from |
| 84 # buildbot_pnacl.sh | 82 # buildbot_pnacl.sh |
| 85 if context.Linux() and context['default_scons_platform'] == 'x86-32': | 83 if context.Linux() and (arch == 'x86-32' or arch == 'arm'): |
| 86 with Step('nonsfi_tests', status, halt_on_fail=False): | 84 with Step('nonsfi_tests', status, halt_on_fail=False): |
|
Mark Seaborn
2014/08/04 20:39:57
Can you add "+ arch" here?
Derek Schuff
2014/08/04 21:16:38
Done.
| |
| 87 SCons(context, parallel=True, mode=irt_mode, | 85 SCons(context, parallel=True, mode=irt_mode, |
| 88 args=flags_run + | 86 args=flags_run + |
| 89 ['nonsfi_nacl=1', | 87 ['nonsfi_nacl=1', |
| 90 'nonsfi_tests', | 88 'nonsfi_tests', |
| 91 'nonsfi_tests_irt']) | 89 'nonsfi_tests_irt']) |
| 92 | 90 |
| 93 # Test nonsfi_loader linked against host's libc. | 91 # Test nonsfi_loader linked against host's libc. |
| 94 with Step('nonsfi_tests_host_libc', status, halt_on_fail=False): | 92 with Step('nonsfi_tests_host_libc', status, halt_on_fail=False): |
|
Mark Seaborn
2014/08/04 20:39:57
Can you add "+ arch" here?
Derek Schuff
2014/08/04 21:16:38
Done.
| |
| 95 # Using skip_nonstable_bitcode=1 here disables the tests for | 93 # Using skip_nonstable_bitcode=1 here disables the tests for |
| 96 # zero-cost C++ exception handling, which don't pass for Non-SFI | 94 # zero-cost C++ exception handling, which don't pass for Non-SFI |
| 97 # mode yet because we don't build libgcc_eh for Non-SFI mode. | 95 # mode yet because we don't build libgcc_eh for Non-SFI mode. |
| 98 SCons(context, parallel=True, mode=irt_mode, | 96 SCons(context, parallel=True, mode=irt_mode, |
| 99 args=flags_run + | 97 args=flags_run + |
| 100 ['nonsfi_nacl=1', 'use_newlib_nonsfi_loader=0', | 98 ['nonsfi_nacl=1', 'use_newlib_nonsfi_loader=0', |
| 101 'nonsfi_tests_irt', | 99 'nonsfi_tests_irt', |
| 102 'toolchain_tests_irt', 'skip_nonstable_bitcode=1']) | 100 'toolchain_tests_irt', 'skip_nonstable_bitcode=1']) |
| 103 | 101 |
| 104 # Test unsandboxed mode. | 102 # Test unsandboxed mode. |
| 105 if ((context.Linux() or context.Mac()) and | 103 if (context.Linux() or context.Mac()) and arch == 'x86-32': |
| 106 context['default_scons_platform'] == 'x86-32'): | |
| 107 if context.Linux(): | 104 if context.Linux(): |
| 108 tests = ['run_' + test + '_test_irt' for test in | 105 tests = ['run_' + test + '_test_irt' for test in |
| 109 ['hello_world', 'irt_futex', 'thread', 'float', | 106 ['hello_world', 'irt_futex', 'thread', 'float', |
| 110 'malloc_realloc_calloc_free', 'dup', 'cond_timedwait', | 107 'malloc_realloc_calloc_free', 'dup', 'cond_timedwait', |
| 111 'getpid']] | 108 'getpid']] |
| 112 else: | 109 else: |
| 113 # TODO(mseaborn): Use the same test list as on Linux when the threading | 110 # TODO(mseaborn): Use the same test list as on Linux when the threading |
| 114 # tests pass for Mac. | 111 # tests pass for Mac. |
| 115 tests = ['run_hello_world_test_irt'] | 112 tests = ['run_hello_world_test_irt'] |
| 116 with Step('unsandboxed_tests', status, halt_on_fail=False): | 113 with Step('unsandboxed_tests ' + arch, status, halt_on_fail=False): |
| 117 SCons(context, parallel=True, mode=irt_mode, | 114 SCons(context, parallel=True, mode=irt_mode, |
| 118 args=flags_run + ['pnacl_unsandboxed=1'] + tests) | 115 args=flags_run + ['pnacl_unsandboxed=1'] + tests) |
| 119 | 116 |
| 120 | 117 |
| 121 def Main(): | 118 def Main(): |
| 122 context = BuildContext() | 119 context = BuildContext() |
| 123 status = BuildStatus(context) | 120 status = BuildStatus(context) |
| 124 ParseStandardCommandLine(context) | 121 ParseStandardCommandLine(context) |
| 125 | 122 |
| 126 if context.Linux(): | 123 if context.Linux(): |
| 127 SetupLinuxEnvironment(context) | 124 SetupLinuxEnvironment(context) |
| 128 elif context.Windows(): | 125 elif context.Windows(): |
| 129 SetupWindowsEnvironment(context) | 126 SetupWindowsEnvironment(context) |
| 130 elif context.Mac(): | 127 elif context.Mac(): |
| 131 SetupMacEnvironment(context) | 128 SetupMacEnvironment(context) |
| 132 else: | 129 else: |
| 133 raise Exception('Unsupported platform') | 130 raise Exception('Unsupported platform') |
| 134 | 131 |
| 135 RunBuild(BuildScriptX86, status) | 132 RunBuild(RunSconsTests, status) |
| 136 | 133 |
| 137 if __name__ == '__main__': | 134 if __name__ == '__main__': |
| 138 Main() | 135 Main() |
| OLD | NEW |