selftest: Fix testsuite counts when running only a limited number of
authorJelmer Vernooij <jelmer@samba.org>
Thu, 23 Sep 2010 02:28:02 +0000 (19:28 -0700)
committerJelmer Vernooij <jelmer@samba.org>
Thu, 23 Sep 2010 05:29:09 +0000 (22:29 -0700)
testsuites.

selftest/selftest.pl

index 6c0aab9d6b66ba71def0d95f909d4718fa72abf5..4ed168cc372e0b5e08c2823d9ec5941c4c78f583 100755 (executable)
@@ -686,18 +686,13 @@ if ($opt_load_list) {
        close(LOAD_LIST);
 }
 
-Subunit::progress($#available+1);
-Subunit::report_time(time());
-
 my $individual_tests = undef;
 $individual_tests = {};
 
 foreach my $testsuite (@available) {
        my $name = $$testsuite[0];
        my $skipreason = skip($name);
-       if (defined($skipreason)) {
-               Subunit::skip_testsuite($name, $skipreason);
-       } elsif (defined($restricted)) {
+       if (defined($restricted)) {
                # Find the testsuite for this test
                my $match = undef;
                foreach my $r (@$restricted) {
@@ -711,9 +706,17 @@ foreach my $testsuite (@available) {
                                $restricted_used->{$r} = 1;
                        }
                }
-               push(@todo, $testsuite) if ($match);
+               if ($match) {
+                       if (defined($skipreason)) {
+                                       Subunit::skip_testsuite($name, $skipreason);
+                       } else {
+                               push(@todo, $testsuite);
+                       }
+               }
+       } elsif (defined($skipreason)) {
+               Subunit::skip_testsuite($name, $skipreason);
        } else {
-               push(@todo, $testsuite); 
+               push(@todo, $testsuite);
        }
 }
 
@@ -729,6 +732,10 @@ if (defined($restricted)) {
 }
 
 my $suitestotal = $#todo + 1;
+
+Subunit::progress($suitestotal);
+Subunit::report_time(time());
+
 my $i = 0;
 $| = 1;