perl-test-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ph...@apache.org
Subject svn commit: r1062529 - in /perl/Apache-Test/trunk: Changes lib/Apache/TestHarness.pm lib/Apache/TestMM.pm lib/Apache/TestRun.pm lib/Apache/TestRunPHP.pm lib/Apache/TestSmoke.pm lib/Apache/TestSort.pm
Date Sun, 23 Jan 2011 20:56:53 GMT
Author: phred
Date: Sun Jan 23 20:56:52 2011
New Revision: 1062529

URL: http://svn.apache.org/viewvc?rev=1062529&view=rev
Log:
Deprecate t/TEST -times=X in favor of t/SMOKE -times=X.  Changes to
TAP::Harness have removed the ability to re-use test object attributes.

Also generate t/SMOKE on build now, instead of requiring the user to build it.

Remove iteration variable for SMOKE, using only -times as the controller.

Thanks to Jim Jagielski for the spot on the -times=X issue on t/TEST.


Modified:
    perl/Apache-Test/trunk/Changes
    perl/Apache-Test/trunk/lib/Apache/TestHarness.pm
    perl/Apache-Test/trunk/lib/Apache/TestMM.pm
    perl/Apache-Test/trunk/lib/Apache/TestRun.pm
    perl/Apache-Test/trunk/lib/Apache/TestRunPHP.pm
    perl/Apache-Test/trunk/lib/Apache/TestSmoke.pm
    perl/Apache-Test/trunk/lib/Apache/TestSort.pm

Modified: perl/Apache-Test/trunk/Changes
URL: http://svn.apache.org/viewvc/perl/Apache-Test/trunk/Changes?rev=1062529&r1=1062528&r2=1062529&view=diff
==============================================================================
--- perl/Apache-Test/trunk/Changes (original)
+++ perl/Apache-Test/trunk/Changes Sun Jan 23 20:56:52 2011
@@ -8,6 +8,12 @@ Changes - Apache::Test change logfile
 
 =item 1.36-dev
 
+Deprecate t/TEST -times=X in favor of t/SMOKE -times=X.  Changes to
+TAP::Harness have removed the ability to re-use test object attributes.
+Also generate t/SMOKE on build now, instead of requiring the user to build it.
+Thanks to Jim Jagielski for the spot on the -times=X issue on t/TEST.
+[Fred Moyer]
+
 more or less cosmetical, this patch prevents repeating "adding source lib"
 info lines in the output while testing Apache::Test, SizeLimit and similar
 [Torsten Foertsch]

Modified: perl/Apache-Test/trunk/lib/Apache/TestHarness.pm
URL: http://svn.apache.org/viewvc/perl/Apache-Test/trunk/lib/Apache/TestHarness.pm?rev=1062529&r1=1062528&r2=1062529&view=diff
==============================================================================
--- perl/Apache-Test/trunk/lib/Apache/TestHarness.pm (original)
+++ perl/Apache-Test/trunk/lib/Apache/TestHarness.pm Sun Jan 23 20:56:52 2011
@@ -114,7 +114,7 @@ sub prune {
         next if $test =~ /\.#/; # skip temp emacs files
         my $dir = dirname $test;
         if ($test =~ m:\Wall\.t$:) {
-            unless ($self->run_t($test)) {
+            unless (__PACKAGE__->run_t($test)) {
                 $skip_dirs{$dir} = 1;
                 @new_tests = grep { m:\Wall\.t$: ||
                                     not $skip_dirs{dirname $_} } @new_tests;

Modified: perl/Apache-Test/trunk/lib/Apache/TestMM.pm
URL: http://svn.apache.org/viewvc/perl/Apache-Test/trunk/lib/Apache/TestMM.pm?rev=1062529&r1=1062528&r2=1062529&view=diff
==============================================================================
--- perl/Apache-Test/trunk/lib/Apache/TestMM.pm (original)
+++ perl/Apache-Test/trunk/lib/Apache/TestMM.pm Sun Jan 23 20:56:52 2011
@@ -21,6 +21,7 @@ use warnings FATAL => 'all';
 use Config;
 use Apache::TestConfig ();
 use Apache::TestTrace;
+use Apache::TestSmoke;
 
 sub import {
     my $class = shift;
@@ -139,6 +140,7 @@ sub generate_script {
 
     info "generating script $file";
     Apache::Test::basic_config()->write_perlscript($file, $body);
+    Apache::TestSmoke->generate_script;
 }
 
 sub filter_args {

Modified: perl/Apache-Test/trunk/lib/Apache/TestRun.pm
URL: http://svn.apache.org/viewvc/perl/Apache-Test/trunk/lib/Apache/TestRun.pm?rev=1062529&r1=1062528&r2=1062529&view=diff
==============================================================================
--- perl/Apache-Test/trunk/lib/Apache/TestRun.pm (original)
+++ perl/Apache-Test/trunk/lib/Apache/TestRun.pm Sun Jan 23 20:56:52 2011
@@ -54,7 +54,6 @@ my @flag_opts    = (@std_run, @others);
 my @string_opts  = qw(order trace);
 my @ostring_opts = qw(proxy ping);
 my @debug_opts   = qw(debug);
-my @num_opts     = qw(times);
 my @list_opts    = qw(preamble postamble breakpoint);
 my @hash_opts    = qw(header);
 my @help_opts    = qw(clean help);
@@ -66,9 +65,8 @@ my @exit_opts_need_httpd    = (@debug_op
 my %usage = (
    'start-httpd'     => 'start the test server',
    'run-tests'       => 'run the tests',
-   'times=N'         => 'repeat the tests N times',
    'order=mode'      => 'run the tests in one of the modes: ' .
-                        '(repeat|rotate|random|SEED)',
+                        '(repeat|random|SEED)',
    'stop-httpd'      => 'stop the test server',
    'no-httpd'        => 'run the tests without configuring or starting httpd',
    'verbose[=1]'     => 'verbose output',
@@ -221,7 +219,6 @@ sub getopts {
     GetOptions(\%opts, @flag_opts, @help_opts,
                (map "$_:s", @debug_opts, @request_opts, @ostring_opts),
                (map "$_=s", @string_opts),
-               (map "$_=i", @num_opts),
                (map { ("$_=s", $vopts{$_} ||= []) } @list_opts),
                (map { ("$_=s", $vopts{$_} ||= {}) } @hash_opts));
 
@@ -577,7 +574,6 @@ sub run_tests {
     my $test_opts = {
         verbose => $self->{opts}->{verbose},
         tests   => $self->{tests},
-        times   => $self->{opts}->{times},
         order   => $self->{opts}->{order},
         subtests => $self->{subtests} || [],
     };

Modified: perl/Apache-Test/trunk/lib/Apache/TestRunPHP.pm
URL: http://svn.apache.org/viewvc/perl/Apache-Test/trunk/lib/Apache/TestRunPHP.pm?rev=1062529&r1=1062528&r2=1062529&view=diff
==============================================================================
--- perl/Apache-Test/trunk/lib/Apache/TestRunPHP.pm (original)
+++ perl/Apache-Test/trunk/lib/Apache/TestRunPHP.pm Sun Jan 23 20:56:52 2011
@@ -86,7 +86,6 @@ sub run_tests {
     my $test_opts = {
         verbose => $self->{opts}->{verbose},
         tests   => $self->{tests},
-        times   => $self->{opts}->{times},
         order   => $self->{opts}->{order},
         subtests => $self->{subtests} || [],
     };

Modified: perl/Apache-Test/trunk/lib/Apache/TestSmoke.pm
URL: http://svn.apache.org/viewvc/perl/Apache-Test/trunk/lib/Apache/TestSmoke.pm?rev=1062529&r1=1062528&r2=1062529&view=diff
==============================================================================
--- perl/Apache-Test/trunk/lib/Apache/TestSmoke.pm (original)
+++ perl/Apache-Test/trunk/lib/Apache/TestSmoke.pm Sun Jan 23 20:56:52 2011
@@ -24,6 +24,7 @@ use Apache::TestTrace;
 
 use Apache::TestHarness ();
 use Apache::TestRun (); # for core scan functions
+use Apache::TestSort;
 
 use Getopt::Long qw(GetOptions);
 use File::Spec::Functions qw(catfile);
@@ -36,25 +37,20 @@ use Symbol ();
 # how many times to run all tests at the first iteration
 use constant DEFAULT_TIMES  => 10;
 
-# how many various seeds to try in NONSTOP mode
-use constant DEFAULT_ITERATIONS  => 10;
-
 # if after this number of tries to reduce the number of tests fails we
 # give up on more tries
 use constant MAX_REDUCTION_TRIES => 50;
 
-my @num_opts  = qw(times iterations);
+my @num_opts  = qw(times);
 my @string_opts  = qw(order report);
 my @flag_opts = qw(help verbose bug_mode);
 
-my %order = map {$_ => 1} qw(random repeat rotate);
+my %order = map {$_ => 1} qw(random repeat);
 
 my %usage = (
-   'iterations=N'    => 'number of random iterations to run' .
-                        ' (default: ' . DEFAULT_ITERATIONS . ')',
-   'times=N'         => 'try to repeat all tests at most N times' .
+   'times=N'         => 'how many times to run the entire test suite' .
                         ' (default: ' . DEFAULT_TIMES . ')',
-   'order=MODE'      => 'modes: random, repeat, rotate' .
+   'order=MODE'      => 'modes: random, repeat' .
                         ' (default: random)',
    'report=FILENAME' => 'save report in a filename' .
                         ' (default: smoke-report-<date>.txt)',
@@ -84,18 +80,11 @@ sub new {
     my $opts = $self->{opts};
 
     chdir "$FindBin::Bin/..";
-
-    $self->{times}   = $opts->{times}   || DEFAULT_TIMES;
+    $self->{times} = $opts->{times} || DEFAULT_TIMES;
     $self->{order}   = $opts->{order}   || 'random';
     $self->{verbose} = $opts->{verbose} || 0;
 
-    # unless specifically asked to, it doesn't make sense to run a
-    # known sequence more than once
-    $self->{run_iter} = $opts->{iterations} || DEFAULT_ITERATIONS;
-    if ($self->{order} ne 'random' and !$opts->{iterations}) {
-        error "forcing only one iteration for non-random order";
-        $self->{run_iter} = 1;
-    }
+    $self->{run_iter} = $self->{times};
 
     # this is like 'make test' but produces an output to be used in
     # the bug report
@@ -104,7 +93,7 @@ sub new {
         $self->{run_iter} = 1;
         $self->{times}    = 1;
         $self->{verbose}  = 1;
-        $self->{order}    = 'rotate';
+        $self->{order}    = 'random';
         $self->{trace}    = 'debug';
     }
 
@@ -113,9 +102,8 @@ sub new {
     $self->Apache::TestRun::split_test_args();
 
     my $test_opts = {
-        #verbose  => $self->{verbose},
+        verbose  => $self->{verbose},
         tests    => $self->{tests},
-        times    => $self->{times},
         order    => $self->{order},
         subtests => $self->{subtests} || [],
     };
@@ -306,17 +294,20 @@ sub run_bug_mode {
 # returns true if for some reason no more iterations should be made
 sub run_iter {
     my($self, $iter) = @_;
-
     my $stop_now = 0;
     my $reduce_iter = 0;
     my @good = ();
     warning "\n" . sep("-");
-    warning sprintf "[%03d-%02d-%02d] trying all tests %d time%s",
-        $iter, $reduce_iter, 0, $self->{times},
-        ($self->{times} > 1 ? "s" : "");
+    warning sprintf "[%03d-%02d-%02d] running all tests",
+        $iter, $reduce_iter, $self->{times};
+
 
     # first time run all tests, or all specified tests
     my @tests = @{ $self->{tests} }; # copy
+
+    # hack to ensure a new random seed is generated
+    Apache::TestSort->run(\@tests, $self);
+
     my $bad = $self->run_test($iter, $reduce_iter, \@tests, \@good);
     unless ($bad) {
         $self->{total_iterations}++;
@@ -514,23 +505,28 @@ sub run_test {
             my $test_command = "$command $test";
             my $log = '';
             IPC::Run3::run3($test_command, undef, \$log, \$log);
-            my $ok = ($log =~ /All tests successful/) ? 1 : 0;
+            my $ok = ($log =~ /All tests successful|NOTESTS/) ? 1 : 0;
 
             my @core_files_msg = $self->Apache::TestRun::scan_core_incremental(1);
 
             # if the test has caused core file(s) it's not ok
             $ok = 0 if @core_files_msg;
 
-            if ($ok) {
+            if ($ok == 1) {
                 push @$ra_ok, $test;
                 if ($self->{verbose}) {
-                    print STDERR "$test_name${fill}ok\n";
+
+                    if ($log =~ m/NOTESTS/) {
+                        print STDERR "$test_name${fill}skipped\n";
+                    } else {
+                        print STDERR "$test_name${fill}ok\n";
+                    }
                 }
                 # need to run log_diff to reset the position of the fh
                 my %log_diffs = map { $_ => $self->log_diff($_) } @log_files;
 
             }
-            else {
+            elsif ($ok == 0) {
                 push @$ra_nok, $test;
                 $bad = $test;
 
@@ -791,9 +787,9 @@ Apache::TestSmoke - Special Tests Sequen
   # get the usage and the default values
   % t/SMOKE -help
 
-  # repeat all tests 5 times and try 20 random iterations
-  # and save the report into the file 'myreport'
-  % t/SMOKE -times=5 -iterations=20 -report=myreport
+  # repeat all tests 5 times and save the report into
+  # the file 'myreport'
+  % t/SMOKE -times=5 -report=myreport
 
   # run all tests default number of iterations, and repeat tests
   # default number of times

Modified: perl/Apache-Test/trunk/lib/Apache/TestSort.pm
URL: http://svn.apache.org/viewvc/perl/Apache-Test/trunk/lib/Apache/TestSort.pm?rev=1062529&r1=1062528&r2=1062529&view=diff
==============================================================================
--- perl/Apache-Test/trunk/lib/Apache/TestSort.pm (original)
+++ perl/Apache-Test/trunk/lib/Apache/TestSort.pm Sun Jan 23 20:56:52 2011
@@ -20,21 +20,12 @@ use warnings FATAL => 'all';
 use Apache::TestTrace;
 
 sub repeat {
-    my($list, $times) = @_;
-    # a, a, b, b
-    @$list = map { ($_) x $times } @$list;
-}
-
-sub rotate {
-    my($list, $times) = @_;
-    # a, b, a, b
-    @$list = (@$list) x $times;
+    my($list) = @_;
+    return @{$list};
 }
 
 sub random {
-    my($list, $times) = @_;
-
-    rotate($list, $times); #XXX: allow random,repeat
+    my($list) = @_;
 
     my $seed = $ENV{APACHE_TEST_SEED} || '';
     my $info = "";
@@ -63,8 +54,7 @@ sub random {
 sub run {
     my($self, $list, $args) = @_;
 
-    my $times = $args->{times} || 1;
-    my $order = $args->{order} || 'rotate';
+    my $order = $args->{order} || 'random';
     if ($order =~ /^\d+$/) {
         #dont want an explicit -seed option but env var can be a pain
         #so if -order is number assume it is the random seed
@@ -75,7 +65,7 @@ sub run {
 
     # re-shuffle the list according to the requested order
     if (defined &$sort) {
-        $sort->($list, $times);
+        $sort->($list);
     }
     else {
         error "unknown order '$order'";



Mime
View raw message