Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / native_client / tests / stubout_mode / nacl.scons
1 # -*- python -*-
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
4 # found in the LICENSE file.
5
6 Import('env')
7
8 if 'TRUSTED_ENV' not in env:
9   Return()
10
11 # Even if stubout mode is not supported sel_ldr still must run valid .nexes.
12 # TODO(shyamsundarr): consider removing support for stubout mode completely
13 # from code, given that currently only MIPS supports it and it is untested.
14 hello_world_nexe = env.File('${STAGING_DIR}/hello_world${PROGSUFFIX}')
15 node = env.CommandSelLdrTestNacl(
16     'hello_world_stub_out_run.out', hello_world_nexe,
17     sel_ldr_flags=['-s'])
18 env.AddNodeToTestSuite(
19     node, ['small_tests'], 'run_valid_nexe_with_stubout_test')
20
21 # Do not run these tests with pexes, assuming they are portable, since
22 # they use inline assembler.
23 if env.Bit('bitcode') and env.Bit('pnacl_generate_pexe'):
24   Return()
25
26 # nacl-clang currently has trouble with the top-level asm in this file:
27 # https://code.google.com/p/nativeclient/issues/detail?id=3968
28 if env.Bit('nacl_clang'):
29   Return()
30
31 # The file partly_invalid.c contains inline assembler
32 if env.Bit('bitcode'):
33   env.AddBiasForPNaCl()
34   env.PNaClForceNative()
35
36 # Newlib + PIC doesn't provide native ___tls_get_addr, so gold complains.
37 if env.Bit('bitcode') and env.Bit('nacl_pic'):
38   Return()
39
40 # TODO(mseaborn): Extend the ARM validator to support this.
41 # BUG= http://code.google.com/p/nativeclient/issues/detail?id=2369
42 if env.Bit('build_arm'):
43   Return()
44
45 partly_invalid_nexe = env.ComponentProgram('partly_invalid', 'partly_invalid.c',
46                                            EXTRA_LIBS=['${NONIRT_LIBS}'])
47
48 # This alias is to ensure this test works with built_elsewhere=1,
49 # because with that option CommandSelLdrTestNacl() assumes all its
50 # inputs have already been built (which is not necessarily a good
51 # idea, but apparently true for all other cases so far).
52 env.Alias('all_test_programs', node)
53
54 # For speed, SConstruct disables the validator (using '-cc') for
55 # Valgrind+nacl-glibc tests, which breaks one test below.
56 is_validation_disabled = env.IsRunningUnderValgrind() and env.Bit('nacl_glibc')
57
58 # TODO(shyamsundarr): investigate if we can run non_pexe tests.
59 test_suites = ['small_tests']
60
61 # Without any debug flags, the executable fails validation.
62 if env.Bit('nacl_static_link'):
63   # The exit status produced by sel_ldr.
64   validation_failure_status = '1'
65 else:
66   # The exit status produced by the dynamic linker.
67   validation_failure_status = '127'
68 node = env.CommandSelLdrTestNacl(
69     'partly_invalid_1.out', partly_invalid_nexe,
70     exit_status=validation_failure_status)
71 env.AddNodeToTestSuite(node, test_suites, 'run_without_stubout_1_test',
72                        is_broken=is_validation_disabled)
73
74 # With "-c", the executable runs to completion but is not safe.
75 node = env.CommandSelLdrTestNacl(
76     'partly_invalid_2.out', partly_invalid_nexe,
77     stdout_golden=env.File('without_stubout.stdout'),
78     sel_ldr_flags=['-c'])
79 env.AddNodeToTestSuite(node, test_suites, 'run_without_stubout_2_test')