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
4 # found in the LICENSE file.
8 from buildbot_lib import (
9 BuildContext, BuildStatus, Command, ParseStandardCommandLine,
10 RemoveSconsBuildDirectories, RemoveGypBuildDirectories, RunBuild, SCons,
14 def SetupGypDefines(context, extra_vars=[]):
15 context.SetEnv('GYP_DEFINES', ' '.join(context['gyp_vars'] + extra_vars))
18 def SetupLinuxEnvironment(context):
19 SetupGypDefines(context, ['target_arch=' + context['gyp_arch']])
22 def BuildScriptX86(status, context):
23 # Clean out build directories.
24 with Step('clobber', status):
25 RemoveSconsBuildDirectories()
26 RemoveGypBuildDirectories()
28 # Unlike their arm counterparts we do not run trusted tests on x86 bots.
29 # Trusted tests get plenty of coverage by other bots, e.g. nacl-gcc bots.
30 # We make the assumption here that there are no "exotic tests" which
31 # are trusted in nature but are somehow depedent on the untrusted TC.
32 flags_build = ['skip_trusted_tests=1', 'do_not_run_tests=1']
33 flags_run = ['skip_trusted_tests=1']
34 smoke_tests = ['small_tests', 'medium_tests']
36 with Step('build_all', status):
37 SCons(context, parallel=True, args=flags_build)
39 # Normal pexe-mode tests
40 with Step('smoke_tests', status, halt_on_fail=False):
41 SCons(context, parallel=True, args=flags_run + smoke_tests)
42 # Large tests cannot be run in parallel
43 with Step('large_tests', status, halt_on_fail=False):
44 SCons(context, parallel=False, args=flags_run + ['large_tests'])
46 # non-pexe-mode tests. Build everything to make sure it all builds in nonpexe
47 # mode, but just run the nonpexe_tests
48 with Step('build_nonpexe', status):
49 SCons(context, parallel=True, args=flags_build + ['pnacl_generate_pexe=0'])
50 with Step('nonpexe_tests', status, halt_on_fail=False):
51 SCons(context, parallel=True,
52 args=flags_run + ['pnacl_generate_pexe=0', 'nonpexe_tests'])
54 irt_mode = context['default_scons_mode'] + ['nacl_irt_test']
55 smoke_tests_irt = ['small_tests_irt', 'medium_tests_irt']
56 # Run some tests with the IRT
57 with Step('smoke_tests_irt', status, halt_on_fail=False):
58 SCons(context, parallel=True, mode=irt_mode,
59 args=flags_run + smoke_tests_irt)
61 # Test sandboxed translation
62 with Step('smoke_tests_sandboxed_translator', status):
63 SCons(context, parallel=True, mode=irt_mode,
64 args=flags_run + ['use_sandboxed_translator=1'] + smoke_tests_irt)
65 with Step('smoke_tests_sandboxed_fast', status):
66 SCons(context, parallel=True, mode=irt_mode,
67 args=flags_run + ['use_sandboxed_translator=1', 'translate_fast=1']
70 # Translator memory consumption regression test
71 with Step('large_code_test', status):
72 SCons(context, parallel=True, mode=irt_mode,
73 args=flags_run + ['use_sandboxed_translator=1', 'large_code'])
76 with Step('nonsfi_tests', status):
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 if context['default_scons_platform'] == 'x86-32':
81 # TODO(mseaborn): Enable more tests here when they pass.
82 SCons(context, parallel=True, mode=irt_mode,
83 args=flags_run + ['nonsfi_nacl=1', 'run_hello_world_test_irt'])
87 context = BuildContext()
88 status = BuildStatus(context)
89 ParseStandardCommandLine(context)
92 SetupLinuxEnvironment(context)
94 raise Exception('Unsupported platform')
96 RunBuild(BuildScriptX86, status)
98 if __name__ == '__main__':