blob: 98fe5b59ad68e88f29add7f4bd80aa94caafdc63 [file]
# -*- python -*-
# Copyright (c) 2011 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
Import('env')
nexe = env.ComponentProgram('env_var_test', 'env_var_test.c',
EXTRA_LIBS=['${NONIRT_LIBS}'])
nodes = []
nodes.append(env.CommandSelLdrTestNacl(
'empty_env_var_test.out',
nexe,
stdout_golden=env.File('empty_env.stdout'),
osenv='LANG=This_variable_should_not_get_passed_through_by_default'))
# Note that Scons has trouble with arguments containing spaces so we
# avoid example values with spaces.
example_env_args = [
'-E', 'FOO=contents_of_foo',
'-E', 'ANOTHER_VAR=another_environment_variable',
# For simplicity, sel_ldr does not interpret the strings
# passed via "-E", so it allows duplicate keys, as well as
# strings not of the form "KEY=VALUE". This is in line with
# how Unix's execve() behaves. We demonstrate this here, but
# we could change sel_ldr in the future to remove duplicates
# or require "KEY=VALUE" strings.
'-E', 'DUP=duplicated_key_1',
'-E', 'DUP=duplicated_key_2',
'-E', 'Technically_we_do_not_need_an_equals_sign_here']
nodes.append(env.CommandSelLdrTestNacl(
'nonempty_env_var_test.out',
nexe,
sel_ldr_flags=example_env_args,
stdout_golden=env.File('nonempty_env.stdout'),
osenv='LANG=This_variable_should_not_get_passed_through_by_default'))
if not env.IsRunningUnderValgrind():
env.AddNodeToTestSuite(nodes, ['small_tests'], 'run_env_var_test')