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/>.
23 selftest - Samba test runner
29 selftest [--srcdir=DIR] [--bindir=DIR] [--target=samba|samba3|win] [--socket-wrapper] [--quick] [--exclude=FILE] [--include=FILE] [--one] [--prefix=prefix] [--testlist=FILE] [TESTS]
33 A simple test runner. TESTS is a regular expression with tests to run.
41 Show list of available options.
49 Built binaries directory.
53 Change directory to run tests in. Default is 'st'.
55 =item I<--target samba|samba3|win>
57 Specify test target against which to run. Default is 'samba4'.
61 Run only a limited number of tests. Intended to run in about 30 seconds on
62 moderately recent systems.
64 =item I<--socket-wrapper>
66 Use socket wrapper library for communication with server. Only works
67 when the server is running locally.
69 Will prevent TCP and UDP ports being opened on the local host but
70 (transparently) redirects these calls to use unix domain sockets.
74 Specify a file containing a list of tests that should be skipped. Possible
75 candidates are tests that segfault the server, flip or don't end.
79 Specify a file containing a list of tests that should be run. Same format
80 as the --exclude flag.
82 Not includes specified means all tests will be run.
86 Abort as soon as one test fails.
90 Load a list of tests from the specified location.
98 =item I<SMBD_VALGRIND>
100 =item I<TORTURE_MAXTIME>
112 selftest is licensed under the GNU General Public License L<http://www.gnu.org/licenses/gpl.html>.
122 use FindBin
qw($RealBin $Script);
124 use File::Temp qw(tempfile);
127 use Cwd
qw(abs_path);
134 Time
::HiRes
->import("time");
137 print "You don't have Time::Hires installed !\n";
141 my $opt_target = "samba";
143 my $opt_socket_wrapper = 0;
144 my $opt_socket_wrapper_pcap = undef;
145 my $opt_socket_wrapper_keep_pcap = undef;
147 my @opt_exclude = ();
148 my @opt_include = ();
153 my $opt_resetup_env = undef;
154 my $opt_binary_mapping = "";
155 my $opt_load_list = undef;
159 my $bindir = "./bin";
167 print STDERR
"Exiting early because of SIGPIPE.\n";
171 $SIG{PIPE
} = \
&pipe_handler
;
175 my ($list, $fullname) = @_;
178 if ($fullname =~ /$$_[0]/) {
179 return ($$_[1]) if ($$_[1]);
191 return find_in_list
(\
@excludes, $name);
200 return unless ($opt_socket_wrapper_pcap);
201 return unless defined($ENV{SOCKET_WRAPPER_PCAP_DIR
});
204 $fname =~ s
%[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\
-]%_%g;
206 my $pcap_file = "$ENV{SOCKET_WRAPPER_PCAP_DIR}/$fname.pcap";
208 SocketWrapper
::setup_pcap
($pcap_file);
215 my ($pcap_file, $exitcode) = @_;
217 return unless ($opt_socket_wrapper_pcap);
218 return if ($opt_socket_wrapper_keep_pcap);
219 return unless ($exitcode == 0);
220 return unless defined($pcap_file);
225 # expand strings from %ENV
226 sub expand_environment_strings
($)
229 # we use a reverse sort so we do the longer ones first
230 foreach my $k (sort { $b cmp $a } keys %ENV) {
231 $s =~ s/\$$k/$ENV{$k}/g;
236 sub run_testsuite
($$$$$)
238 my ($envname, $name, $cmd, $i, $totalsuites) = @_;
239 my $pcap_file = setup_pcap
($name);
241 Subunit
::start_testsuite
($name);
242 Subunit
::progress_push
();
243 Subunit
::report_time
(time());
245 Subunit
::report_time
(time());
246 Subunit
::progress_pop
();
249 Subunit
::progress_pop
();
250 Subunit
::end_testsuite
($name, "error", "Unable to run $cmd: $!");
253 Subunit
::end_testsuite
($name, "error",
254 sprintf("%s died with signal %d, %s coredump\n", $cmd, ($?
& 127), ($?
& 128) ?
'with' : 'without'));
258 my $exitcode = $?
>> 8;
260 my $envlog = getlog_env
($envname);
262 print "envlog: $envlog\n";
265 print "command: $cmd\n";
266 printf "expanded command: %s\n", expand_environment_strings
($cmd);
268 if ($exitcode == 0) {
269 Subunit
::end_testsuite
($name, "success");
271 Subunit
::end_testsuite
($name, "failure", "Exit code was $exitcode");
274 cleanup_pcap
($pcap_file, $exitcode);
276 if (not $opt_socket_wrapper_keep_pcap and defined($pcap_file)) {
277 print "PCAP FILE: $pcap_file\n";
280 if ($exitcode != 0) {
281 exit(1) if ($opt_one);
289 print "Samba test runner
290 Copyright (C) Jelmer Vernooij <jelmer\@samba.org>
291 Copyright (C) Stefan Metzmacher <metze\@samba.org>
293 Usage: $Script [OPTIONS] TESTNAME-REGEX
296 --help this help page
297 --target=samba[3]|win Samba version to target
298 --testlist=FILE file to read available tests from
301 --prefix=DIR prefix to run tests in [st]
302 --srcdir=DIR source directory [.]
303 --bindir=DIR binaries directory [./bin]
306 --socket-wrapper-pcap save traffic to pcap directories
307 --socket-wrapper-keep-pcap keep all pcap files, not just those for tests that
309 --socket-wrapper enable socket wrapper
312 --ldap=openldap|fedora-ds back samba onto specified ldap server
315 --quick run quick overall test
316 --one abort when the first test fails
318 --testenv run a shell in the requested test environment
319 --list list available tests
324 my $result = GetOptions
(
325 'help|h|?' => \
$opt_help,
326 'target=s' => \
$opt_target,
327 'prefix=s' => \
$prefix,
328 'socket-wrapper' => \
$opt_socket_wrapper,
329 'socket-wrapper-pcap' => \
$opt_socket_wrapper_pcap,
330 'socket-wrapper-keep-pcap' => \
$opt_socket_wrapper_keep_pcap,
331 'quick' => \
$opt_quick,
333 'exclude=s' => \
@opt_exclude,
334 'include=s' => \
@opt_include,
335 'srcdir=s' => \
$srcdir,
336 'bindir=s' => \
$bindir,
337 'verbose' => \
$opt_verbose,
338 'testenv' => \
$opt_testenv,
339 'list' => \
$opt_list,
341 'resetup-environment' => \
$opt_resetup_env,
342 'testlist=s' => \
@testlists,
343 'load-list=s' => \
$opt_load_list,
344 'binary-mapping=s' => \
$opt_binary_mapping
347 exit(1) if (not $result);
349 ShowHelp
() if ($opt_help);
351 die("--list and --testenv are mutually exclusive") if ($opt_list and $opt_testenv);
353 # we want unbuffered output
358 # quick hack to disable rpc validation when using valgrind - its way too slow
359 unless (defined($ENV{VALGRIND
})) {
360 $ENV{VALIDATE
} = "validate";
361 $ENV{MALLOC_CHECK_
} = 2;
364 # make all our python scripts unbuffered
365 $ENV{PYTHONUNBUFFERED
} = 1;
367 my $bindir_abs = abs_path
($bindir);
369 # Backwards compatibility:
370 if (defined($ENV{TEST_LDAP
}) and $ENV{TEST_LDAP
} eq "yes") {
371 if (defined($ENV{FEDORA_DS_ROOT
})) {
378 my $torture_maxtime = ($ENV{TORTURE_MAXTIME
} or 1200);
381 $torture_maxtime *= 2;
388 die("using an empty prefix isn't allowed") unless $prefix ne "";
390 # Ensure we have the test prefix around.
392 # We need restrictive
393 # permissions on this as some subdirectories in this tree will have
394 # wider permissions (ie 0777) and this would allow other users on the
395 # host to subvert the test process.
396 mkdir($prefix, 0700) unless -d
$prefix;
399 my $prefix_abs = abs_path
($prefix);
400 my $tmpdir_abs = abs_path
("$prefix/tmp");
401 mkdir($tmpdir_abs, 0777) unless -d
$tmpdir_abs;
403 my $srcdir_abs = abs_path
($srcdir);
405 die("using an empty absolute prefix isn't allowed") unless $prefix_abs ne "";
406 die("using '/' as absolute prefix isn't allowed") unless $prefix_abs ne "/";
408 $ENV{PREFIX
} = $prefix;
409 $ENV{KRB5CCNAME
} = "$prefix/krb5ticket";
410 $ENV{PREFIX_ABS
} = $prefix_abs;
411 $ENV{SRCDIR
} = $srcdir;
412 $ENV{SRCDIR_ABS
} = $srcdir_abs;
413 $ENV{BINDIR
} = $bindir_abs;
415 my $tls_enabled = not $opt_quick;
416 $ENV{TLS_ENABLED
} = ($tls_enabled?
"yes":"no");
418 sub prefix_pathvar
($$)
420 my ($name, $newpath) = @_;
421 if (defined($ENV{$name})) {
422 $ENV{$name} = "$newpath:$ENV{$name}";
424 $ENV{$name} = $newpath;
427 prefix_pathvar
("PKG_CONFIG_PATH", "$bindir_abs/pkgconfig");
428 prefix_pathvar
("PYTHONPATH", "$bindir_abs/python");
430 if ($opt_socket_wrapper_keep_pcap) {
431 # Socket wrapper keep pcap implies socket wrapper pcap
432 $opt_socket_wrapper_pcap = 1;
435 if ($opt_socket_wrapper_pcap) {
436 # Socket wrapper pcap implies socket wrapper
437 $opt_socket_wrapper = 1;
440 my $socket_wrapper_dir;
441 if ($opt_socket_wrapper) {
442 $socket_wrapper_dir = SocketWrapper
::setup_dir
("$prefix_abs/w", $opt_socket_wrapper_pcap);
443 print "SOCKET_WRAPPER_DIR=$socket_wrapper_dir\n";
444 } elsif (not $opt_list) {
446 warn("not using socket wrapper, but also not running as root. Will not be able to listen on proper ports");
451 my $testenv_default = "none";
453 my %binary_mapping = ();
454 if ($opt_binary_mapping) {
455 my @binmapping_list = split(/,/, $opt_binary_mapping);
456 foreach my $mapping (@binmapping_list) {
457 my ($bin, $map) = split(/\:/, $mapping);
458 $binary_mapping{$bin} = $map;
462 $ENV{BINARY_MAPPING
} = $opt_binary_mapping;
464 # After this many seconds, the server will self-terminate. All tests
465 # must terminate in this time, and testenv will only stay alive this
468 my $server_maxtime = 7500;
469 if (defined($ENV{SMBD_MAXTIME
}) and $ENV{SMBD_MAXTIME
} ne "") {
470 $server_maxtime = $ENV{SMBD_MAXTIME
};
474 if ($opt_target eq "samba") {
475 if ($opt_socket_wrapper and `$bindir/smbd -b | grep SOCKET_WRAPPER` eq "") {
476 die("You must include --enable-socket-wrapper when compiling Samba in order to execute 'make test'. Exiting....");
478 $testenv_default = "dc";
479 require target
::Samba
;
480 $target = new Samba
($bindir, \
%binary_mapping, $ldap, $srcdir, $server_maxtime);
481 } elsif ($opt_target eq "samba3") {
482 if ($opt_socket_wrapper and `$bindir/smbd -b | grep SOCKET_WRAPPER` eq "") {
483 die("You must include --enable-socket-wrapper when compiling Samba in order to execute 'make test'. Exiting....");
485 $testenv_default = "member";
486 require target
::Samba3
;
487 $target = new Samba3
($bindir, \
%binary_mapping, $srcdir_abs, $server_maxtime);
488 } elsif ($opt_target eq "win") {
489 die("Windows tests will not run with socket wrapper enabled.")
490 if ($opt_socket_wrapper);
491 $testenv_default = "dc";
492 require target
::Windows
;
493 $target = new Windows
();
498 # Start a Virtual Distributed Ethernet Switch
499 # Returns the pid of the switch.
501 sub start_vde_switch
($)
505 system("vde_switch --pidfile $path/vde.pid --sock $path/vde.sock --daemon");
507 open(PID
, "$path/vde.pid");
515 # Stop a Virtual Distributed Ethernet Switch
516 sub stop_vde_switch
($)
522 sub read_test_regexes
($)
526 open(LF
, "<$name") or die("unable to read $name: $!");
530 if (/^(.*?)([ \t]+)\#([\t ]*)(.*?)$/) {
531 push (@ret, [$1, $4]);
533 s/^(.*?)([ \t]+)\#([\t ]*)(.*?)$//;
534 push (@ret, [$_, undef]);
541 foreach (@opt_exclude) {
542 push (@excludes, read_test_regexes
($_));
545 foreach (@opt_include) {
546 push (@includes, read_test_regexes
($_));
549 my $interfaces = join(',', ("127.0.0.11/8",
556 my $clientdir = "$prefix_abs/client";
558 my $conffile = "$clientdir/client.conf";
559 $ENV{SMB_CONF_PATH
} = $conffile;
561 sub write_clientconf
($$$)
563 my ($conffile, $clientdir, $vars) = @_;
565 mkdir("$clientdir", 0777) unless -d
"$clientdir";
567 if ( -d
"$clientdir/private" ) {
568 unlink <$clientdir/private/*>;
570 mkdir("$clientdir/private", 0777);
573 if ( -d
"$clientdir/lockdir" ) {
574 unlink <$clientdir/lockdir/*>;
576 mkdir("$clientdir/lockdir", 0777);
579 if ( -d
"$clientdir/statedir" ) {
580 unlink <$clientdir/statedir/*>;
582 mkdir("$clientdir/statedir", 0777);
585 if ( -d
"$clientdir/cachedir" ) {
586 unlink <$clientdir/cachedir/*>;
588 mkdir("$clientdir/cachedir", 0777);
591 # this is ugly, but the ncalrpcdir needs exactly 0755
592 # otherwise tests fail.
595 if ( -d
"$clientdir/ncalrpcdir/np" ) {
596 unlink <$clientdir/ncalrpcdir/np
/*>;
597 rmdir "$clientdir/ncalrpcdir/np";
599 if ( -d
"$clientdir/ncalrpcdir" ) {
600 unlink <$clientdir/ncalrpcdir/*>;
601 rmdir "$clientdir/ncalrpcdir";
603 mkdir("$clientdir/ncalrpcdir", 0755);
606 open(CF
, ">$conffile");
607 print CF
"[global]\n";
608 print CF
"\tnetbios name = client\n";
609 if (defined($vars->{DOMAIN
})) {
610 print CF
"\tworkgroup = $vars->{DOMAIN}\n";
612 if (defined($vars->{REALM
})) {
613 print CF
"\trealm = $vars->{REALM}\n";
615 if ($opt_socket_wrapper) {
616 print CF
"\tinterfaces = $interfaces\n";
619 private dir = $clientdir/private
620 lock dir = $clientdir/lockdir
621 state directory = $clientdir/statedir
622 cache directory = $clientdir/cachedir
623 ncalrpc dir = $clientdir/ncalrpcdir
624 name resolve order = file bcast
625 panic action = $RealBin/gdb_backtrace \%d
627 notify:inotify = false
629 system:anonymous = true
630 client lanman auth = Yes
632 torture:basedir = $clientdir
633 #We don't want to pass our self-tests if the PAC code is wrong
634 gensec:require_pac = true
635 resolv:host file = $prefix_abs/dns_host_file
636 #We don't want to run 'speed' tests for very long
637 torture:timelimit = 1
644 sub should_run_test
($)
650 for (my $i=0; $i <= $#tests; $i++) {
651 if ($name =~ /$tests[$i]/i) {
663 open(IN
, $filename) or die("Unable to open $filename: $!");
666 if (/-- TEST(-LOADLIST|-IDLIST|) --\n/) {
667 my $supports_loadlist = (defined($1) and $1 eq "-LOADLIST");
668 my $supports_idlist = (defined($1) and $1 eq "-IDLIST");
675 if (should_run_test
($name) == 1) {
676 push (@ret, [$name, $env, $cmdline, $supports_loadlist, $supports_idlist]);
682 close(IN
) or die("Error creating recipe");
686 if ($#testlists == -1) {
687 die("No testlists specified");
690 $ENV{SELFTEST_PREFIX
} = "$prefix_abs";
691 $ENV{SELFTEST_TMPDIR
} = "$tmpdir_abs";
692 $ENV{TEST_DATA_PREFIX
} = "$tmpdir_abs";
693 if ($opt_socket_wrapper) {
694 $ENV{SELFTEST_INTERFACES
} = $interfaces;
696 $ENV{SELFTEST_INTERFACES
} = "";
699 $ENV{SELFTEST_VERBOSE
} = "1";
701 $ENV{SELFTEST_VERBOSE
} = "";
704 $ENV{SELFTEST_QUICK
} = "1";
706 $ENV{SELFTEST_QUICK
} = "";
708 $ENV{SELFTEST_MAXTIME
} = $torture_maxtime;
711 foreach my $fn (@testlists) {
712 foreach (read_testlist
($fn)) {
714 next if (@includes and not defined(find_in_list
(\
@includes, $name)));
715 push (@available, $_);
719 my $restricted = undef;
720 my $restricted_used = {};
722 if ($opt_load_list) {
724 open(LOAD_LIST
, "<$opt_load_list") or die("Unable to open $opt_load_list");
725 while (<LOAD_LIST
>) {
727 push (@
$restricted, $_);
732 my $individual_tests = undef;
733 $individual_tests = {};
735 foreach my $testsuite (@available) {
736 my $name = $$testsuite[0];
737 my $skipreason = skip
($name);
738 if (defined($restricted)) {
739 # Find the testsuite for this test
741 foreach my $r (@
$restricted) {
743 $individual_tests->{$name} = [];
745 $restricted_used->{$r} = 1;
746 } elsif (substr($r, 0, length($name)+1) eq "$name.") {
747 push(@
{$individual_tests->{$name}}, $r);
749 $restricted_used->{$r} = 1;
753 if (defined($skipreason)) {
755 Subunit
::skip_testsuite
($name, $skipreason);
758 push(@todo, $testsuite);
761 } elsif (defined($skipreason)) {
763 Subunit
::skip_testsuite
($name, $skipreason);
766 push(@todo, $testsuite);
770 if (defined($restricted)) {
771 foreach (@
$restricted) {
772 unless (defined($restricted_used->{$_})) {
773 print "No test or testsuite found matching $_\n";
776 } elsif ($#todo == -1) {
777 print STDERR
"No tests to run\n";
781 my $suitestotal = $#todo + 1;
784 Subunit
::progress
($suitestotal);
785 Subunit
::report_time
(time());
791 my %running_envs = ();
793 sub get_running_env
($)
801 return $running_envs{$envname};
804 my @exported_envvars = (
809 # domain controller stuff
818 "MEMBER_NETBIOSNAME",
819 "MEMBER_NETBIOSALIAS",
821 # rpc proxy controller stuff
823 "RPC_PROXY_SERVER_IP",
824 "RPC_PROXY_NETBIOSNAME",
825 "RPC_PROXY_NETBIOSALIAS",
827 # domain controller stuff for Vampired DC
829 "VAMPIRE_DC_SERVER_IP",
830 "VAMPIRE_DC_NETBIOSNAME",
831 "VAMPIRE_DC_NETBIOSALIAS",
848 "WINBINDD_SOCKET_DIR",
849 "WINBINDD_PRIV_PIPE_DIR",
854 $SIG{INT
} = $SIG{QUIT
} = $SIG{TERM
} = sub {
856 teardown_env
($_) foreach(keys %running_envs);
857 die("Received signal $signame");
862 my ($name, $prefix) = @_;
864 my $testenv_vars = undef;
870 $option =~ s/^[^:]*//;
873 $option = "client" if $option eq "";
875 if ($envname eq "none") {
877 } elsif (defined(get_running_env
($envname))) {
878 $testenv_vars = get_running_env
($envname);
879 if (not $testenv_vars->{target
}->check_env($testenv_vars)) {
880 print $testenv_vars->{target
}->getlog_env($testenv_vars);
881 $testenv_vars = undef;
884 $testenv_vars = $target->setup_env($envname, $prefix);
885 if (defined($testenv_vars) and $testenv_vars eq "UNKNOWN") {
886 return $testenv_vars;
887 } elsif (defined($testenv_vars) && not defined($testenv_vars->{target
})) {
888 $testenv_vars->{target
} = $target;
890 if (not defined($testenv_vars)) {
891 warn("$opt_target can't start up known environment '$envname'");
896 return undef unless defined($testenv_vars);
898 $running_envs{$envname} = $testenv_vars;
900 if ($option eq "local") {
901 SocketWrapper
::set_default_iface
($testenv_vars->{SOCKET_WRAPPER_DEFAULT_IFACE
});
902 $ENV{SMB_CONF_PATH
} = $testenv_vars->{SERVERCONFFILE
};
903 } elsif ($option eq "client") {
904 SocketWrapper
::set_default_iface
(11);
905 write_clientconf
($conffile, $clientdir, $testenv_vars);
906 $ENV{SMB_CONF_PATH
} = $conffile;
908 die("Unknown option[$option] for envname[$envname]");
911 foreach (@exported_envvars) {
912 if (defined($testenv_vars->{$_})) {
913 $ENV{$_} = $testenv_vars->{$_};
919 return $testenv_vars;
922 sub exported_envvars_str
($)
924 my ($testenv_vars) = @_;
927 foreach (@exported_envvars) {
928 next unless defined($testenv_vars->{$_});
929 $out .= $_."=".$testenv_vars->{$_}."\n";
938 return "" if ($envname eq "none");
939 my $env = get_running_env
($envname);
940 return $env->{target
}->getlog_env($env);
946 return 1 if ($envname eq "none");
947 my $env = get_running_env
($envname);
948 return $env->{target
}->check_env($env);
954 return if ($envname eq "none");
955 my $env = get_running_env
($envname);
956 $env->{target
}->teardown_env($env);
957 delete $running_envs{$envname};
960 # This 'global' file needs to be empty when we start
961 unlink("$prefix_abs/dns_host_file");
964 my $testenv_name = $ENV{SELFTEST_TESTENV
};
965 $testenv_name = $testenv_default unless defined($testenv_name);
967 my $testenv_vars = setup_env
($testenv_name, $prefix);
969 die("Unable to setup environment $testenv_name") unless ($testenv_vars);
971 $ENV{PIDDIR
} = $testenv_vars->{PIDDIR
};
972 $ENV{ENVNAME
} = $testenv_name;
974 my $envvarstr = exported_envvars_str
($testenv_vars);
976 my $term = ($ENV{TERMINAL
} or "xterm -e");
977 system("$term 'echo -e \"
978 Welcome to the Samba4 Test environment '$testenv_name'
980 This matches the client environment used in make test
981 server is pid `cat \$PIDDIR/samba.pid`
983 Some useful environment variables:
984 TORTURE_OPTIONS=\$TORTURE_OPTIONS
985 SMB_CONF_PATH=\$SMB_CONF_PATH
988 \" && LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH} bash'");
989 teardown_env
($testenv_name);
990 } elsif ($opt_list) {
994 my $envname = $$_[1];
996 unless($cmd =~ /\$LISTOPT/) {
997 warn("Unable to list tests in $name");
1001 $cmd =~ s/\$LISTOPT/--list/g;
1006 die("Unable to run $cmd: $!");
1007 } elsif ($?
& 127) {
1008 die(snprintf
("%s died with signal %d, %s coredump\n", $cmd, ($?
& 127), ($?
& 128) ?
'with' : 'without'));
1011 my $exitcode = $?
>> 8;
1012 if ($exitcode != 0) {
1013 die("$cmd exited with exit code $exitcode");
1021 my $envname = $$_[1];
1023 my $envvars = setup_env
($envname, $prefix);
1024 if (not defined($envvars)) {
1025 Subunit
::start_testsuite
($name);
1026 Subunit
::end_testsuite
($name, "error",
1027 "unable to set up environment $envname - exiting");
1029 } elsif ($envvars eq "UNKNOWN") {
1030 Subunit
::start_testsuite
($name);
1031 Subunit
::end_testsuite
($name, "skip",
1032 "environment $envname is unknown in this test backend - skipping");
1036 # Generate a file with the individual tests to run, if the
1037 # test runner for this test suite supports it.
1038 if ($individual_tests and $individual_tests->{$name}) {
1040 my ($fh, $listid_file) = tempfile
(UNLINK
=> 0);
1041 foreach my $test (@
{$individual_tests->{$name}}) {
1042 print $fh substr($test, length($name)+1) . "\n";
1044 $cmd =~ s/\$LOADLIST/--load-list=$listid_file/g;
1046 $cmd =~ s/\s+[^\s]+\s*$//;
1047 $cmd .= " " . join(' ', @
{$individual_tests->{$name}});
1051 run_testsuite
($envname, $name, $cmd, $i, $suitestotal);
1053 teardown_env
($envname) if ($opt_resetup_env);
1059 teardown_env
($_) foreach (keys %running_envs);
1063 # if there were any valgrind failures, show them
1064 foreach (<$prefix/valgrind
.log*>) {
1065 next unless (-s
$_);
1066 print "VALGRIND FAILURE\n";