2007-01-12 05:33:09 +03:00
#!/usr/bin/perl
# Bootstrap Samba and run a number of tests against it.
# Copyright (C) 2005-2007 Jelmer Vernooij <jelmer@samba.org>
# Published under the GNU GPL, v3 or later.
2007-03-06 00:28:55 +03:00
= pod
= head1 NAME
selftest - Samba test runner
= head1 SYNOPSIS
selftest - - help
selftest [ - - srcdir = DIR ] [ - - builddir = DIR ] [ - - target = samba4 | samba3 | win ] [ - - socket - wrapper ] [ - - quick ] [ - - one ] [ - - prefix = prefix ] [ - - immediate ] [ TESTS ]
= head1 DESCRIPTION
A simple test runner . TESTS is a regular expression with tests to run .
= head1 OPTIONS
= over 4
= item I <--help>
Show list of available options .
= item I <--srcdir=DIR>
Source directory .
= item I <--builddir=DIR>
Build directory .
= item I <--prefix=DIR>
Change directory to run tests in . Default is 'st' .
= item I <--immediate>
Show errors as soon as they happen rather than at the end of the test run .
= item I < - - target samba4 | samba3 | win >
Specify test target against which to run . Default is 'samba4' .
= item I <--quick>
Run only a limited number of tests . Intended to run in about 30 seconds on
moderately recent systems .
= item I <--socket-wrapper>
Use socket wrapper library for communication with server . Only works
when the server is running locally .
Will prevent TCP and UDP ports being opened on the local host but
( transparently ) redirects these calls to use unix domain sockets .
= item I <--expected-failures>
Specify a file containing a list of tests that are expected to fail . Failures for
these tests will be counted as successes , successes will be counted as failures .
The format for the file is , one entry per line:
TESTSUITE - NAME / TEST - NAME
2007-03-06 01:24:21 +03:00
= item I <--skip>
Specify a file containing a list of tests that should be skipped . Possible candidates are
tests that segfault the server , flip or don ' t end .
2007-03-06 00:28:55 +03:00
= item I <--one>
Abort as soon as one test fails .
= back
= head1 ENVIRONMENT
= over 4
= item I <SMBD_VALGRIND>
= item I <TORTURE_MAXTIME>
= item I <VALGRIND>
= item I <TLS_ENABLED>
= item I <srcdir>
= back
= head1 LICENSE
selftest is licensed under the GNU General Public License L <http://www.gnu.org/licenses/gpl.html> .
= head1 AUTHOR
Jelmer Vernooij
= cut
2007-01-12 05:33:09 +03:00
use strict ;
use warnings ;
use FindBin qw( $RealBin $Script ) ;
use File::Spec ;
2007-01-13 19:08:58 +03:00
use Getopt::Long ;
2007-01-12 05:33:09 +03:00
use POSIX ;
use Cwd ;
2007-03-06 00:28:55 +03:00
use lib "$RealBin" ;
2007-03-21 18:57:07 +03:00
use Samba3 ;
2007-03-06 00:28:55 +03:00
use Samba4 ;
use SocketWrapper ;
2007-01-12 05:33:09 +03:00
2007-03-06 00:28:55 +03:00
my $ opt_help = 0 ;
my $ opt_target = "samba4" ;
my $ opt_quick = 0 ;
my $ opt_socket_wrapper = 0 ;
my $ opt_socket_wrapper_pcap = undef ;
my $ opt_one = 0 ;
my $ opt_immediate = 0 ;
my $ opt_expected_failures = undef ;
2007-03-06 01:24:21 +03:00
my $ opt_skip = undef ;
2007-03-06 00:28:55 +03:00
my $ opt_verbose = 0 ;
2007-03-07 05:11:40 +03:00
my $ opt_testenv = 0 ;
2007-03-21 18:57:07 +03:00
my $ opt_ldap = undef ;
my $ opt_analyse_cmd = undef ;
2007-01-12 05:33:09 +03:00
2007-03-06 00:28:55 +03:00
my $ srcdir = "." ;
my $ builddir = "." ;
my $ prefix = "st" ;
my $ suitesfailed = [] ;
my $ start = time ( ) ;
my @ expected_failures = ( ) ;
2007-03-06 01:24:21 +03:00
my @ skips = ( ) ;
2007-03-06 00:28:55 +03:00
my $ statistics = {
SUITES_FAIL = > 0 ,
SUITES_OK = > 0 ,
2007-03-06 01:24:21 +03:00
SUITES_SKIPPED = > 0 ,
2007-03-06 00:28:55 +03:00
TESTS_UNEXPECTED_OK = > 0 ,
TESTS_EXPECTED_OK = > 0 ,
TESTS_UNEXPECTED_FAIL = > 0 ,
TESTS_EXPECTED_FAIL = > 0 ,
TESTS_ERROR = > 0
} ;
sub expecting_failure ($)
2007-01-12 05:33:09 +03:00
{
2007-03-06 00:28:55 +03:00
my $ fullname = shift ;
2007-01-12 05:33:09 +03:00
2007-03-06 01:24:21 +03:00
return 1 if ( grep ( /^$fullname$/ , @ expected_failures ) ) ;
2007-01-12 05:33:09 +03:00
2007-03-06 00:28:55 +03:00
return 0 ;
}
2007-03-06 01:24:21 +03:00
sub skip ($)
{
my $ fullname = shift ;
return 1 if ( grep ( /^$fullname$/ , @ skips ) ) ;
return 0 ;
}
2007-03-06 00:28:55 +03:00
sub run_test_buildfarm ($$$$)
{
my ( $ name , $ cmd , $ i , $ suitestotal ) = @ _ ;
print "--==--==--==--==--==--==--==--==--==--==--\n" ;
print "Running test $name (level 0 stdout)\n" ;
print "--==--==--==--==--==--==--==--==--==--==--\n" ;
system ( "date" ) ;
my $ expected_ret = 1 ;
my $ open_tests = { } ;
2007-03-06 02:12:50 +03:00
open ( RESULT , "$cmd 2>&1|" ) ;
2007-03-06 00:28:55 +03:00
while ( <RESULT> ) {
print ;
if ( /^test: (.+)\n/ ) {
$ open_tests - > { $ 1 } = 1 ;
} elsif ( /^(success|failure|skip|error): (.*?)( \[)?\n/ ) {
my $ result = $ 1 ;
if ( $ 1 eq "success" ) {
delete $ open_tests - > { $ 2 } ;
if ( expecting_failure ( "$name/$2" ) ) {
$ statistics - > { TESTS_UNEXPECTED_OK } + + ;
} else {
$ statistics - > { TESTS_EXPECTED_OK } + + ;
}
} elsif ( $ 1 eq "failure" ) {
delete $ open_tests - > { $ 2 } ;
if ( expecting_failure ( "$name/$2" ) ) {
$ statistics - > { TESTS_EXPECTED_FAIL } + + ;
$ expected_ret = 0 ;
} else {
$ statistics - > { TESTS_UNEXPECTED_FAIL } + + ;
}
} elsif ( $ 1 eq "skip" ) {
delete $ open_tests - > { $ 2 } ;
} elsif ( $ 1 eq "error" ) {
$ statistics - > { TESTS_ERROR } + + ;
delete $ open_tests - > { $ 2 } ;
}
2007-01-12 05:33:09 +03:00
}
}
2007-03-06 00:28:55 +03:00
print "COMMAND: $cmd\n" ;
foreach ( keys %$ open_tests ) {
print "$_ was started but never finished!\n" ;
$ statistics - > { TESTS_ERROR } + + ;
}
my $ ret = close ( RESULT ) ;
2007-01-12 05:33:09 +03:00
2007-03-06 00:28:55 +03:00
print "==========================================\n" ;
if ( $ ret == $ expected_ret ) {
print "TEST PASSED: $name\n" ;
} else {
print "TEST FAILED: $name (status $ret)\n" ;
}
print "==========================================\n" ;
2007-01-12 05:33:09 +03:00
}
2007-03-06 00:28:55 +03:00
my $ test_output = { } ;
sub run_test_plain ($$$$)
{
my ( $ name , $ cmd , $ i , $ totalsuites ) = @ _ ;
my $ err = "" ;
if ( $#$ suitesfailed + 1 > 0 ) { $ err = ", " . ( $#$ suitesfailed + 1 ) . " errors" ; }
printf "[$i/$totalsuites in " . ( time ( ) - $ start ) . "s$err] $name\n" ;
open ( RESULT , "$cmd 2>&1|" ) ;
my $ expected_ret = 1 ;
my $ open_tests = { } ;
$ test_output - > { $ name } = "" ;
while ( <RESULT> ) {
$ test_output - > { $ name } . = $ _ ;
print if ( $ opt_verbose ) ;
if ( /^test: (.+)\n/ ) {
$ open_tests - > { $ 1 } = 1 ;
} elsif ( /^(success|failure|skip|error): (.*?)( \[)?\n/ ) {
my $ result = $ 1 ;
if ( $ 1 eq "success" ) {
delete $ open_tests - > { $ 2 } ;
if ( expecting_failure ( "$name/$2" ) ) {
$ statistics - > { TESTS_UNEXPECTED_OK } + + ;
} else {
$ statistics - > { TESTS_EXPECTED_OK } + + ;
}
} elsif ( $ 1 eq "failure" ) {
delete $ open_tests - > { $ 2 } ;
if ( expecting_failure ( "$name/$2" ) ) {
$ statistics - > { TESTS_EXPECTED_FAIL } + + ;
$ expected_ret = 0 ;
} else {
$ statistics - > { TESTS_UNEXPECTED_FAIL } + + ;
}
} elsif ( $ 1 eq "skip" ) {
delete $ open_tests - > { $ 2 } ;
} elsif ( $ 1 eq "error" ) {
$ statistics - > { TESTS_ERROR } + + ;
delete $ open_tests - > { $ 2 } ;
}
}
}
$ test_output - > { $ name } . = "COMMAND: $cmd\n" ;
foreach ( keys %$ open_tests ) {
$ test_output - > { $ name } . = "$_ was started but never finished!\n" ;
$ statistics - > { TESTS_ERROR } + + ;
}
my $ ret = close ( RESULT ) ;
if ( $ ret != $ expected_ret and ( $ opt_immediate or $ opt_one ) and not $ opt_verbose ) {
print "$test_output->{$name}\n" ;
}
if ( $ ret != $ expected_ret ) {
push ( @$ suitesfailed , $ name ) ;
$ statistics - > { SUITES_FAIL } + + ;
exit ( 1 ) if ( $ opt_one ) ;
} else {
$ statistics - > { SUITES_OK } + + ;
2007-01-12 05:33:09 +03:00
}
}
2007-01-13 19:08:58 +03:00
sub ShowHelp ()
{
print " Samba test runner
Copyright ( C ) Jelmer Vernooij <jelmer\@samba.org>
2007-03-06 00:28:55 +03:00
Usage: $ Script [ OPTIONS ] PREFIX
2007-01-13 19:08:58 +03:00
Generic options:
2007-01-13 23:02:10 +03:00
- - help this help page
2007-03-06 00:28:55 +03:00
Paths:
- - prefix = DIR prefix to run tests in [ st ]
- - srcdir = DIR source directory [ . ]
- - builddir = DIR output directory [ . ]
Target Specific:
2007-01-13 23:02:10 +03:00
- - target = samba4 | samba3 | win Samba version to target
2007-03-06 00:28:55 +03:00
- - socket - wrapper - pcap = FILE save traffic to pcap file
2007-01-13 23:02:10 +03:00
- - socket - wrapper enable socket wrapper
2007-03-06 00:28:55 +03:00
- - expected - failures = FILE specify list of tests that is guaranteed to fail
2007-03-21 18:57:07 +03:00
- - ldap run against ldap
2007-03-06 00:28:55 +03:00
Behaviour:
2007-01-13 23:02:10 +03:00
- - quick run quick overall test
2007-01-14 07:32:11 +03:00
- - one abort when the first test fails
2007-03-06 00:28:55 +03:00
- - immediate print test output for failed tests during run
- - verbose be verbose
2007-03-21 19:26:25 +03:00
- - analyse - cmd CMD command to run after each test
2007-01-13 19:08:58 +03:00
" ;
exit ( 0 ) ;
}
my $ result = GetOptions (
'help|h|?' = > \ $ opt_help ,
2007-03-06 00:28:55 +03:00
'target=s' = > \ $ opt_target ,
'prefix=s' = > \ $ prefix ,
2007-01-13 23:02:10 +03:00
'socket-wrapper' = > \ $ opt_socket_wrapper ,
2007-03-06 00:28:55 +03:00
'socket-wrapper-pcap=s' = > \ $ opt_socket_wrapper_pcap ,
2007-01-14 07:32:11 +03:00
'quick' = > \ $ opt_quick ,
2007-03-06 00:28:55 +03:00
'one' = > \ $ opt_one ,
'immediate' = > \ $ opt_immediate ,
'expected-failures=s' = > \ $ opt_expected_failures ,
2007-03-06 01:24:21 +03:00
'skip=s' = > \ $ opt_skip ,
2007-03-06 00:28:55 +03:00
'srcdir=s' = > \ $ srcdir ,
'builddir=s' = > \ $ builddir ,
2007-03-07 05:11:40 +03:00
'verbose' = > \ $ opt_verbose ,
2007-03-21 18:57:07 +03:00
'testenv' = > \ $ opt_testenv ,
'ldap' = > \ $ opt_ldap ,
'analyse-cmd=s' = > \ $ opt_analyse_cmd ,
2007-01-13 19:08:58 +03:00
) ;
2007-03-06 00:28:55 +03:00
exit ( 1 ) if ( not $ result ) ;
2007-01-13 19:08:58 +03:00
ShowHelp ( ) if ( $ opt_help ) ;
2007-01-12 05:33:09 +03:00
2007-03-06 00:28:55 +03:00
my $ tests = shift ;
2007-01-12 05:33:09 +03:00
2007-03-06 00:28:55 +03:00
# quick hack to disable rpc validation when using valgrind - its way too slow
unless ( defined ( $ ENV { VALGRIND } ) ) {
$ ENV { VALIDATE } = "validate" ;
2007-03-21 19:26:25 +03:00
$ ENV { MALLOC_CHECK_ } = 2 ;
2007-01-12 05:33:09 +03:00
}
my $ old_pwd = "$RealBin/../.." ;
2007-03-21 18:57:07 +03:00
my $ ldap = 0 ;
if ( defined ( $ ENV { TEST_LDAP } ) ) {
$ ldap = ( $ ENV { TEST_LDAP } eq "yes" ) ;
}
if ( defined ( $ opt_ldap ) ) {
$ ldap = $ opt_ldap ;
}
my $ torture_maxtime = ( $ ENV { TORTURE_MAXTIME } or 1200 ) ;
if ( $ ldap ) {
# LDAP is slow
$ torture_maxtime *= 2 ;
}
2007-01-12 05:33:09 +03:00
$ prefix =~ s + // + / + ;
$ ENV { PREFIX } = $ prefix ;
$ ENV { SRCDIR } = $ srcdir ;
my $ testsdir = "$srcdir/script/tests" ;
2007-01-13 23:02:10 +03:00
my $ tls_enabled = not $ opt_quick ;
2007-03-06 00:28:55 +03:00
my $ from_build_farm = ( defined ( $ ENV { RUN_FROM_BUILD_FARM } ) and
( $ ENV { RUN_FROM_BUILD_FARM } eq "yes" ) ) ;
2007-01-12 05:33:09 +03:00
$ ENV { TLS_ENABLED } = ( $ tls_enabled ? "yes" : "no" ) ;
$ ENV { LD_LDB_MODULE_PATH } = "$old_pwd/bin/modules/ldb" ;
$ ENV { LD_SAMBA_MODULE_PATH } = "$old_pwd/bin/modules" ;
if ( defined ( $ ENV { LD_LIBRARY_PATH } ) ) {
$ ENV { LD_LIBRARY_PATH } = "$old_pwd/bin/shared:$ENV{LD_LIBRARY_PATH}" ;
} else {
$ ENV { LD_LIBRARY_PATH } = "$old_pwd/bin/shared" ;
}
$ ENV { PKG_CONFIG_PATH } = "$old_pwd/bin/pkgconfig:$ENV{PKG_CONFIG_PATH}" ;
$ ENV { PATH } = "$old_pwd/bin:$ENV{PATH}" ;
2007-03-06 00:28:55 +03:00
my @ torture_options = ( ) ;
if ( $ opt_socket_wrapper_pcap ) {
$ ENV { SOCKET_WRAPPER_PCAP_FILE } = $ opt_socket_wrapper_pcap ;
# Socket wrapper pcap implies socket wrapper
$ opt_socket_wrapper = 1 ;
}
2007-01-12 05:33:09 +03:00
2007-03-06 00:28:55 +03:00
my $ socket_wrapper_dir ;
if ( $ opt_socket_wrapper )
2007-01-12 05:33:09 +03:00
{
2007-03-06 00:28:55 +03:00
$ socket_wrapper_dir = SocketWrapper:: setup_dir ( "$prefix/w" ) ;
print "SOCKET_WRAPPER_DIR=$socket_wrapper_dir\n" ;
2007-01-12 05:33:09 +03:00
}
2007-03-21 18:57:07 +03:00
my $ target ;
2007-03-06 00:28:55 +03:00
2007-03-21 18:57:07 +03:00
if ( $ opt_target eq "samba4" ) {
$ target = new Samba4 ( "$srcdir/bin" , $ ldap , "$srcdir/setup" ) ;
} elsif ( $ opt_target eq "samba3" ) {
$ target = new Samba3 ( "$srcdir/bin" , "$srcdir/setup" ) ;
} elsif ( $ opt_target eq "win" ) {
die ( "Windows tests will not run with socket wrapper enabled." )
if ( $ opt_socket_wrapper ) ;
$ target = new Windows ( ) ;
2007-01-12 05:33:09 +03:00
}
2007-03-06 00:28:55 +03:00
if ( defined ( $ opt_expected_failures ) ) {
open ( KNOWN , "<$opt_expected_failures" ) or die ( "unable to read known failures file: $!" ) ;
while ( <KNOWN> ) {
chomp ;
s/([ \t]+)\#(.*)$// ;
push ( @ expected_failures , $ _ ) ; }
close ( KNOWN ) ;
}
2007-03-06 01:24:21 +03:00
if ( defined ( $ opt_skip ) ) {
open ( SKIP , "<$opt_skip" ) or die ( "unable to read skip file: $!" ) ;
while ( <SKIP> ) {
chomp ;
s/([ \t]+)\#(.*)$// ;
push ( @ skips , $ _ ) ; }
close ( SKIP ) ;
}
2007-03-21 18:57:07 +03:00
my $ testenv_vars ;
$ testenv_vars = $ target - > provision ( "dc" , "$prefix/dc" ) ;
2007-01-12 05:33:09 +03:00
2007-03-21 18:57:07 +03:00
foreach ( keys %$ testenv_vars ) { $ ENV { $ _ } = $ testenv_vars - > { $ _ } ; }
2007-01-12 05:33:09 +03:00
2007-03-06 00:28:55 +03:00
SocketWrapper:: set_default_iface ( 1 ) ;
2007-03-21 18:57:07 +03:00
$ target - > check_or_start ( $ testenv_vars , $ socket_wrapper_dir ,
( $ ENV { SMBD_MAX_TIME } or 5400 ) ) ;
2007-03-06 00:28:55 +03:00
SocketWrapper:: set_default_iface ( 6 ) ;
2007-01-12 05:33:09 +03:00
2007-03-06 00:28:55 +03:00
my $ interfaces = join ( ',' , ( "127.0.0.6/8" ,
"127.0.0.7/8" ,
"127.0.0.8/8" ,
"127.0.0.9/8" ,
"127.0.0.10/8" ,
"127.0.0.11/8" ) ) ;
2007-01-12 05:33:09 +03:00
2007-03-06 00:28:55 +03:00
push ( @ torture_options , "--option=interfaces=$interfaces" ) ;
2007-03-21 18:57:07 +03:00
push ( @ torture_options , $ testenv_vars - > { CONFIGURATION } ) ;
2007-01-12 05:33:09 +03:00
# ensure any one smbtorture call doesn't run too long
push ( @ torture_options , "--maximum-runtime=$torture_maxtime" ) ;
2007-01-13 19:08:58 +03:00
push ( @ torture_options , "--target=$opt_target" ) ;
2007-03-06 00:28:55 +03:00
push ( @ torture_options , "--option=torture:progress=no" ) if ( $ from_build_farm ) ;
push ( @ torture_options , "--format=subunit" ) ;
push ( @ torture_options , "--option=torture:quick=yes" ) if ( $ opt_quick ) ;
2007-01-12 05:33:09 +03:00
$ ENV { TORTURE_OPTIONS } = join ( ' ' , @ torture_options ) ;
print "OPTIONS $ENV{TORTURE_OPTIONS}\n" ;
2007-01-14 07:32:11 +03:00
my @ todo = ( ) ;
2007-01-12 05:33:09 +03:00
2007-03-21 18:57:07 +03:00
if ( $ opt_quick ) {
open ( IN , "$testsdir/tests_quick.sh|" ) ;
} else {
open ( IN , "$testsdir/tests_all.sh|" ) ;
}
while ( <IN> ) {
if ( $ _ eq "-- TEST --\n" ) {
my $ name = <IN> ;
$ name =~ s/\n//g ;
my $ env = <IN> ;
$ env =~ s/\n//g ;
my $ cmdline = <IN> ;
$ cmdline =~ s/\n//g ;
push ( @ todo , [ $ name , $ env , $ cmdline ] )
if ( not defined ( $ tests ) or $ name =~ /$tests/ ) ;
2007-01-14 07:32:11 +03:00
} else {
2007-03-21 18:57:07 +03:00
print ;
2007-01-14 07:32:11 +03:00
}
}
2007-03-21 18:57:07 +03:00
close ( IN ) or die ( "Error creating recipe" ) ;
2007-01-14 07:32:11 +03:00
2007-03-21 18:57:07 +03:00
$ target - > wait_for_start ( ) ;
2007-03-06 00:28:55 +03:00
# start off with 0 failures
$ ENV { failed } = 0 ;
my $ suitestotal = $# todo + 1 ;
2007-01-14 07:32:11 +03:00
my $ i = 0 ;
$| = 1 ;
2007-03-21 18:57:07 +03:00
# The Kerberos tests fail if this variable is set.
2007-03-06 00:28:55 +03:00
delete $ ENV { DOMAIN } ;
2007-03-07 05:11:40 +03:00
if ( $ opt_testenv ) {
2007-03-21 18:57:07 +03:00
my $ term = ( $ ENV { TERM } or "xterm" ) ;
2007-03-07 05:11:40 +03:00
system ( " $ term - e ' echo - e \ " Welcome to the Samba4 Test environment
This matches the client environment used in make test
smbd is pid `cat \$PIDDIR/smbd.pid`
Some useful environment variables:
AUTH = \ $ AUTH
TORTURE_OPTIONS = \ $ TORTURE_OPTIONS
CONFIGURATION = \ $ CONFIGURATION
SERVER = \ $ SERVER
NETBIOSNAME = \ $ NETBIOSNAME \ " && bash'" ) ;
} else {
foreach ( @ todo ) {
$ i + + ;
2007-03-21 18:57:07 +03:00
my $ cmd = $$ _ [ 2 ] ;
2007-03-07 05:11:40 +03:00
$ cmd =~ s/([\(\)])/\\$1/g ;
my $ name = $$ _ [ 0 ] ;
2007-03-21 18:57:07 +03:00
my $ envname = $$ _ [ 1 ] ;
2007-03-07 05:11:40 +03:00
if ( skip ( $ name ) ) {
print "SKIPPED: $name\n" ;
$ statistics - > { SUITES_SKIPPED } + + ;
next ;
}
2007-03-06 01:24:21 +03:00
2007-03-21 18:57:07 +03:00
$ target - > setup_env ( $ envname ) ;
2007-03-07 05:11:40 +03:00
if ( $ from_build_farm ) {
run_test_buildfarm ( $ name , $ cmd , $ i , $ suitestotal ) ;
} else {
run_test_plain ( $ name , $ cmd , $ i , $ suitestotal ) ;
}
2007-03-21 18:57:07 +03:00
if ( defined ( $ opt_analyse_cmd ) ) {
system ( "$opt_analyse_cmd \"$name\"" ) ;
}
2007-01-14 07:32:11 +03:00
}
2007-01-13 23:02:10 +03:00
}
2007-01-12 05:33:09 +03:00
2007-01-14 07:32:11 +03:00
print "\n" ;
2007-03-21 18:57:07 +03:00
my $ failed = $ target - > stop ( ) ;
2007-01-12 05:33:09 +03:00
2007-03-06 00:28:55 +03:00
my $ end = time ( ) ;
my $ duration = ( $ end - $ start ) ;
my $ numfailed = $#$ suitesfailed + 1 ;
if ( $ numfailed == 0 ) {
my $ ok = $ statistics - > { TESTS_EXPECTED_OK } + $ statistics - > { TESTS_EXPECTED_FAIL } ;
print "ALL OK ($ok tests in $statistics->{SUITES_OK} testsuites)\n" ;
} else {
unless ( $ from_build_farm ) {
if ( not $ opt_immediate and not $ opt_verbose ) {
foreach ( @$ suitesfailed ) {
print "===============================================================================\n" ;
print "FAIL: $_\n" ;
print $ test_output - > { $ _ } ;
print "\n" ;
}
}
print "FAILED ($statistics->{TESTS_UNEXPECTED_FAIL} failures and $statistics->{TESTS_ERROR} errors in $statistics->{SUITES_FAIL} testsuites)\n" ;
} else {
print << EOF
** ** ** ** ** ** ** ** ** ** ** **
** * TESTSUITE FAILED ** *
** ** ** ** ** ** ** ** ** ** ** **
EOF
;
}
}
print "DURATION: $duration seconds\n" ;
2007-01-12 05:33:09 +03:00
# if there were any valgrind failures, show them
foreach ( <$prefix/valgrind.log*> ) {
next unless ( - s $ _ ) ;
system ( "grep DWARF2.CFI.reader $_ > /dev/null" ) ;
if ( $? >> 8 == 0 ) {
print "VALGRIND FAILURE\n" ;
$ failed + + ;
system ( "cat $_" ) ;
}
}
2007-03-06 03:45:30 +03:00
if ( $ from_build_farm ) {
print "TEST STATUS: $numfailed\n" ;
}
2007-03-06 00:28:55 +03:00
exit $ numfailed ;