Return()
trusted_env = env['TRUSTED_ENV']
-# This test uses a nexe built by another test. Nexes do not get
-# staged in pexe mode, so only run this test in nonpexe mode.
-if env.Bit('pnacl_generate_pexe'):
- Return()
+test_guest_obj = env.ComponentObject('sel_main_chrome_guest.c')
+test_guest = env.ComponentProgram('sel_main_chrome_guest',
+ [test_guest_obj],
+ EXTRA_LIBS=['${NONIRT_LIBS}'])
+test_guest = env.GetTranslatedNexe(test_guest)
sel_main_chrome_test = trusted_env.ComponentProgram(
'sel_main_chrome_test', ['sel_main_chrome_test.cc'],
EXTRA_LIBS=['nonnacl_util', 'sel_main_chrome'])
-env_vars = []
+env_vars = ['NACLVERBOSITY=1']
# The check for no-execute page protection does not work under
# qemu-arm (which does not implement no-execute page protection).
if env.Bit('target_arm') and env.UsingEmulator():
if env.IsRunningUnderValgrind():
env_vars.append('NACL_DANGEROUS_SKIP_QUALIFICATION_TEST=1')
-test_command_args = [env.GetIrtNexe(),
- env.File('${STAGING_DIR}/hello_world.nexe')]
+test_command_args = [env.GetIrtNexe(), test_guest]
node = env.CommandTest(
'sel_main_chrome_test.out',
env.AddBootstrap(sel_main_chrome_test, test_command_args), osenv=env_vars,
- stdout_golden=env.File('../hello_world/hello_world.stdout'))
+ stdout_golden=env.File('sel_main_chrome_guest.stdout'))
env.AddNodeToTestSuite(node, ['small_tests', 'nonpexe_tests'],
'run_sel_main_chrome_test',
is_broken=not env.Bit('nacl_static_link'))
env.AddBootstrap(sel_main_chrome_test,
['--no_srpc_load_module'] + test_command_args),
osenv=env_vars,
- stdout_golden=env.File('../hello_world/hello_world.stdout'))
+ stdout_golden=env.File('sel_main_chrome_guest.stdout'))
env.AddNodeToTestSuite(node, ['small_tests', 'nonpexe_tests'],
'run_sel_main_chrome_no_srpc_load_test',
is_broken=not env.Bit('nacl_static_link'))
# Also test with validation cache and mmap info for main nexe.
node = env.CommandTest(
'sel_main_chrome_vcache_test.out',
- env.AddBootstrap(sel_main_chrome_test, test_command_args + ['-vcache']),
- osenv=env_vars + ['NACLVERBOSITY=1'],
+ env.AddBootstrap(sel_main_chrome_test,
+ ['--test_validation_cache'] + test_command_args),
+ osenv=env_vars,
filter_regex='"(NaClElfFileMapSegment: EXERCISING MMAP LOAD PATH)"',
filter_group_only='true',
stderr_golden=env.File('../mmap_main_nexe/mmap_main_nexe_rpc.stderr'))
node = env.CommandTest(
'sel_main_chrome_vcache_no_srpc_load_test.out',
env.AddBootstrap(sel_main_chrome_test,
- ['--no_srpc_load_module'] + test_command_args +
- ['-vcache']),
- osenv=env_vars + ['NACLVERBOSITY=1'],
+ ['--no_srpc_load_module', '--test_validation_cache'] +
+ test_command_args),
+ osenv=env_vars,
filter_regex='"(NaClElfFileMapSegment: EXERCISING MMAP LOAD PATH)"',
filter_group_only='true',
stderr_golden=env.File('../mmap_main_nexe/mmap_main_nexe_rpc.stderr'))
env.AddNodeToTestSuite(node, ['small_tests', 'nonpexe_tests'],
'run_sel_main_chrome_vcache_no_srpc_load_test',
is_broken=not env.Bit('nacl_static_link'))
+
+# Disable the seg_gap tests for MIPS, since its SFI is based on data section
+# starting at 256 MB, so even nexes that do not use IRT have a gap.
+if env.Bit('target_mips32'):
+ Return()
+
+# Test 'irt_load_optional' can help skip loading the IRT if a nexe is built
+# without IRT support (a sufficient segment gap).
+# Also test that 'irt_load_optional' *can* load the IRT for a nexe that
+# *is* built with a segment gap and can work with the IRT.
+node = env.CommandTest(
+ 'sel_main_chrome_irt_optional_with_seg_gap_test.out',
+ env.AddBootstrap(sel_main_chrome_test,
+ ['--irt_load_optional'] + test_command_args),
+ osenv=env_vars,
+ stdout_golden=env.File('sel_main_chrome_guest.stdout'))
+env.AddNodeToTestSuite(node, ['small_tests', 'nonpexe_tests'],
+ 'run_sel_main_chrome_irt_optional_with_seg_gap_test',
+ is_broken=not env.Bit('nacl_static_link'))
+
+# Only the PNaCl drivers have a flag for conveniently building with
+# no segment gap. The PNaCl sandboxed linker, though, does not allow
+# customizing link options so skip for that.
+# If the program is linked without the segment gap but not private libs,
+# it should crash. Just skip in this case, since it's more of a build
+# setup mistake.
+if (env.Bit('bitcode') and
+ not env.Bit('use_sandboxed_translator') and
+ not env.Bit('tests_use_irt')):
+ nogap_env = env.Clone()
+ if env.Bit('pnacl_generate_pexe'):
+ nogap_env.Append(TRANSLATEFLAGS=['--noirt'])
+ else:
+ nogap_env.Append(LINKFLAGS=['-Wt,--noirt', '--pnacl-allow-native'])
+ no_segment_gap_test_guest = nogap_env.ComponentProgram(
+ 'nogap_sel_main_chrome_guest',
+ [test_guest_obj],
+ EXTRA_LIBS=['${NONIRT_LIBS}'])
+ no_segment_gap_test_guest = nogap_env.GetTranslatedNexe(
+ no_segment_gap_test_guest)
+ node = env.CommandTest(
+ 'sel_main_chrome_irt_optional_no_seg_gap_test.out',
+ env.AddBootstrap(sel_main_chrome_test,
+ ['--irt_load_optional', env.GetIrtNexe(),
+ no_segment_gap_test_guest]),
+ osenv=env_vars,
+ filter_regex='"(Skipped NaClLoadIrt, irt_load_optional)"',
+ filter_group_only='true',
+ stderr_golden=env.File('nogap_sel_main_chrome_guest.stderr'))
+ env.AddNodeToTestSuite(node, ['small_tests', 'nonpexe_tests'],
+ 'run_sel_main_chrome_irt_optional_no_seg_gap_test',
+ is_broken=not env.Bit('nacl_static_link'))