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] [--exeext=EXT][--target=samba4|samba3|win|kvm] [--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.
57 Change directory to run tests in. Default is 'st'.
59 =item I<--target samba4|samba3|win|kvm>
61 Specify test target against which to run. Default is 'samba4'.
65 Run only a limited number of tests. Intended to run in about 30 seconds on
66 moderately recent systems.
68 =item I<--socket-wrapper>
70 Use socket wrapper library for communication with server. Only works
71 when the server is running locally.
73 Will prevent TCP and UDP ports being opened on the local host but
74 (transparently) redirects these calls to use unix domain sockets.
78 Specify a file containing a list of tests that should be skipped. Possible
79 candidates are tests that segfault the server, flip or don't end.
83 Specify a file containing a list of tests that should be run. Same format
84 as the --exclude flag.
86 Not includes specified means all tests will be run.
90 Abort as soon as one test fails.
94 Load a list of tests from the specified location.
102 =item I<SMBD_VALGRIND>
104 =item I<TORTURE_MAXTIME>
116 selftest is licensed under the GNU General Public License L<http://www.gnu.org/licenses/gpl.html>.
126 use FindBin qw($RealBin $Script);
128 use File::Temp qw(tempfile);
131 use Cwd qw(abs_path);
138 Time::HiRes->import("time");
141 print "You don't have Time::Hires installed !\n";
145 my $opt_target = "samba4";
147 my $opt_socket_wrapper = 0;
148 my $opt_socket_wrapper_pcap = undef;
149 my $opt_socket_wrapper_keep_pcap = undef;
151 my @opt_exclude = ();
152 my @opt_include = ();
154 my $opt_image = undef;
158 my $opt_resetup_env = undef;
159 my $opt_binary_mapping = "";
160 my $opt_load_list = undef;
164 my $bindir = "./bin";
173 print STDERR "Exiting early because of SIGPIPE.\n";
177 $SIG{PIPE} = \&pipe_handler;
181 my ($list, $fullname) = @_;
184 if ($fullname =~ /$$_[0]/) {
185 return ($$_[1]) if ($$_[1]);
197 return find_in_list(\@excludes, $name);
206 return unless ($opt_socket_wrapper_pcap);
207 return unless defined($ENV{SOCKET_WRAPPER_PCAP_DIR});
210 $fname =~ s%[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\-]%_%g;
212 my $pcap_file = "$ENV{SOCKET_WRAPPER_PCAP_DIR}/$fname.pcap";
214 SocketWrapper::setup_pcap($pcap_file);
221 my ($pcap_file, $exitcode) = @_;
223 return unless ($opt_socket_wrapper_pcap);
224 return if ($opt_socket_wrapper_keep_pcap);
225 return unless ($exitcode == 0);
226 return unless defined($pcap_file);
231 # expand strings from %ENV
232 sub expand_environment_strings($)
235 # we use a reverse sort so we do the longer ones first
236 foreach my $k (sort { $b cmp $a } keys %ENV) {
237 $s =~ s/\$$k/$ENV{$k}/g;
242 sub run_testsuite($$$$$)
244 my ($envname, $name, $cmd, $i, $totalsuites) = @_;
245 my $pcap_file = setup_pcap($name);
247 Subunit::start_testsuite($name);
248 Subunit::progress_push();
249 Subunit::report_time(time());
251 Subunit::report_time(time());
252 Subunit::progress_pop();
255 Subunit::progress_pop();
256 Subunit::end_testsuite($name, "error", "Unable to run $cmd: $!");
259 Subunit::end_testsuite($name, "error",
260 sprintf("%s died with signal %d, %s coredump\n", $cmd, ($? & 127), ($? & 128) ? 'with' : 'without'));
264 my $exitcode = $? >> 8;
266 my $envlog = getlog_env($envname);
268 print "envlog: $envlog\n";
271 print "command: $cmd\n";
272 printf "expanded command: %s\n", expand_environment_strings($cmd);
274 if ($exitcode == 0) {
275 Subunit::end_testsuite($name, "success");
277 Subunit::end_testsuite($name, "failure", "Exit code was $exitcode");
280 cleanup_pcap($pcap_file, $exitcode);
282 if (not $opt_socket_wrapper_keep_pcap and defined($pcap_file)) {
283 print "PCAP FILE: $pcap_file\n";
286 if ($exitcode != 0) {
287 exit(1) if ($opt_one);
295 print "Samba test runner
296 Copyright (C) Jelmer Vernooij <jelmer\@samba.org>
297 Copyright (C) Stefan Metzmacher <metze\@samba.org>
299 Usage: $Script [OPTIONS] TESTNAME-REGEX
302 --help this help page
303 --target=samba[34]|win|kvm Samba version to target
304 --testlist=FILE file to read available tests from
307 --prefix=DIR prefix to run tests in [st]
308 --srcdir=DIR source directory [.]
309 --bindir=DIR binaries directory [./bin]
310 --exeext=EXT executable extention []
313 --socket-wrapper-pcap save traffic to pcap directories
314 --socket-wrapper-keep-pcap keep all pcap files, not just those for tests that
316 --socket-wrapper enable socket wrapper
319 --ldap=openldap|fedora-ds back samba onto specified ldap server
322 --image=PATH path to KVM image
325 --quick run quick overall test
326 --one abort when the first test fails
328 --testenv run a shell in the requested test environment
329 --list list available tests
334 my $result = GetOptions (
335 'help|h|?' => \$opt_help,
336 'target=s' => \$opt_target,
337 'prefix=s' => \$prefix,
338 'socket-wrapper' => \$opt_socket_wrapper,
339 'socket-wrapper-pcap' => \$opt_socket_wrapper_pcap,
340 'socket-wrapper-keep-pcap' => \$opt_socket_wrapper_keep_pcap,
341 'quick' => \$opt_quick,
343 'exclude=s' => \@opt_exclude,
344 'include=s' => \@opt_include,
345 'srcdir=s' => \$srcdir,
346 'bindir=s' => \$bindir,
347 'exeext=s' => \$exeext,
348 'verbose' => \$opt_verbose,
349 'testenv' => \$opt_testenv,
350 'list' => \$opt_list,
352 'resetup-environment' => \$opt_resetup_env,
353 'image=s' => \$opt_image,
354 'testlist=s' => \@testlists,
355 'load-list=s' => \$opt_load_list,
356 'binary-mapping=s' => \$opt_binary_mapping
359 exit(1) if (not $result);
361 ShowHelp() if ($opt_help);
363 die("--list and --testenv are mutually exclusive") if ($opt_list and $opt_testenv);
365 # we want unbuffered output
370 # quick hack to disable rpc validation when using valgrind - its way too slow
371 unless (defined($ENV{VALGRIND})) {
372 $ENV{VALIDATE} = "validate";
373 $ENV{MALLOC_CHECK_} = 2;
376 # make all our python scripts unbuffered
377 $ENV{PYTHONUNBUFFERED} = 1;
379 my $bindir_abs = abs_path($bindir);
381 # Backwards compatibility:
382 if (defined($ENV{TEST_LDAP}) and $ENV{TEST_LDAP} eq "yes") {
383 if (defined($ENV{FEDORA_DS_ROOT})) {
390 my $torture_maxtime = ($ENV{TORTURE_MAXTIME} or 1200);
393 $torture_maxtime *= 2;
400 die("using an empty prefix isn't allowed") unless $prefix ne "";
402 #Ensure we have the test prefix around
403 mkdir($prefix, 0777) unless -d $prefix;
405 my $prefix_abs = abs_path($prefix);
406 my $tmpdir_abs = abs_path("$prefix/tmp");
407 mkdir($tmpdir_abs, 0777) unless -d $tmpdir_abs;
409 my $srcdir_abs = abs_path($srcdir);
411 die("using an empty absolute prefix isn't allowed") unless $prefix_abs ne "";
412 die("using '/' as absolute prefix isn't allowed") unless $prefix_abs ne "/";
414 $ENV{PREFIX} = $prefix;
415 $ENV{KRB5CCNAME} = "$prefix/krb5ticket";
416 $ENV{PREFIX_ABS} = $prefix_abs;
417 $ENV{SRCDIR} = $srcdir;
418 $ENV{SRCDIR_ABS} = $srcdir_abs;
419 $ENV{BINDIR} = $bindir_abs;
420 $ENV{EXEEXT} = $exeext;
422 my $tls_enabled = not $opt_quick;
423 $ENV{TLS_ENABLED} = ($tls_enabled?"yes":"no");
425 sub prefix_pathvar($$)
427 my ($name, $newpath) = @_;
428 if (defined($ENV{$name})) {
429 $ENV{$name} = "$newpath:$ENV{$name}";
431 $ENV{$name} = $newpath;
434 prefix_pathvar("PKG_CONFIG_PATH", "$bindir_abs/pkgconfig");
435 prefix_pathvar("PYTHONPATH", "$bindir_abs/python");
437 if ($opt_socket_wrapper_keep_pcap) {
438 # Socket wrapper keep pcap implies socket wrapper pcap
439 $opt_socket_wrapper_pcap = 1;
442 if ($opt_socket_wrapper_pcap) {
443 # Socket wrapper pcap implies socket wrapper
444 $opt_socket_wrapper = 1;
447 my $socket_wrapper_dir;
448 if ($opt_socket_wrapper) {
449 $socket_wrapper_dir = SocketWrapper::setup_dir("$prefix_abs/w", $opt_socket_wrapper_pcap);
450 print "SOCKET_WRAPPER_DIR=$socket_wrapper_dir\n";
453 print "WARNING: Not using socket wrapper, but also not running as root. Will not be able to listen on proper ports\n";
458 my $testenv_default = "none";
460 my %binary_mapping = {};
461 if ($opt_binary_mapping) {
462 my @binmapping_list = split(/,/, $opt_binary_mapping);
463 foreach my $mapping (@binmapping_list) {
464 my ($bin, $map) = split(/\:/, $mapping);
465 $binary_mapping{$bin} = $map;
469 $ENV{BINARY_MAPPING} = $opt_binary_mapping;
471 sub bindir_path($$) {
472 my ($self, $path) = @_;
474 if (defined($self->{binary_mapping}->{$path})) {
475 $path = $self->{binary_mapping}->{$path};
478 my $valpath = "$self->{bindir}/$path$self->{exeext}";
480 return $valpath if (-f $valpath);
484 if ($opt_target eq "samba") {
485 if ($opt_socket_wrapper and `$bindir/smbd -b | grep SOCKET_WRAPPER` eq "") {
486 die("You must include --enable-socket-wrapper when compiling Samba in order to execute 'make test'. Exiting....");
488 $testenv_default = "all";
489 require target::Samba;
490 $target = new Samba($bindir, \%binary_mapping, \&bindir_path, $ldap, $srcdir, $exeext);
491 } elsif ($opt_target eq "samba4") {
492 $testenv_default = "all";
493 require target::Samba4;
494 $target = new Samba4($bindir, \%binary_mapping, \&bindir_path, $ldap, $srcdir, $exeext);
495 } elsif ($opt_target eq "samba3") {
496 if ($opt_socket_wrapper and `$bindir/smbd -b | grep SOCKET_WRAPPER` eq "") {
497 die("You must include --enable-socket-wrapper when compiling Samba in order to execute 'make test'. Exiting....");
499 $testenv_default = "member";
500 require target::Samba3;
501 $target = new Samba3($bindir, \%binary_mapping, \&bindir_path, $srcdir_abs, $exeext);
502 } elsif ($opt_target eq "win") {
503 die("Windows tests will not run with socket wrapper enabled.")
504 if ($opt_socket_wrapper);
505 $testenv_default = "dc";
506 require target::Windows;
507 $target = new Windows();
508 } elsif ($opt_target eq "kvm") {
509 die("Kvm tests will not run with socket wrapper enabled.")
510 if ($opt_socket_wrapper);
512 die("No image specified") unless ($opt_image);
513 $target = new Kvm($opt_image, undef);
517 # Start a Virtual Distributed Ethernet Switch
518 # Returns the pid of the switch.
520 sub start_vde_switch($)
524 system("vde_switch --pidfile $path/vde.pid --sock $path/vde.sock --daemon");
526 open(PID, "$path/vde.pid");
534 # Stop a Virtual Distributed Ethernet Switch
535 sub stop_vde_switch($)
541 sub read_test_regexes($)
545 open(LF, "<$name") or die("unable to read $name: $!");
549 if (/^(.*?)([ \t]+)\#([\t ]*)(.*?)$/) {
550 push (@ret, [$1, $4]);
552 s/^(.*?)([ \t]+)\#([\t ]*)(.*?)$//;
553 push (@ret, [$_, undef]);
560 foreach (@opt_exclude) {
561 push (@excludes, read_test_regexes($_));
564 foreach (@opt_include) {
565 push (@includes, read_test_regexes($_));
568 my $interfaces = join(',', ("127.0.0.11/8",
575 my $clientdir = "$prefix_abs/client";
577 my $conffile = "$clientdir/client.conf";
578 $ENV{SMB_CONF_PATH} = $conffile;
580 sub write_clientconf($$$)
582 my ($conffile, $clientdir, $vars) = @_;
584 mkdir("$clientdir", 0777) unless -d "$clientdir";
586 if ( -d "$clientdir/private" ) {
587 unlink <$clientdir/private/*>;
589 mkdir("$clientdir/private", 0777);
592 if ( -d "$clientdir/lockdir" ) {
593 unlink <$clientdir/lockdir/*>;
595 mkdir("$clientdir/lockdir", 0777);
598 if ( -d "$clientdir/ncalrpcdir" ) {
599 unlink <$clientdir/ncalrpcdir/*>;
601 mkdir("$clientdir/ncalrpcdir", 0777);
604 open(CF, ">$conffile");
605 print CF "[global]\n";
606 if (defined($ENV{VALGRIND})) {
607 print CF "\ticonv:native = true\n";
609 print CF "\ticonv:native = false\n";
611 print CF "\tnetbios name = client\n";
612 if (defined($vars->{DOMAIN})) {
613 print CF "\tworkgroup = $vars->{DOMAIN}\n";
615 if (defined($vars->{REALM})) {
616 print CF "\trealm = $vars->{REALM}\n";
618 if ($opt_socket_wrapper) {
619 print CF "\tinterfaces = $interfaces\n";
622 private dir = $clientdir/private
623 lock dir = $clientdir/lockdir
624 ncalrpc dir = $clientdir/ncalrpcdir
625 name resolve order = file bcast
626 panic action = $RealBin/gdb_backtrace \%PID\% \%PROG\%
628 notify:inotify = false
630 system:anonymous = true
631 client lanman auth = Yes
633 torture:basedir = $clientdir
634 #We don't want to pass our self-tests if the PAC code is wrong
635 gensec:require_pac = true
636 resolv:host file = $prefix_abs/dns_host_file
637 #We don't want to run 'speed' tests for very long
638 torture:timelimit = 1
645 sub should_run_test($)
651 for (my $i=0; $i <= $#tests; $i++) {
652 if ($name =~ /$tests[$i]/i) {
664 open(IN, $filename) or die("Unable to open $filename: $!");
667 if (/-- TEST(-LOADLIST|-IDLIST|) --\n/) {
668 my $supports_loadlist = (defined($1) and $1 eq "-LOADLIST");
669 my $supports_idlist = (defined($1) and $1 eq "-IDLIST");
676 if (should_run_test($name) == 1) {
677 push (@ret, [$name, $env, $cmdline, $supports_loadlist, $supports_idlist]);
683 close(IN) or die("Error creating recipe");
687 if ($#testlists == -1) {
688 die("No testlists specified");
691 $ENV{SELFTEST_PREFIX} = "$prefix_abs";
692 $ENV{SELFTEST_TMPDIR} = "$tmpdir_abs";
693 $ENV{TEST_DATA_PREFIX} = "$tmpdir_abs";
694 if ($opt_socket_wrapper) {
695 $ENV{SELFTEST_INTERFACES} = $interfaces;
697 $ENV{SELFTEST_INTERFACES} = "";
700 $ENV{SELFTEST_VERBOSE} = "1";
702 $ENV{SELFTEST_VERBOSE} = "";
705 $ENV{SELFTEST_QUICK} = "1";
707 $ENV{SELFTEST_QUICK} = "";
709 $ENV{SELFTEST_MAXTIME} = $torture_maxtime;
712 foreach my $fn (@testlists) {
713 foreach (read_testlist($fn)) {
715 next if (@includes and not defined(find_in_list(\@includes, $name)));
716 push (@available, $_);
720 my $restricted = undef;
721 my $restricted_used = {};
723 if ($opt_load_list) {
725 open(LOAD_LIST, "<$opt_load_list") or die("Unable to open $opt_load_list");
726 while (<LOAD_LIST>) {
728 push (@$restricted, $_);
733 my $individual_tests = undef;
734 $individual_tests = {};
736 foreach my $testsuite (@available) {
737 my $name = $$testsuite[0];
738 my $skipreason = skip($name);
739 if (defined($restricted)) {
740 # Find the testsuite for this test
742 foreach my $r (@$restricted) {
744 $individual_tests->{$name} = [];
746 $restricted_used->{$r} = 1;
747 } elsif (substr($r, 0, length($name)+1) eq "$name.") {
748 push(@{$individual_tests->{$name}}, $r);
750 $restricted_used->{$r} = 1;
754 if (defined($skipreason)) {
755 Subunit::skip_testsuite($name, $skipreason);
757 push(@todo, $testsuite);
760 } elsif (defined($skipreason)) {
761 Subunit::skip_testsuite($name, $skipreason);
763 push(@todo, $testsuite);
767 if (defined($restricted)) {
768 foreach (@$restricted) {
769 unless (defined($restricted_used->{$_})) {
770 print "No test or testsuite found matching $_\n";
773 } elsif ($#todo == -1) {
774 print STDERR "No tests to run\n";
778 my $suitestotal = $#todo + 1;
780 Subunit::progress($suitestotal);
781 Subunit::report_time(time());
786 my %running_envs = ();
788 sub get_running_env($)
796 return $running_envs{$envname};
799 my @exported_envvars = (
804 # domain controller stuff
813 "MEMBER_NETBIOSNAME",
814 "MEMBER_NETBIOSALIAS",
816 # rpc proxy controller stuff
818 "RPC_PROXY_SERVER_IP",
819 "RPC_PROXY_NETBIOSNAME",
820 "RPC_PROXY_NETBIOSALIAS",
822 # domain controller stuff for Vampired DC
824 "VAMPIRE_DC_SERVER_IP",
825 "VAMPIRE_DC_NETBIOSNAME",
826 "VAMPIRE_DC_NETBIOSALIAS",
843 "WINBINDD_SOCKET_DIR",
844 "WINBINDD_PRIV_PIPE_DIR",
849 $SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub {
851 teardown_env($_) foreach(keys %running_envs);
852 die("Received signal $signame");
857 my ($name, $prefix) = @_;
859 my $testenv_vars = undef;
865 $option =~ s/^[^:]*//;
868 $option = "client" if $option eq "";
870 if ($envname eq "none") {
872 } elsif (defined(get_running_env($envname))) {
873 $testenv_vars = get_running_env($envname);
874 if (not $testenv_vars->{target}->check_env($testenv_vars)) {
875 print $testenv_vars->{target}->getlog_env($testenv_vars);
876 $testenv_vars = undef;
879 $testenv_vars = $target->setup_env($envname, $prefix);
880 if (defined($testenv_vars) && not defined($testenv_vars->{target})) {
881 $testenv_vars->{target} = $target;
883 if (not defined($testenv_vars)) {
884 warn("$opt_target can't provide environment '$envname'");
889 return undef unless defined($testenv_vars);
891 $running_envs{$envname} = $testenv_vars;
893 if ($option eq "local") {
894 SocketWrapper::set_default_iface($testenv_vars->{SOCKET_WRAPPER_DEFAULT_IFACE});
895 $ENV{SMB_CONF_PATH} = $testenv_vars->{SERVERCONFFILE};
896 } elsif ($option eq "client") {
897 SocketWrapper::set_default_iface(11);
898 write_clientconf($conffile, $clientdir, $testenv_vars);
899 $ENV{SMB_CONF_PATH} = $conffile;
901 die("Unknown option[$option] for envname[$envname]");
904 foreach (@exported_envvars) {
905 if (defined($testenv_vars->{$_})) {
906 $ENV{$_} = $testenv_vars->{$_};
912 return $testenv_vars;
915 sub exported_envvars_str($)
917 my ($testenv_vars) = @_;
920 foreach (@exported_envvars) {
921 next unless defined($testenv_vars->{$_});
922 $out .= $_."=".$testenv_vars->{$_}."\n";
931 return "" if ($envname eq "none");
932 my $env = get_running_env($envname);
933 return $env->{target}->getlog_env($env);
939 return 1 if ($envname eq "none");
940 my $env = get_running_env($envname);
941 return $env->{target}->check_env($env);
947 return if ($envname eq "none");
948 my $env = get_running_env($envname);
949 $env->{target}->teardown_env($env);
950 delete $running_envs{$envname};
953 # This 'global' file needs to be empty when we start
954 unlink("$prefix_abs/dns_host_file");
957 my $testenv_name = $ENV{SELFTEST_TESTENV};
958 $testenv_name = $testenv_default unless defined($testenv_name);
960 my $testenv_vars = setup_env($testenv_name, $prefix);
962 die("Unable to setup environment $testenv_name") unless ($testenv_vars);
964 $ENV{PIDDIR} = $testenv_vars->{PIDDIR};
965 $ENV{ENVNAME} = $testenv_name;
967 my $envvarstr = exported_envvars_str($testenv_vars);
969 my $term = ($ENV{TERMINAL} or "xterm -e");
970 system("$term 'echo -e \"
971 Welcome to the Samba4 Test environment '$testenv_name'
973 This matches the client environment used in make test
974 server is pid `cat \$PIDDIR/samba.pid`
976 Some useful environment variables:
977 TORTURE_OPTIONS=\$TORTURE_OPTIONS
978 SMB_CONF_PATH=\$SMB_CONF_PATH
981 \" && LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH} bash'");
982 teardown_env($testenv_name);
983 } elsif ($opt_list) {
987 my $envname = $$_[1];
989 unless($cmd =~ /\$LISTOPT/) {
990 warn("Unable to list tests in $name");
994 $cmd =~ s/\$LISTOPT/--list/g;
999 die("Unable to run $cmd: $!");
1000 } elsif ($? & 127) {
1001 die(snprintf("%s died with signal %d, %s coredump\n", $cmd, ($? & 127), ($? & 128) ? 'with' : 'without'));
1004 my $exitcode = $? >> 8;
1005 if ($exitcode != 0) {
1006 die("$cmd exited with exit code $exitcode");
1014 my $envname = $$_[1];
1016 my $envvars = setup_env($envname, $prefix);
1017 if (not defined($envvars)) {
1018 Subunit::start_testsuite($name);
1019 Subunit::end_testsuite($name, "error",
1020 "unable to set up environment $envname - exiting");
1024 # Generate a file with the individual tests to run, if the
1025 # test runner for this test suite supports it.
1026 if ($individual_tests and $individual_tests->{$name}) {
1028 my ($fh, $listid_file) = tempfile(UNLINK => 0);
1029 foreach my $test (@{$individual_tests->{$name}}) {
1030 print $fh substr($test, length($name)+1) . "\n";
1032 $cmd =~ s/\$LOADLIST/--load-list=$listid_file/g;
1034 $cmd =~ s/\s+[^\s]+\s*$//;
1035 $cmd .= " " . join(' ', @{$individual_tests->{$name}});
1039 run_testsuite($envname, $name, $cmd, $i, $suitestotal);
1041 teardown_env($envname) if ($opt_resetup_env);
1047 teardown_env($_) foreach (keys %running_envs);
1051 # if there were any valgrind failures, show them
1052 foreach (<$prefix/valgrind.log*>) {
1053 next unless (-s $_);
1054 print "VALGRIND FAILURE\n";