| OLD | NEW |
| 1 # -*- python -*- | 1 # -*- python -*- |
| 2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. | 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 | 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 os | 7 import os |
| 8 import tempfile | 8 import tempfile |
| 9 | 9 |
| 10 Import('env') | 10 Import('env') |
| 11 | 11 |
| 12 env.ComponentProgram('redir_test.nexe', 'redir_test.c') | 12 redir_test_nexe = env.ComponentProgram('redir_test', 'redir_test.c') |
| 13 | 13 |
| 14 # windows builds swallow stdout and stderr, so we cannot check | 14 # windows builds swallow stdout and stderr, so we cannot check |
| 15 # against the golden files when stdout and stderr are not redirected | 15 # against the golden files when stdout and stderr are not redirected |
| 16 # to files. | 16 # to files. |
| 17 if not env.Bit('host_windows'): | 17 if not env.Bit('host_windows'): |
| 18 node = env.CommandSelLdrTestNacl( | 18 node = env.CommandSelLdrTestNacl( |
| 19 'redir_test_basic.out', | 19 'redir_test_basic.out', |
| 20 command=[env.File('redir_test.nexe')], | 20 redir_test_nexe, |
| 21 stdout_golden=env.File('redir_test.stdout'), | 21 stdout_golden=env.File('redir_test.stdout'), |
| 22 stderr_golden=env.File('redir_test.stderr'), | 22 stderr_golden=env.File('redir_test.stderr'), |
| 23 filter_regex="'^REALOUTPUT'", | 23 filter_regex="'^REALOUTPUT'", |
| 24 ) | 24 ) |
| 25 | 25 |
| 26 env.AddNodeToTestSuite(node, | 26 env.AddNodeToTestSuite(node, |
| 27 ['small_tests', 'sel_ldr_tests'], | 27 ['small_tests', 'sel_ldr_tests'], |
| 28 'run_redir_basic_test') | 28 'run_redir_basic_test') |
| 29 | 29 |
| 30 # we immediately close to ensure that python is not holding on to a | 30 # we immediately close to ensure that python is not holding on to a |
| (...skipping 10 matching lines...) Expand all Loading... |
| 41 os.unlink(fname) | 41 os.unlink(fname) |
| 42 except OSError: | 42 except OSError: |
| 43 pass | 43 pass |
| 44 return Cleanup | 44 return Cleanup |
| 45 | 45 |
| 46 atexit.register(CleanupBinder(outfile)) | 46 atexit.register(CleanupBinder(outfile)) |
| 47 atexit.register(CleanupBinder(errfile)) | 47 atexit.register(CleanupBinder(errfile)) |
| 48 | 48 |
| 49 node = env.CommandSelLdrTestNacl( | 49 node = env.CommandSelLdrTestNacl( |
| 50 'redir_test.out', | 50 'redir_test.out', |
| 51 command=[env.File('redir_test.nexe')], | 51 redir_test_nexe, |
| 52 filter_regex="'^REALOUTPUT'", | 52 filter_regex="'^REALOUTPUT'", |
| 53 osenv=['NACL_EXE_STDOUT=%s' % outfile, | 53 osenv=['NACL_EXE_STDOUT=%s' % outfile, |
| 54 'NACL_EXE_STDERR=%s' % errfile]) | 54 'NACL_EXE_STDERR=%s' % errfile]) |
| 55 | 55 |
| 56 env.AddNodeToTestSuite(node, | 56 env.AddNodeToTestSuite(node, |
| 57 ['small_tests', 'sel_ldr_tests'], | 57 ['small_tests', 'sel_ldr_tests'], |
| 58 'run_redir_test') | 58 'run_redir_test') |
| 59 | 59 |
| 60 node = env.Command('redir_test_output_compare', | 60 node = env.Command('redir_test_output_compare', |
| 61 ['${PYTHON}', | 61 ['${PYTHON}', |
| 62 env.File('${SCONSTRUCT_DIR}/tools/file_cmp_test.py'), | 62 env.File('${SCONSTRUCT_DIR}/tools/file_cmp_test.py'), |
| 63 outfile, | 63 outfile, |
| 64 env.File('redir_test.stdout')], | 64 env.File('redir_test.stdout')], |
| 65 [env.File(outfile)]) | 65 [env.File(outfile)]) |
| 66 | 66 |
| 67 env.AddNodeToTestSuite(node, | 67 env.AddNodeToTestSuite(node, |
| 68 ['small_tests', 'sel_ldr_tests'], | 68 ['small_tests', 'sel_ldr_tests'], |
| 69 'run_redir_test') | 69 'run_redir_test') |
| OLD | NEW |