diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-04-28 08:48:11 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:51:41 -0500 |
commit | e5b0977897fe1d936acd9cf972dc227277c4a017 (patch) | |
tree | afeed18e0d9a94af366a34c85351b4905a18923e | |
parent | 5d78a487b8ea34ecd9c2685d026a2db86788ae9f (diff) | |
download | samba-e5b0977897fe1d936acd9cf972dc227277c4a017.tar.gz samba-e5b0977897fe1d936acd9cf972dc227277c4a017.tar.bz2 samba-e5b0977897fe1d936acd9cf972dc227277c4a017.zip |
r22548: - maintain a global array of exported envvars
- make it possible to specify the envname for make testenv:
SELFTEST_TESTENV=member make testenv
metze
(This used to be commit b6b57dd9c9aa066127f26c49f2af6c055be0422e)
-rwxr-xr-x | source4/script/tests/selftest.pl | 57 |
1 files changed, 48 insertions, 9 deletions
diff --git a/source4/script/tests/selftest.pl b/source4/script/tests/selftest.pl index 29aaa11d99..4f9c8afe06 100755 --- a/source4/script/tests/selftest.pl +++ b/source4/script/tests/selftest.pl @@ -675,6 +675,23 @@ $| = 1; my %running_envs = (); +my @exported_envvars = ( + # domain stuff + "DOMAIN", + "REALM", + + # server stuff + "SERVER", + "NETBIOSNAME", + + # user stuff + "USERNAME", + "PASSWORD", + + # misc stuff + "KRB5_CONFIG" +); + sub setup_env($) { my ($envname) = @_; @@ -693,9 +710,10 @@ sub setup_env($) return undef unless defined($testenv_vars); + SocketWrapper::set_default_iface(6); write_clientconf($conffile, $testenv_vars); - foreach ("PASSWORD", "DOMAIN", "SERVER", "USERNAME", "NETBIOSNAME", - "KRB5_CONFIG", "REALM") { + + foreach (@exported_envvars) { if (defined($testenv_vars->{$_})) { $ENV{$_} = $testenv_vars->{$_}; } else { @@ -703,12 +721,23 @@ sub setup_env($) } } - SocketWrapper::set_default_iface(6); - $running_envs{$envname} = $testenv_vars; return $testenv_vars; } +sub exported_envvars_str($) +{ + my ($testenv_vars) = @_; + my $out = ""; + + foreach (@exported_envvars) { + next unless defined($testenv_vars->{$_}); + $out .= $_."=".$testenv_vars->{$_}."\n"; + } + + return $out; +} + sub getlog_env($) { my ($envname) = @_; @@ -739,19 +768,29 @@ if ($from_build_farm) { } if ($opt_testenv) { - my $testenv_vars = setup_env("dc"); + my $testenv_name = $ENV{SELFTEST_TESTENV}; + $testenv_name = "dc" unless defined($testenv_name); + + my $testenv_vars = setup_env($testenv_name); + $ENV{PIDDIR} = $testenv_vars->{PIDDIR}; + + my $envvarstr = exported_envvars_str($testenv_vars); + my $term = ($ENV{TERM} or "xterm"); - system("$term -e 'echo -e \"Welcome to the Samba4 Test environment + system("$term -e 'echo -e \" +Welcome to the Samba4 Test environment '$testenv_name' + This matches the client environment used in make test smbd is pid `cat \$PIDDIR/smbd.pid` Some useful environment variables: TORTURE_OPTIONS=\$TORTURE_OPTIONS CONFIGURATION=\$CONFIGURATION -SERVER=\$SERVER -NETBIOSNAME=\$NETBIOSNAME\" && bash'"); - teardown_env("dc"); + +$envvarstr +\" && bash'"); + teardown_env($testenv_name); } else { foreach (@todo) { $i++; |