OLD | NEW |
1 #! -*- python -*- | 1 #! -*- python -*- |
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 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 atexit | 6 import atexit |
7 import json | 7 import json |
8 import os | 8 import os |
9 import platform | 9 import platform |
10 import re | 10 import re |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 | 320 |
321 BitFromArgument(env, 'pnacl_generate_pexe', default=env.Bit('bitcode'), | 321 BitFromArgument(env, 'pnacl_generate_pexe', default=env.Bit('bitcode'), |
322 desc='use pnacl to generate pexes and translate in a separate step') | 322 desc='use pnacl to generate pexes and translate in a separate step') |
323 | 323 |
324 BitFromArgument(env, 'translate_in_build_step', default=True, | 324 BitFromArgument(env, 'translate_in_build_step', default=True, |
325 desc='Run translation during build phase (e.g. if do_not_run_tests=1)') | 325 desc='Run translation during build phase (e.g. if do_not_run_tests=1)') |
326 | 326 |
327 BitFromArgument(env, 'pnacl_unsandboxed', default=False, | 327 BitFromArgument(env, 'pnacl_unsandboxed', default=False, |
328 desc='Translate pexe to an unsandboxed, host executable') | 328 desc='Translate pexe to an unsandboxed, host executable') |
329 | 329 |
| 330 BitFromArgument(env, 'nonsfi_nacl', default=False, |
| 331 desc='Use Non-SFI Mode instead of the original SFI Mode. This uses ' |
| 332 'nonsfi_loader instead of sel_ldr, and it tells the PNaCl toolchain ' |
| 333 'to translate pexes to Non-SFI nexes.') |
| 334 |
330 BitFromArgument(env, 'browser_headless', default=False, | 335 BitFromArgument(env, 'browser_headless', default=False, |
331 desc='Where possible, set up a dummy display to run the browser on ' | 336 desc='Where possible, set up a dummy display to run the browser on ' |
332 'when running browser tests. On Linux, this runs the browser through ' | 337 'when running browser tests. On Linux, this runs the browser through ' |
333 'xvfb-run. This Scons does not need to be run with an X11 display ' | 338 'xvfb-run. This Scons does not need to be run with an X11 display ' |
334 'and we do not open a browser window on the user\'s desktop. ' | 339 'and we do not open a browser window on the user\'s desktop. ' |
335 'Unfortunately there is no equivalent on Mac OS X.') | 340 'Unfortunately there is no equivalent on Mac OS X.') |
336 | 341 |
337 BitFromArgument(env, 'disable_crash_dialog', default=True, | 342 BitFromArgument(env, 'disable_crash_dialog', default=True, |
338 desc='Disable Windows\' crash dialog box, which Windows pops up when a ' | 343 desc='Disable Windows\' crash dialog box, which Windows pops up when a ' |
339 'process exits with an unhandled fault. Windows enables this by ' | 344 'process exits with an unhandled fault. Windows enables this by ' |
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1286 def AddBootstrap(env, executable, args): | 1291 def AddBootstrap(env, executable, args): |
1287 bootstrap, bootstrap_args = env.GetBootstrap() | 1292 bootstrap, bootstrap_args = env.GetBootstrap() |
1288 if bootstrap is None: | 1293 if bootstrap is None: |
1289 return [executable] + args | 1294 return [executable] + args |
1290 else: | 1295 else: |
1291 return [bootstrap, executable] + bootstrap_args + args | 1296 return [bootstrap, executable] + bootstrap_args + args |
1292 | 1297 |
1293 pre_base_env.AddMethod(AddBootstrap) | 1298 pre_base_env.AddMethod(AddBootstrap) |
1294 | 1299 |
1295 | 1300 |
| 1301 def GetNonSfiLoader(env): |
| 1302 if 'TRUSTED_ENV' not in env: |
| 1303 return None |
| 1304 return env['TRUSTED_ENV'].File( |
| 1305 '${STAGING_DIR}/${PROGPREFIX}nonsfi_loader${PROGSUFFIX}') |
| 1306 |
| 1307 pre_base_env.AddMethod(GetNonSfiLoader) |
| 1308 |
| 1309 |
1296 def GetIrtNexe(env, chrome_irt=False): | 1310 def GetIrtNexe(env, chrome_irt=False): |
1297 image = ARGUMENTS.get('force_irt') | 1311 image = ARGUMENTS.get('force_irt') |
1298 if image: | 1312 if image: |
1299 return env.SConstructAbsPath(image) | 1313 return env.SConstructAbsPath(image) |
1300 | 1314 |
1301 if chrome_irt: | 1315 if chrome_irt: |
1302 return nacl_irt_env.File('${STAGING_DIR}/irt.nexe') | 1316 return nacl_irt_env.File('${STAGING_DIR}/irt.nexe') |
1303 else: | 1317 else: |
1304 return nacl_irt_env.File('${STAGING_DIR}/irt_core.nexe') | 1318 return nacl_irt_env.File('${STAGING_DIR}/irt_core.nexe') |
1305 | 1319 |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1606 | 1620 |
1607 command = [nexe] | 1621 command = [nexe] |
1608 if args is not None: | 1622 if args is not None: |
1609 command += args | 1623 command += args |
1610 | 1624 |
1611 if env.Bit('pnacl_unsandboxed'): | 1625 if env.Bit('pnacl_unsandboxed'): |
1612 # Run unsandboxed executable directly, without sel_ldr. | 1626 # Run unsandboxed executable directly, without sel_ldr. |
1613 return env.CommandTest(name, command, size, **extra) | 1627 return env.CommandTest(name, command, size, **extra) |
1614 | 1628 |
1615 if loader is None: | 1629 if loader is None: |
1616 loader = env.GetSelLdr() | 1630 if env.Bit('nonsfi_nacl'): |
| 1631 loader = env.GetNonSfiLoader() |
| 1632 else: |
| 1633 loader = env.GetSelLdr() |
1617 if loader is None: | 1634 if loader is None: |
1618 print 'WARNING: no sel_ldr found. Skipping test %s' % name | 1635 print 'WARNING: no sel_ldr found. Skipping test %s' % name |
1619 return [] | 1636 return [] |
1620 | 1637 |
1621 # Avoid problems with [] as default arguments | 1638 # Avoid problems with [] as default arguments |
1622 if sel_ldr_flags is None: | 1639 if sel_ldr_flags is None: |
1623 sel_ldr_flags = [] | 1640 sel_ldr_flags = [] |
1624 else: | 1641 else: |
1625 # Avoid modifying original list | 1642 # Avoid modifying original list |
1626 sel_ldr_flags = list(sel_ldr_flags) | 1643 sel_ldr_flags = list(sel_ldr_flags) |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1666 sel_ldr_flags += ['-a'] | 1683 sel_ldr_flags += ['-a'] |
1667 | 1684 |
1668 if env.Bit('tests_use_irt'): | 1685 if env.Bit('tests_use_irt'): |
1669 sel_ldr_flags += ['-B', nacl_env.GetIrtNexe()] | 1686 sel_ldr_flags += ['-B', nacl_env.GetIrtNexe()] |
1670 | 1687 |
1671 if skip_bootstrap: | 1688 if skip_bootstrap: |
1672 loader_cmd = [loader] | 1689 loader_cmd = [loader] |
1673 else: | 1690 else: |
1674 loader_cmd = env.AddBootstrap(loader, []) | 1691 loader_cmd = env.AddBootstrap(loader, []) |
1675 | 1692 |
1676 command = loader_cmd + sel_ldr_flags + ['--'] + command | 1693 if env.Bit('nonsfi_nacl'): |
| 1694 # nonsfi_loader does not accept the same flags as sel_ldr yet, so |
| 1695 # we ignore sel_ldr_flags here. |
| 1696 command = [loader] + command |
| 1697 else: |
| 1698 command = loader_cmd + sel_ldr_flags + ['--'] + command |
1677 | 1699 |
1678 if env.Bit('host_linux'): | 1700 if env.Bit('host_linux'): |
1679 extra['using_nacl_signal_handler'] = True | 1701 extra['using_nacl_signal_handler'] = True |
1680 | 1702 |
1681 if env.ShouldUseVerboseOptions(extra): | 1703 if env.ShouldUseVerboseOptions(extra): |
1682 env.MakeVerboseExtraOptions(name, log_verbosity, extra) | 1704 env.MakeVerboseExtraOptions(name, log_verbosity, extra) |
1683 | 1705 |
1684 node = env.CommandTest(name, command, size, posix_path=True, | 1706 node = env.CommandTest(name, command, size, posix_path=True, |
1685 wrapper_program_prefix=wrapper_program_prefix, **extra) | 1707 wrapper_program_prefix=wrapper_program_prefix, **extra) |
1686 if env.Bit('tests_use_irt'): | 1708 if env.Bit('tests_use_irt'): |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2120 CFLAGS = ['${EXTRA_CFLAGS}'], | 2142 CFLAGS = ['${EXTRA_CFLAGS}'], |
2121 CXXFLAGS = ['${EXTRA_CXXFLAGS}'], | 2143 CXXFLAGS = ['${EXTRA_CXXFLAGS}'], |
2122 ) | 2144 ) |
2123 if base_env.Bit('ncval_testing'): | 2145 if base_env.Bit('ncval_testing'): |
2124 base_env.Append(CPPDEFINES = ['NCVAL_TESTING']) | 2146 base_env.Append(CPPDEFINES = ['NCVAL_TESTING']) |
2125 | 2147 |
2126 base_env.Append(BUILD_SCONSCRIPTS = [ | 2148 base_env.Append(BUILD_SCONSCRIPTS = [ |
2127 # KEEP THIS SORTED PLEASE | 2149 # KEEP THIS SORTED PLEASE |
2128 'build/package_version/build.scons', | 2150 'build/package_version/build.scons', |
2129 'pynacl/build.scons', | 2151 'pynacl/build.scons', |
| 2152 'src/nonsfi/irt/build.scons', |
| 2153 'src/nonsfi/loader/build.scons', |
2130 'src/shared/gio/build.scons', | 2154 'src/shared/gio/build.scons', |
2131 'src/shared/imc/build.scons', | 2155 'src/shared/imc/build.scons', |
2132 'src/shared/ldr/build.scons', | 2156 'src/shared/ldr/build.scons', |
2133 'src/shared/platform/build.scons', | 2157 'src/shared/platform/build.scons', |
2134 'src/shared/serialization/build.scons', | 2158 'src/shared/serialization/build.scons', |
2135 'src/shared/srpc/build.scons', | 2159 'src/shared/srpc/build.scons', |
2136 'src/shared/utils/build.scons', | 2160 'src/shared/utils/build.scons', |
2137 'src/third_party_mod/gtest/build.scons', | 2161 'src/third_party_mod/gtest/build.scons', |
2138 'src/tools/validator_tools/build.scons', | 2162 'src/tools/validator_tools/build.scons', |
2139 'src/trusted/cpu_features/build.scons', | 2163 'src/trusted/cpu_features/build.scons', |
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3033 | 3057 |
3034 # Map certain flag bits to suffices on the build output. This needs to | 3058 # Map certain flag bits to suffices on the build output. This needs to |
3035 # happen pretty early, because it affects any concretized directory names. | 3059 # happen pretty early, because it affects any concretized directory names. |
3036 target_variant_map = [ | 3060 target_variant_map = [ |
3037 ('bitcode', 'pnacl'), | 3061 ('bitcode', 'pnacl'), |
3038 ('translate_fast', 'fast'), | 3062 ('translate_fast', 'fast'), |
3039 ('nacl_pic', 'pic'), | 3063 ('nacl_pic', 'pic'), |
3040 ('use_sandboxed_translator', 'sbtc'), | 3064 ('use_sandboxed_translator', 'sbtc'), |
3041 ('nacl_glibc', 'glibc'), | 3065 ('nacl_glibc', 'glibc'), |
3042 ('pnacl_generate_pexe', 'pexe'), | 3066 ('pnacl_generate_pexe', 'pexe'), |
| 3067 ('nonsfi_nacl', 'nonsfi'), |
3043 ] | 3068 ] |
3044 for variant_bit, variant_suffix in target_variant_map: | 3069 for variant_bit, variant_suffix in target_variant_map: |
3045 if nacl_env.Bit(variant_bit): | 3070 if nacl_env.Bit(variant_bit): |
3046 nacl_env['TARGET_VARIANT'] += '-' + variant_suffix | 3071 nacl_env['TARGET_VARIANT'] += '-' + variant_suffix |
3047 | 3072 |
3048 if nacl_env.Bit('bitcode'): | 3073 if nacl_env.Bit('bitcode'): |
3049 nacl_env['TARGET_VARIANT'] += '-clang' | 3074 nacl_env['TARGET_VARIANT'] += '-clang' |
3050 | 3075 |
3051 nacl_env.Replace(TESTRUNNER_LIBS=['testrunner']) | 3076 nacl_env.Replace(TESTRUNNER_LIBS=['testrunner']) |
3052 # TODO(mseaborn): Drop this once chrome side has inlined this. | 3077 # TODO(mseaborn): Drop this once chrome side has inlined this. |
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3836 nacl_env.ValidateSdk() | 3861 nacl_env.ValidateSdk() |
3837 | 3862 |
3838 if BROKEN_TEST_COUNT > 0: | 3863 if BROKEN_TEST_COUNT > 0: |
3839 msg = "There are %d broken tests." % BROKEN_TEST_COUNT | 3864 msg = "There are %d broken tests." % BROKEN_TEST_COUNT |
3840 if GetOption('brief_comstr'): | 3865 if GetOption('brief_comstr'): |
3841 msg += " Add --verbose to the command line for more information." | 3866 msg += " Add --verbose to the command line for more information." |
3842 print msg | 3867 print msg |
3843 | 3868 |
3844 # separate warnings from actual build output | 3869 # separate warnings from actual build output |
3845 Banner('B U I L D - O U T P U T:') | 3870 Banner('B U I L D - O U T P U T:') |
OLD | NEW |