Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / native_client / tests / redir / nacl.scons
1 # -*- python -*-
2 # Copyright (c) 2011 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 os
7
8 Import('env')
9
10 if env.UnderWindowsCoverage():
11   Return()
12
13 redir_test_nexe = env.ComponentProgram('redir_test', 'redir_test.c',
14                                        EXTRA_LIBS=['${NONIRT_LIBS}'])
15
16 # windows builds swallow stdout and stderr, so we cannot check
17 # against the golden files when stdout and stderr are not redirected
18 # to files.
19 if not env.Bit('host_windows'):
20   node = env.CommandSelLdrTestNacl(
21       'redir_test_basic.out',
22       redir_test_nexe,
23       stdout_golden=env.File('redir_test.stdout'),
24       stderr_golden=env.File('redir_test.stderr'),
25       filter_regex="'^REALOUTPUT'",
26       )
27
28   env.AddNodeToTestSuite(node,
29                          ['small_tests', 'sel_ldr_tests'],
30                          'run_redir_basic_test')
31
32 # we immediately close to ensure that python is not holding on to a
33 # file handle, so that on Windows, the Cleanup use of unlink will not
34 # fail due to us still having an open file handle.
35 outfile = env.MakeEmptyFile(prefix='tmp_redir')
36 errfile = env.MakeEmptyFile(prefix='tmp_redir')
37
38 node = env.CommandSelLdrTestNacl(
39     'redir_test.out',
40     redir_test_nexe,
41     filter_regex="'^REALOUTPUT'",
42     osenv=['NACL_EXE_STDOUT=%s' % outfile,
43            'NACL_EXE_STDERR=%s' % errfile])
44
45 # Valgrind doesn't yet work.
46 # TODO(sehr): https://code.google.com/p/nativeclient/issues/detail?id=3158
47 testing_on_valgrind = env.Bit('running_on_valgrind')
48
49 env.AddNodeToTestSuite(node,
50                        ['small_tests', 'sel_ldr_tests'],
51                        'run_redir_test',
52                        is_broken=testing_on_valgrind)
53
54 tests_disabled = (env.Bit('do_not_run_tests') or env.GetSelLdr() is None or
55                   testing_on_valgrind)
56
57 test_node = env.AutoDepsCommand(
58     'redir_test_output_compare',
59     ['${PYTHON}',
60      env.File('${SCONSTRUCT_DIR}/tools/file_cmp_test.py'),
61      outfile,
62      env.File('redir_test.stdout')],
63     [node, env.File(outfile)],
64     disabled=tests_disabled)
65
66 env.AddNodeToTestSuite(test_node,
67                        ['small_tests', 'sel_ldr_tests'],
68                        'run_redir_test')
69
70 test_node = env.AutoDepsCommand(
71     'redir_test_error_compare',
72     ['${PYTHON}',
73      env.File('${SCONSTRUCT_DIR}/tools/file_cmp_test.py'),
74      errfile,
75      env.File('redir_test.stderr')],
76     [node, env.File(errfile)],
77     disabled=tests_disabled )
78
79 env.AddNodeToTestSuite(test_node,
80                        ['small_tests', 'sel_ldr_tests'],
81                        'run_redir_test')