2 # Bootstrap Samba and run a number of tests against it.
3 # Copyright (C) 2005-2010 Jelmer Vernooij <jelmer@samba.org>
4 # Copyright (C) 2007-2009 Stefan Metzmacher <metze@samba.org>
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 use FindBin
qw($RealBin $Script);
23 use File::Temp qw(tempfile);
33 Time
::HiRes
->import("time");
36 print "You don't have Time::Hires installed !\n";
40 my $opt_target = "samba";
42 my $opt_socket_wrapper = 0;
43 my $opt_socket_wrapper_pcap = undef;
44 my $opt_socket_wrapper_keep_pcap = undef;
45 my $opt_random_order = 0;
52 my $opt_resetup_env = undef;
53 my $opt_binary_mapping = "";
54 my $opt_load_list = undef;
55 my $opt_libnss_wrapper_so_path = "";
56 my $opt_libsocket_wrapper_so_path = "";
57 my $opt_libuid_wrapper_so_path = "";
69 my ($list, $fullname) = @_;
72 if ($fullname =~ /$$_[0]/) {
73 return ($$_[1]) if ($$_[1]);
85 return find_in_list
(\
@excludes, $name);
94 return unless ($opt_socket_wrapper_pcap);
95 return unless defined($ENV{SOCKET_WRAPPER_PCAP_DIR
});
98 $fname =~ s
%[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\
-]%_%g;
100 my $pcap_file = "$ENV{SOCKET_WRAPPER_PCAP_DIR}/$fname.pcap";
102 SocketWrapper
::setup_pcap
($pcap_file);
109 my ($pcap_file, $exitcode) = @_;
111 return unless ($opt_socket_wrapper_pcap);
112 return if ($opt_socket_wrapper_keep_pcap);
113 return unless ($exitcode == 0);
114 return unless defined($pcap_file);
119 # expand strings from %ENV
120 sub expand_environment_strings
($)
123 # we use a reverse sort so we do the longer ones first
124 foreach my $k (sort { $b cmp $a } keys %ENV) {
125 $s =~ s/\$$k/$ENV{$k}/g;
130 sub run_testsuite
($$$$$)
132 my ($envname, $name, $cmd, $i, $totalsuites) = @_;
133 my $pcap_file = setup_pcap
($name);
135 Subunit
::start_testsuite
($name);
136 Subunit
::progress_push
();
137 Subunit
::report_time
(time());
139 Subunit
::report_time
(time());
140 Subunit
::progress_pop
();
143 Subunit
::progress_pop
();
144 Subunit
::end_testsuite
($name, "error", "Unable to run $cmd: $!");
147 Subunit
::end_testsuite
($name, "error",
148 sprintf("%s died with signal %d, %s coredump\n", $cmd, ($?
& 127), ($?
& 128) ?
'with' : 'without'));
152 my $exitcode = $?
>> 8;
154 my $envlog = getlog_env
($envname);
156 print "envlog: $envlog\n";
159 print "command: $cmd\n";
160 printf "expanded command: %s\n", expand_environment_strings
($cmd);
162 if ($exitcode == 0) {
163 Subunit
::end_testsuite
($name, "success");
165 Subunit
::end_testsuite
($name, "failure", "Exit code was $exitcode");
168 cleanup_pcap
($pcap_file, $exitcode);
170 if (not $opt_socket_wrapper_keep_pcap and defined($pcap_file)) {
171 print "PCAP FILE: $pcap_file\n";
174 if ($exitcode != 0) {
175 exit(1) if ($opt_one);
183 print "Samba test runner
184 Copyright (C) Jelmer Vernooij <jelmer\@samba.org>
185 Copyright (C) Stefan Metzmacher <metze\@samba.org>
187 Usage: $Script [OPTIONS] TESTNAME-REGEX
190 --help this help page
191 --target=samba[3]|win Samba version to target
192 --testlist=FILE file to read available tests from
195 --prefix=DIR prefix to run tests in [st]
196 --srcdir=DIR source directory [.]
197 --bindir=DIR binaries directory [./bin]
200 --nss_wrapper_so_path=FILE the nss_wrapper library to preload
201 --socket_wrapper_so_path=FILE the socket_wrapper library to preload
202 --uid_wrapper_so_path=FILE the uid_wrapper library to preload
205 --socket-wrapper-pcap save traffic to pcap directories
206 --socket-wrapper-keep-pcap keep all pcap files, not just those for tests that
208 --socket-wrapper enable socket wrapper
211 --ldap=openldap|fedora-ds back samba onto specified ldap server
214 --quick run quick overall test
215 --one abort when the first test fails
216 --testenv run a shell in the requested test environment
217 --list list available tests
222 my $result = GetOptions
(
223 'help|h|?' => \
$opt_help,
224 'target=s' => \
$opt_target,
225 'prefix=s' => \
$prefix,
226 'socket-wrapper' => \
$opt_socket_wrapper,
227 'socket-wrapper-pcap' => \
$opt_socket_wrapper_pcap,
228 'socket-wrapper-keep-pcap' => \
$opt_socket_wrapper_keep_pcap,
229 'quick' => \
$opt_quick,
231 'exclude=s' => \
@opt_exclude,
232 'include=s' => \
@opt_include,
233 'srcdir=s' => \
$srcdir,
234 'bindir=s' => \
$bindir,
235 'testenv' => \
$opt_testenv,
236 'list' => \
$opt_list,
238 'resetup-environment' => \
$opt_resetup_env,
239 'testlist=s' => \
@testlists,
240 'random-order' => \
$opt_random_order,
241 'load-list=s' => \
$opt_load_list,
242 'binary-mapping=s' => \
$opt_binary_mapping,
243 'nss_wrapper_so_path=s' => \
$opt_libnss_wrapper_so_path,
244 'socket_wrapper_so_path=s' => \
$opt_libsocket_wrapper_so_path,
245 'uid_wrapper_so_path=s' => \
$opt_libuid_wrapper_so_path
248 exit(1) if (not $result);
250 ShowHelp
() if ($opt_help);
252 die("--list and --testenv are mutually exclusive") if ($opt_list and $opt_testenv);
254 # we want unbuffered output
259 # quick hack to disable rpc validation when using valgrind - its way too slow
260 unless (defined($ENV{VALGRIND
})) {
261 $ENV{VALIDATE
} = "validate";
262 $ENV{MALLOC_CHECK_
} = 3;
265 # make all our python scripts unbuffered
266 $ENV{PYTHONUNBUFFERED
} = 1;
268 my $bindir_abs = abs_path
($bindir);
270 # Backwards compatibility:
271 if (defined($ENV{TEST_LDAP
}) and $ENV{TEST_LDAP
} eq "yes") {
272 if (defined($ENV{FEDORA_DS_ROOT
})) {
279 my $torture_maxtime = ($ENV{TORTURE_MAXTIME
} or 1200);
282 $torture_maxtime *= 2;
289 die("using an empty prefix isn't allowed") unless $prefix ne "";
291 # Ensure we have the test prefix around.
293 # We need restrictive
294 # permissions on this as some subdirectories in this tree will have
295 # wider permissions (ie 0777) and this would allow other users on the
296 # host to subvert the test process.
297 mkdir($prefix, 0700) unless -d
$prefix;
300 my $prefix_abs = abs_path
($prefix);
301 my $tmpdir_abs = abs_path
("$prefix/tmp");
302 mkdir($tmpdir_abs, 0777) unless -d
$tmpdir_abs;
304 my $srcdir_abs = abs_path
($srcdir);
306 die("using an empty absolute prefix isn't allowed") unless $prefix_abs ne "";
307 die("using '/' as absolute prefix isn't allowed") unless $prefix_abs ne "/";
309 $ENV{PREFIX
} = $prefix;
310 $ENV{KRB5CCNAME
} = "$prefix/krb5ticket";
311 $ENV{PREFIX_ABS
} = $prefix_abs;
312 $ENV{SRCDIR
} = $srcdir;
313 $ENV{SRCDIR_ABS
} = $srcdir_abs;
314 $ENV{BINDIR
} = $bindir_abs;
316 my $tls_enabled = not $opt_quick;
317 $ENV{TLS_ENABLED
} = ($tls_enabled?
"yes":"no");
319 sub prefix_pathvar
($$)
321 my ($name, $newpath) = @_;
322 if (defined($ENV{$name})) {
323 $ENV{$name} = "$newpath:$ENV{$name}";
325 $ENV{$name} = $newpath;
328 prefix_pathvar
("PKG_CONFIG_PATH", "$bindir_abs/pkgconfig");
329 prefix_pathvar
("PYTHONPATH", "$bindir_abs/python");
331 if ($opt_socket_wrapper_keep_pcap) {
332 # Socket wrapper keep pcap implies socket wrapper pcap
333 $opt_socket_wrapper_pcap = 1;
336 if ($opt_socket_wrapper_pcap) {
337 # Socket wrapper pcap implies socket wrapper
338 $opt_socket_wrapper = 1;
341 my $ld_preload = $ENV{LD_PRELOAD
};
343 if ($opt_libnss_wrapper_so_path) {
345 $ld_preload = "$ld_preload:$opt_libnss_wrapper_so_path";
347 $ld_preload = "$opt_libnss_wrapper_so_path";
351 if ($opt_libsocket_wrapper_so_path) {
353 $ld_preload = "$ld_preload:$opt_libsocket_wrapper_so_path";
355 $ld_preload = "$opt_libsocket_wrapper_so_path";
359 if ($opt_libuid_wrapper_so_path) {
361 $ld_preload = "$ld_preload:$opt_libuid_wrapper_so_path";
363 $ld_preload = "$opt_libuid_wrapper_so_path";
367 $ENV{LD_PRELOAD
} = $ld_preload;
368 print "LD_PRELOAD=$ENV{LD_PRELOAD}\n";
370 # Enable uid_wrapper globally
371 $ENV{UID_WRAPPER
} = 1;
373 # Disable RTLD_DEEPBIND hack for Samba bind dlz module
375 # This is needed in order to allow the ldb_*ldap module
376 # to work with a preloaded socket wrapper.
377 $ENV{LDB_MODULES_DISABLE_DEEPBIND
} = 1;
379 my $socket_wrapper_dir;
380 if ($opt_socket_wrapper) {
381 $socket_wrapper_dir = SocketWrapper
::setup_dir
("$prefix_abs/w", $opt_socket_wrapper_pcap);
382 print "SOCKET_WRAPPER_DIR=$socket_wrapper_dir\n";
383 } elsif (not $opt_list) {
385 warn("not using socket wrapper, but also not running as root. Will not be able to listen on proper ports");
390 my $testenv_default = "none";
392 my %binary_mapping = ();
393 if ($opt_binary_mapping) {
394 my @binmapping_list = split(/,/, $opt_binary_mapping);
395 foreach my $mapping (@binmapping_list) {
396 my ($bin, $map) = split(/\:/, $mapping);
397 $binary_mapping{$bin} = $map;
401 $ENV{BINARY_MAPPING
} = $opt_binary_mapping;
403 # After this many seconds, the server will self-terminate. All tests
404 # must terminate in this time, and testenv will only stay alive this
407 my $server_maxtime = 7500;
408 if (defined($ENV{SMBD_MAXTIME
}) and $ENV{SMBD_MAXTIME
} ne "") {
409 $server_maxtime = $ENV{SMBD_MAXTIME
};
413 if ($opt_target eq "samba") {
414 $testenv_default = "dc";
415 require target
::Samba
;
416 $target = new Samba
($bindir, \
%binary_mapping, $ldap, $srcdir, $server_maxtime);
417 } elsif ($opt_target eq "samba3") {
418 $testenv_default = "member";
419 require target
::Samba3
;
420 $target = new Samba3
($bindir, \
%binary_mapping, $srcdir_abs, $server_maxtime);
424 sub read_test_regexes
($)
428 open(LF
, "<$name") or die("unable to read $name: $!");
432 if (/^(.*?)([ \t]+)\#([\t ]*)(.*?)$/) {
433 push (@ret, [$1, $4]);
435 s/^(.*?)([ \t]+)\#([\t ]*)(.*?)$//;
436 push (@ret, [$_, undef]);
443 foreach (@opt_exclude) {
444 push (@excludes, read_test_regexes
($_));
447 foreach (@opt_include) {
448 push (@includes, read_test_regexes
($_));
451 my $interfaces = join(',', ("127.0.0.11/8",
458 my $clientdir = "$prefix_abs/client";
460 my $conffile = "$clientdir/client.conf";
461 $ENV{SMB_CONF_PATH
} = $conffile;
463 sub write_clientconf
($$$)
465 my ($conffile, $clientdir, $vars) = @_;
467 mkdir("$clientdir", 0777) unless -d
"$clientdir";
469 if ( -d
"$clientdir/private" ) {
470 unlink <$clientdir/private/*>;
472 mkdir("$clientdir/private", 0777);
475 if ( -d
"$clientdir/lockdir" ) {
476 unlink <$clientdir/lockdir/*>;
478 mkdir("$clientdir/lockdir", 0777);
481 if ( -d
"$clientdir/statedir" ) {
482 unlink <$clientdir/statedir/*>;
484 mkdir("$clientdir/statedir", 0777);
487 if ( -d
"$clientdir/cachedir" ) {
488 unlink <$clientdir/cachedir/*>;
490 mkdir("$clientdir/cachedir", 0777);
493 # this is ugly, but the ncalrpcdir needs exactly 0755
494 # otherwise tests fail.
497 if ( -d
"$clientdir/ncalrpcdir/np" ) {
498 unlink <$clientdir/ncalrpcdir/np
/*>;
499 rmdir "$clientdir/ncalrpcdir/np";
501 if ( -d
"$clientdir/ncalrpcdir" ) {
502 unlink <$clientdir/ncalrpcdir/*>;
503 rmdir "$clientdir/ncalrpcdir";
505 mkdir("$clientdir/ncalrpcdir", 0755);
508 open(CF
, ">$conffile");
509 print CF
"[global]\n";
510 print CF
"\tnetbios name = client\n";
511 if (defined($vars->{DOMAIN
})) {
512 print CF
"\tworkgroup = $vars->{DOMAIN}\n";
514 if (defined($vars->{REALM
})) {
515 print CF
"\trealm = $vars->{REALM}\n";
517 if ($opt_socket_wrapper) {
518 print CF
"\tinterfaces = $interfaces\n";
521 private dir = $clientdir/private
522 lock dir = $clientdir/lockdir
523 state directory = $clientdir/statedir
524 cache directory = $clientdir/cachedir
525 ncalrpc dir = $clientdir/ncalrpcdir
526 name resolve order = file bcast
527 panic action = $RealBin/gdb_backtrace \%d
529 notify:inotify = false
531 system:anonymous = true
532 client lanman auth = Yes
534 torture:basedir = $clientdir
535 #We don't want to pass our self-tests if the PAC code is wrong
536 gensec:require_pac = true
537 resolv:host file = $prefix_abs/dns_host_file
538 #We don't want to run 'speed' tests for very long
539 torture:timelimit = 1
540 winbind separator = /
547 sub should_run_test
($)
553 for (my $i=0; $i <= $#tests; $i++) {
554 if ($name =~ /$tests[$i]/i) {
566 open(IN
, $filename) or die("Unable to open $filename: $!");
569 if (/-- TEST(-LOADLIST|) --\n/) {
570 my $supports_loadlist = (defined($1) and $1 eq "-LOADLIST");
576 if ($supports_loadlist) {
578 $loadlist =~ s/\n//g;
582 if (should_run_test
($name) == 1) {
583 push (@ret, [$name, $env, $cmdline, $loadlist]);
589 close(IN
) or die("Error creating recipe from $filename");
593 if ($#testlists == -1) {
594 die("No testlists specified");
597 $ENV{SELFTEST_PREFIX
} = "$prefix_abs";
598 $ENV{SELFTEST_TMPDIR
} = "$tmpdir_abs";
599 $ENV{TEST_DATA_PREFIX
} = "$tmpdir_abs";
600 if ($opt_socket_wrapper) {
601 $ENV{SELFTEST_INTERFACES
} = $interfaces;
603 $ENV{SELFTEST_INTERFACES
} = "";
606 $ENV{SELFTEST_QUICK
} = "1";
608 $ENV{SELFTEST_QUICK
} = "";
610 $ENV{SELFTEST_MAXTIME
} = $torture_maxtime;
613 foreach my $fn (@testlists) {
614 foreach (read_testlist
($fn)) {
616 next if (@includes and not defined(find_in_list
(\
@includes, $name)));
617 push (@available, $_);
621 my $restricted = undef;
622 my $restricted_used = {};
624 if ($opt_load_list) {
626 open(LOAD_LIST
, "<$opt_load_list") or die("Unable to open $opt_load_list");
627 while (<LOAD_LIST
>) {
629 push (@
$restricted, $_);
634 my $individual_tests = undef;
635 $individual_tests = {};
637 foreach my $testsuite (@available) {
638 my $name = $$testsuite[0];
639 my $skipreason = skip
($name);
640 if (defined($restricted)) {
641 # Find the testsuite for this test
643 foreach my $r (@
$restricted) {
645 $individual_tests->{$name} = [];
647 $restricted_used->{$r} = 1;
648 } elsif (substr($r, 0, length($name)+1) eq "$name.") {
649 push(@
{$individual_tests->{$name}}, $r);
651 $restricted_used->{$r} = 1;
655 if (defined($skipreason)) {
657 Subunit
::skip_testsuite
($name, $skipreason);
660 push(@todo, $testsuite);
663 } elsif (defined($skipreason)) {
665 Subunit
::skip_testsuite
($name, $skipreason);
668 push(@todo, $testsuite);
672 if (defined($restricted)) {
673 foreach (@
$restricted) {
674 unless (defined($restricted_used->{$_})) {
675 print "No test or testsuite found matching $_\n";
678 } elsif ($#todo == -1) {
679 print STDERR
"No tests to run\n";
683 my $suitestotal = $#todo + 1;
686 Subunit
::progress
($suitestotal);
687 Subunit
::report_time
(time());
693 my %running_envs = ();
695 sub get_running_env
($)
703 return $running_envs{$envname};
706 my @exported_envvars = (
711 # domain controller stuff
721 "MEMBER_SERVER_IPV6",
722 "MEMBER_NETBIOSNAME",
723 "MEMBER_NETBIOSALIAS",
725 # rpc proxy controller stuff
727 "RPC_PROXY_SERVER_IP",
728 "RPC_PROXY_SERVER_IPV6",
729 "RPC_PROXY_NETBIOSNAME",
730 "RPC_PROXY_NETBIOSALIAS",
732 # domain controller stuff for Vampired DC
734 "VAMPIRE_DC_SERVER_IP",
735 "VAMPIRE_DC_SERVER_IPV6",
736 "VAMPIRE_DC_NETBIOSNAME",
737 "VAMPIRE_DC_NETBIOSALIAS",
739 "PROMOTED_DC_SERVER",
740 "PROMOTED_DC_SERVER_IP",
741 "PROMOTED_DC_SERVER_IPV6",
742 "PROMOTED_DC_NETBIOSNAME",
743 "PROMOTED_DC_NETBIOSALIAS",
761 "SELFTEST_WINBINDD_SOCKET_DIR",
762 "WINBINDD_PRIV_PIPE_DIR",
767 "NSS_WRAPPER_PASSWD",
770 # UID/GID for rfc2307 mapping tests
779 $SIG{INT
} = $SIG{QUIT
} = $SIG{TERM
} = 'DEFAULT';
780 $SIG{PIPE
} = 'IGNORE';
782 open(STDOUT
, ">&STDERR") or die "can't dup STDOUT to STDERR: $!";
784 print "$0: PID[$$]: Got SIG${signame} teardown environments.\n";
785 teardown_env
($_) foreach(keys %running_envs);
786 system("pstree -p $$");
787 print "$0: PID[$$]: Exiting...\n";
791 $SIG{INT
} = $SIG{QUIT
} = $SIG{TERM
} = $SIG{PIPE
} = \
&sighandler
;
795 my ($name, $prefix) = @_;
797 my $testenv_vars = undef;
803 $option =~ s/^[^:]*//;
806 $option = "client" if $option eq "";
808 if ($envname eq "none") {
810 } elsif (defined(get_running_env
($envname))) {
811 $testenv_vars = get_running_env
($envname);
812 if (not $testenv_vars->{target
}->check_env($testenv_vars)) {
813 print $testenv_vars->{target
}->getlog_env($testenv_vars);
814 $testenv_vars = undef;
817 $testenv_vars = $target->setup_env($envname, $prefix);
818 if (defined($testenv_vars) and $testenv_vars eq "UNKNOWN") {
819 return $testenv_vars;
820 } elsif (defined($testenv_vars) && not defined($testenv_vars->{target
})) {
821 $testenv_vars->{target
} = $target;
823 if (not defined($testenv_vars)) {
824 warn("$opt_target can't start up known environment '$envname'");
828 return undef unless defined($testenv_vars);
830 $running_envs{$envname} = $testenv_vars;
832 if ($option eq "local") {
833 SocketWrapper
::set_default_iface
($testenv_vars->{SOCKET_WRAPPER_DEFAULT_IFACE
});
834 $ENV{SMB_CONF_PATH
} = $testenv_vars->{SERVERCONFFILE
};
835 } elsif ($option eq "client") {
836 SocketWrapper
::set_default_iface
(11);
837 write_clientconf
($conffile, $clientdir, $testenv_vars);
838 $ENV{SMB_CONF_PATH
} = $conffile;
840 die("Unknown option[$option] for envname[$envname]");
843 foreach (@exported_envvars) {
844 if (defined($testenv_vars->{$_})) {
845 $ENV{$_} = $testenv_vars->{$_};
851 return $testenv_vars;
854 sub exported_envvars_str
($)
856 my ($testenv_vars) = @_;
859 foreach (@exported_envvars) {
860 next unless defined($testenv_vars->{$_});
861 $out .= $_."=".$testenv_vars->{$_}."\n";
870 return "" if ($envname eq "none");
871 my $env = get_running_env
($envname);
872 return $env->{target
}->getlog_env($env);
878 return 1 if ($envname eq "none");
879 my $env = get_running_env
($envname);
880 return $env->{target
}->check_env($env);
886 return if ($envname eq "none");
887 print STDERR
"teardown_env($envname)\n";
888 my $env = get_running_env
($envname);
889 $env->{target
}->teardown_env($env);
890 delete $running_envs{$envname};
893 # This 'global' file needs to be empty when we start
894 unlink("$prefix_abs/dns_host_file");
895 unlink("$prefix_abs/hosts");
897 if ($opt_random_order) {
899 my @newtodo = List
::Util
::shuffle
(@todo);
904 my $testenv_name = $ENV{SELFTEST_TESTENV
};
905 $testenv_name = $testenv_default unless defined($testenv_name);
907 my $testenv_vars = setup_env
($testenv_name, $prefix);
909 if (not $testenv_vars or $testenv_vars eq "UNKNOWN") {
910 die("Unable to setup environment $testenv_name");
913 $ENV{PIDDIR
} = $testenv_vars->{PIDDIR
};
914 $ENV{ENVNAME
} = $testenv_name;
916 my $envvarstr = exported_envvars_str
($testenv_vars);
918 my @term_args = ("echo -e \"
919 Welcome to the Samba4 Test environment '$testenv_name'
921 This matches the client environment used in make test
922 server is pid `cat \$PIDDIR/samba.pid`
924 Some useful environment variables:
925 TORTURE_OPTIONS=\$TORTURE_OPTIONS
926 SMB_CONF_PATH=\$SMB_CONF_PATH
929 \" && LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH} bash");
931 if ($ENV{TERMINAL
}) {
932 @term = ($ENV{TERMINAL
});
934 @term = ("xterm", "-e");
935 unshift(@term_args, ("bash", "-c"));
938 system(@term, @term_args);
940 teardown_env
($testenv_name);
941 } elsif ($opt_list) {
944 my $envname = $$_[1];
946 my $listcmd = $$_[3];
948 unless (defined($listcmd)) {
949 warn("Unable to list tests in $name");
956 die("Unable to run $listcmd: $!");
958 die(sprintf("%s died with signal %d, %s coredump\n", $listcmd, ($?
& 127), ($?
& 128) ?
'with' : 'without'));
961 my $exitcode = $?
>> 8;
962 if ($exitcode != 0) {
963 die("$cmd exited with exit code $exitcode");
971 my $envname = $$_[1];
973 my $envvars = setup_env
($envname, $prefix);
974 if (not defined($envvars)) {
975 Subunit
::start_testsuite
($name);
976 Subunit
::end_testsuite
($name, "error",
977 "unable to set up environment $envname - exiting");
979 } elsif ($envvars eq "UNKNOWN") {
980 Subunit
::start_testsuite
($name);
981 Subunit
::end_testsuite
($name, "skip",
982 "environment $envname is unknown in this test backend - skipping");
986 # Generate a file with the individual tests to run, if the
987 # test runner for this test suite supports it.
988 if ($individual_tests and $individual_tests->{$name}) {
990 my ($fh, $listid_file) = tempfile
(UNLINK
=> 0);
991 foreach my $test (@
{$individual_tests->{$name}}) {
992 print $fh substr($test, length($name)+1) . "\n";
994 $cmd =~ s/\$LOADLIST/--load-list=$listid_file/g;
996 warn("Unable to run individual tests in $name, it does not support --loadlist.");
1000 run_testsuite
($envname, $name, $cmd, $i, $suitestotal);
1002 teardown_env
($envname) if ($opt_resetup_env);
1008 teardown_env
($_) foreach (keys %running_envs);
1012 # if there were any valgrind failures, show them
1013 foreach (<$prefix/valgrind
.log*>) {
1014 next unless (-s
$_);
1015 print "VALGRIND FAILURE\n";