OLD | NEW |
1 # -*- python -*- | 1 # -*- python -*- |
2 # Copyright 2010 The Native Client Authors. All rights reserved. | 2 # Copyright 2010 The Native Client Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can | 3 # Use of this source code is governed by a BSD-style license that can |
4 # be found in the LICENSE file. | 4 # be found in the LICENSE file. |
5 | 5 |
6 Import('env') | 6 Import('env') |
7 | 7 |
8 env.ComponentProgram('env_var_test.nexe', 'env_var_test.c') | 8 nexe = env.ComponentProgram('env_var_test', 'env_var_test.c') |
9 | 9 |
10 nodes = [] | 10 nodes = [] |
11 | 11 |
12 nodes.append(env.CommandSelLdrTestNacl( | 12 nodes.append(env.CommandSelLdrTestNacl( |
13 'empty_env_var_test.out', | 13 'empty_env_var_test.out', |
14 command=[env.File('env_var_test.nexe')], | 14 nexe, |
15 stdout_golden=env.File('empty_env.stdout'), | 15 stdout_golden=env.File('empty_env.stdout'), |
16 osenv='LANG=This_variable_should_not_get_passed_through_by_default')) | 16 osenv='LANG=This_variable_should_not_get_passed_through_by_default')) |
17 | 17 |
18 # Note that Scons has trouble with arguments containing spaces so we | 18 # Note that Scons has trouble with arguments containing spaces so we |
19 # avoid example values with spaces. | 19 # avoid example values with spaces. |
20 example_env_args = [ | 20 example_env_args = [ |
21 '-E', 'FOO=contents_of_foo', | 21 '-E', 'FOO=contents_of_foo', |
22 '-E', 'ANOTHER_VAR=another_environment_variable', | 22 '-E', 'ANOTHER_VAR=another_environment_variable', |
23 # For simplicity, sel_ldr does not interpret the strings | 23 # For simplicity, sel_ldr does not interpret the strings |
24 # passed via "-E", so it allows duplicate keys, as well as | 24 # passed via "-E", so it allows duplicate keys, as well as |
25 # strings not of the form "KEY=VALUE". This is in line with | 25 # strings not of the form "KEY=VALUE". This is in line with |
26 # how Unix's execve() behaves. We demonstrate this here, but | 26 # how Unix's execve() behaves. We demonstrate this here, but |
27 # we could change sel_ldr in the future to remove duplicates | 27 # we could change sel_ldr in the future to remove duplicates |
28 # or require "KEY=VALUE" strings. | 28 # or require "KEY=VALUE" strings. |
29 '-E', 'DUP=duplicated_key_1', | 29 '-E', 'DUP=duplicated_key_1', |
30 '-E', 'DUP=duplicated_key_2', | 30 '-E', 'DUP=duplicated_key_2', |
31 '-E', 'Technically_we_do_not_need_an_equals_sign_here'] | 31 '-E', 'Technically_we_do_not_need_an_equals_sign_here'] |
32 nodes.append(env.CommandSelLdrTestNacl( | 32 nodes.append(env.CommandSelLdrTestNacl( |
33 'nonempty_env_var_test.out', | 33 'nonempty_env_var_test.out', |
34 command=[env.File('env_var_test.nexe')], | 34 nexe, |
35 sel_ldr_flags=example_env_args, | 35 sel_ldr_flags=example_env_args, |
36 stdout_golden=env.File('nonempty_env.stdout'), | 36 stdout_golden=env.File('nonempty_env.stdout'), |
37 osenv='LANG=This_variable_should_not_get_passed_through_by_default')) | 37 osenv='LANG=This_variable_should_not_get_passed_through_by_default')) |
38 | 38 |
39 if not env.IsRunningUnderValgrind(): | 39 if not env.IsRunningUnderValgrind(): |
40 env.AddNodeToTestSuite(nodes, ['small_tests'], 'run_env_var_test') | 40 env.AddNodeToTestSuite(nodes, ['small_tests'], 'run_env_var_test') |
OLD | NEW |