r24878: Support specifying a reason for skips/expected failures
authorJelmer Vernooij <jelmer@samba.org>
Sun, 2 Sep 2007 00:24:38 +0000 (00:24 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:03:26 +0000 (15:03 -0500)
(This used to be commit 84c94b37fed837c7a45f59746de80d20063d93e8)

source4/samba4-skip
source4/selftest/output/buildfarm.pm
source4/selftest/output/html.pm
source4/selftest/output/plain.pm
source4/selftest/selftest.pl

index d9159a4199f56066736b0b6dcf6c79078c1980fc..9d9a6a675f027933865973545e9e5eab078776ae 100644 (file)
@@ -7,7 +7,7 @@ BASE-IOMETER
 BASE-SAMBA3ERROR
 BASE-CASETABLE
 BASE-NTTRANS
-BASE-BENCH-HOLDCON
+.*BASE-BENCH-HOLDCON.*                         # Very slow
 BASE-SCAN-MAXFID
 RAW-BENCH-OPLOCK
 RAW-HOLD-OPLOCK
@@ -24,7 +24,6 @@ ntvfs/cifs BASE-DELAYWRITE
 ntvfs/cifs BASE-IOMETER
 ntvfs/cifs BASE-CASETABLE
 ntvfs/cifs BASE-NTTRANS
-ntvfs/cifs BASE-BENCH-HOLDCON
 ntvfs/cifs BASE-SCAN-MAXFID
 ntvfs/cifs BASE-UTABLE
 ntvfs/cifs BASE-SMB
@@ -38,5 +37,5 @@ ntvfs/cifs RAW-QFILEINFO-IPC
 RPC-DSSYNC
 RPC-SAMSYNC
 LDAP-UPTODATEVECTOR
-RPC-SCANNER
-.*SAMBA3.*
+RPC-SCANNER                                                    # Very slow
+.*SAMBA3.*                                                     # Samba3-specific test
index d35fe9f25047dd4109c43d2bed1c214762f40cca..97c2ec0c4098cfe7e05c544a61c141eb9c4fb3a0 100644 (file)
@@ -99,11 +99,15 @@ sub missing_env($$$)
        print "FAIL: $name (ENV[$envname] not available!)\n";
 }
 
-sub skip_testsuite($$$)
+sub skip_testsuite($$$$)
 {
-       my ($self, $envname, $name) = @_;
+       my ($self, $envname, $name, $reason) = @_;
 
-       print "SKIPPED: $name\n";
+       if ($reason) {
+               print "SKIPPED: $name [$reason]\n";
+       } else {
+               print "SKIPPED: $name\n";
+       }
 }
 
 1;
index 44846dc9dd7b76bb3e5ca34490bfeb7f8ace55a5..2a2a12b63d803055e1e0dc0dda7d2914f4934587 100644 (file)
@@ -315,14 +315,18 @@ sub missing_env($$$)
        print INDEX "</tr>\n";
 }
 
-sub skip_testsuite($$$)
+sub skip_testsuite($$$$)
 {
-       my ($self, $envname, $name) = @_;
+       my ($self, $envname, $name, $reason) = @_;
 
        print INDEX "<tr>\n";
        print INDEX "  <td class=\"testSuite\">$name</td>\n";
        print INDEX "  <td class=\"environment\">$envname</td>\n";
-       print INDEX "  <td class=\"resultSkipped\">SKIPPED</td>\n";
+       if ($reason) {
+               print INDEX "  <td class=\"resultSkipped\">SKIPPED - $reason</td>\n";
+       } else {
+               print INDEX "  <td class=\"resultSkipped\">SKIPPED</td>\n";
+       }
        print INDEX "</tr>\n";
 }
 
index 736a138b079decd2c862ed4ea992086de8ef2c4f..bbf0f8f41423c472681cf29844dc878f73ec3515 100644 (file)
@@ -113,9 +113,13 @@ sub missing_env($$$)
 
 sub skip_testsuite($$$)
 {
-       my ($self, $envname, $name) = @_;
+       my ($self, $envname, $name, $reason) = @_;
 
-       print "SKIPPED: $name\n";
+       if ($reason) {
+               print "SKIPPED: $name [$reason]\n";
+       } else {
+               print "SKIPPED: $name\n";
+       }
 }
 
 1;
index c407fbd32901970d7f64787cb4713ce5f62328c3..39755e692df203bfaf8180b0a6b994a45f8ab600 100755 (executable)
@@ -161,26 +161,30 @@ my $statistics = {
        TESTS_SKIP => 0,
 };
 
-sub expecting_failure($)
+sub find_in_list($$)
 {
-       my $fullname = shift;
+       my ($list, $fullname) = @_;
 
-       foreach (@expected_failures) {
-               return 1 if ($fullname =~ /$_/);
+       foreach (@$list) {
+               if ($fullname =~ /$$_[0]/) {
+                        return ($$_[1]) if ($$_[1]);
+                        return "NO REASON SPECIFIED";
+               }
        }
 
-       return 0;
+       return undef;
 }
 
-sub skip($)
+sub expecting_failure($)
 {
-       my $fullname = shift;
-
-       foreach (@skips) {
-               return 1 if ($fullname =~ /$_/);
-       }
+       my ($name) = @_;
+       return find_in_list(\@expected_failures, $name);
+}
 
-       return 0;
+sub skip($)
+{
+       my ($name) = @_;
+       return find_in_list(\@skips, $name);
 }
 
 sub getlog_env($);
@@ -420,22 +424,30 @@ if ($opt_target eq "samba4") {
        $target = new Windows();
 }
 
-if (defined($opt_expected_failures)) {
-       open(KNOWN, "<$opt_expected_failures") or die("unable to read known failures file: $!");
-       while (<KNOWN>) { 
+sub read_test_regexes($)
+{
+       my ($name) = @_;
+       my @ret = ();
+       open(LF, "<$name") or die("unable to read $name: $!");
+       while (<LF>) { 
                chomp; 
-               s/([ \t]+)\#(.*)$//;
-               push (@expected_failures, $_); }
-       close(KNOWN);
+               if (/^(.*?)([ \t]+)\#(.*)$/) {
+                       push (@ret, [$1, $3]);
+               } else {
+                       s/^(.*?)([ \t]+)\#(.*)$//;
+                       push (@ret, [$_, undef]); 
+               }
+       }
+       close(LF);
+       return @ret;
+}
+
+if (defined($opt_expected_failures)) {
+       @expected_failures = read_test_regexes($opt_expected_failures);
 }
 
 if (defined($opt_skip)) {
-       open(SKIP, "<$opt_skip") or die("unable to read skip file: $!");
-       while (<SKIP>) { 
-               chomp; 
-               s/([ \t]+)\#(.*)$//;
-               push (@skips, $_); }
-       close(SKIP);
+       @skips = read_test_regexes($opt_skip);
 }
 
 my $interfaces = join(',', ("127.0.0.6/8", 
@@ -697,16 +709,16 @@ $envvarstr
                my $name = $$_[0];
                my $envname = $$_[1];
                
-               if (skip($name)) {
-                       $msg_ops->skip_testsuite($envname, $name);
+               my $skipreason = skip($name);
+               if ($skipreason) {
+                       $msg_ops->skip_testsuite($envname, $name, $skipreason);
                        $statistics->{SUITES_SKIPPED}++;
                        next;
                }
 
                my $envvars = setup_env($envname);
                if (not defined($envvars)) {
-                       $statistics->{SUITES_FAIL}++;
-                       $statistics->{TESTS_ERROR}++;
+                       $statistics->{SUITES_SKIPPED}++;
                        $msg_ops->missing_env($name, $envname);
                        next;
                }