In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/ac681bb324daa37001a1a03002e1d02efbaf7fcd?hp=0e61cc55e00054884ddd493095f714abdd722413>
- Log ----------------------------------------------------------------- commit ac681bb324daa37001a1a03002e1d02efbaf7fcd Author: Jarkko Hietaniemi <[email protected]> Date: Fri Nov 7 06:40:01 2014 -0500 Revert "t/TEST: move our @found out to its real scope" This reverts commit 448bc2e91e255b2610f23d9fe8092c9143dac28e. M t/TEST commit 33c0d18286e545516f3e3865d7a59c524383963e Author: Jarkko Hietaniemi <[email protected]> Date: Fri Nov 7 06:39:57 2014 -0500 Revert "t/TEST: $failure doesnt need to use defined" This reverts commit 861a58daef615e7ade791b887911ef3caba8c539. M t/TEST commit 133d407acddcac4619e7cb5c76b0c9b0e511ec24 Author: Jarkko Hietaniemi <[email protected]> Date: Fri Nov 7 06:39:56 2014 -0500 Revert "t/TEST: add a common timestamp" This reverts commit 3c8571535150a64cf1163a15106d0f9e57fdd6a7. M t/TEST commit e1a5ed7af87f2083afb153c6a1fc91b1d0ae966d Author: Jarkko Hietaniemi <[email protected]> Date: Fri Nov 7 06:39:55 2014 -0500 Revert "t/TEST: comment some of the <$results> loop vars" This reverts commit 861aa4195fddf02db2d2d1412c83a273daae9f05. M t/TEST commit 75e21addca57d152f635ce31a225c2d4fc69b91d Author: Jarkko Hietaniemi <[email protected]> Date: Fri Nov 7 06:39:54 2014 -0500 Revert "t/TEST: move do_nothing test after option-handling code" This reverts commit 922487b2e3c980db625829f57958aac6a3e33552. M t/TEST commit b03030b88f7592eeb014569f719d6e2c8f4aa767 Author: Jarkko Hietaniemi <[email protected]> Date: Fri Nov 7 06:39:54 2014 -0500 Revert "t/TEST: add -lxperf option to run tests under linux's perf stat" This reverts commit 02a483e9608abd0f822d7c8ec6d64c07c4689e55. M t/TEST commit fb7ba3c814e767201ab027c6f1e3f9bd015ed7ff Author: Jarkko Hietaniemi <[email protected]> Date: Fri Nov 7 06:39:53 2014 -0500 Revert "t/TEST: simplify <$results> processing loop. - TAP13.1+" This reverts commit b8059a1db50cef0ea798275144b6d2f54a288946. M t/TEST commit 56e28cb052360c350808a1a5f8d4fbdeba895291 Author: Jarkko Hietaniemi <[email protected]> Date: Fri Nov 7 06:39:52 2014 -0500 Revert "t/TEST: change timings Storable key: perf -> times, a better description" This reverts commit ba369d6f39f2f98f9e999dc978baeba4d4efba25. M t/TEST commit e73fd51eb894a6670e2825e3a3c4d847434c98ad Author: Jarkko Hietaniemi <[email protected]> Date: Fri Nov 7 06:39:51 2014 -0500 Revert "t/TEST: suppress 2 uninitialized envars under make test.valgrind" This reverts commit e28ec392de528ba135a100709ce789a168286f86. M t/TEST commit cbc3f2f8e9d7e9b9ec5ae98e57f48bdc38e7e3a4 Author: Jarkko Hietaniemi <[email protected]> Date: Fri Nov 7 06:39:49 2014 -0500 Revert "t/TEST: RFC start to separate out valgrind test support." This reverts commit 08ac0af6a0260a3939c4904c299200adee71010d. M MANIFEST M t/TEST D t/TestValgrind.pm commit 894cd0239610dd150f6264b0867079413ebcc656 Author: Jarkko Hietaniemi <[email protected]> Date: Fri Nov 7 06:39:47 2014 -0500 Revert "manisort" This reverts commit b22d640684f6001bfd63316a6a3ce69127745943. M MANIFEST ----------------------------------------------------------------------- Summary of changes: MANIFEST | 1 - t/TEST | 174 ++++++++++++++++++++++-------------------------------- t/TestValgrind.pm | 1 - 3 files changed, 70 insertions(+), 106 deletions(-) delete mode 100644 t/TestValgrind.pm diff --git a/MANIFEST b/MANIFEST index 2c17f29..356a73f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -5472,7 +5472,6 @@ t/test_pl/can_isa_ok.t Tests for the simple testing library t/test_pl/_num_to_alpha.t Tests for the simple testing library t/test_pl/plan_skip_all.t Tests for the simple testing library t/test_pl/tempfile.t Tests for the simple testing library -t/TestValgrind.pm make test.valgrind support t/thread_it.pl Run regression tests in a new thread t/uni/attrs.t See if Unicode attributes work t/uni/bless.t See if Unicode bless works diff --git a/t/TEST b/t/TEST index dc018ce..15d59b7 100755 --- a/t/TEST +++ b/t/TEST @@ -107,41 +107,27 @@ my %skip = ( '.svn' => 1, ); + +if ($::do_nothing || $::do_nothing) { # set by harness b4 requiring us + return 1; +} + $| = 1; # for testing TEST only #BEGIN { require '../lib/strict.pm'; "strict"->import() }; #BEGIN { require '../lib/warnings.pm'; "warnings"->import() }; -# allow setting -options from env -unshift @ARGV, split /;/, $ENV{TEST_OPTS} if $ENV{TEST_OPTS}; - # remove empty elements due to insertion of empty symbols via "''p1'" syntax @ARGV = grep($_,@ARGV) if $^O eq 'VMS'; our $show_elapsed_time = $ENV{HARNESS_TIMER} || 0; -{ # create timestamp for any reports written, so theyre corelatable - my @dt = localtime; - $dt[5] += 1900; $dt[4] += 1; # fix year, month - $::tstamp = sprintf("%d-%.2d%.2d-%.2d%.2d-%.2d-$$", @dt[5,4,3,2,1,0]); -} - -# wrapper template for linux perf -our %cmdwrap = ( - tool => "perf", # path - cmd => "stat", # others possible, none tried - rptdir => $ENV{PWD}, # typically ./t, better if absolute - name => "", # $::tstamp prefixed implicitly - # reps => 1 # - opts => "", # pass-thru to perf stat: 'opts=-x,' gives CSV - ); - # Cheesy version of Getopt::Std. We can't replace it with that, because we # can't rely on require working. { my @argv = (); foreach my $idx (0..$#ARGV) { - push( @argv, $ARGV[$idx] ), next unless $ARGV[$idx] =~ /^-(\S+?)(?:=(.+))?$/; + push( @argv, $ARGV[$idx] ), next unless $ARGV[$idx] =~ /^-(\S+)$/; $::benchmark = 1 if $1 eq 'benchmark'; $::core = 1 if $1 eq 'core'; $::verbose = 1 if $1 eq 'v'; @@ -154,28 +140,10 @@ our %cmdwrap = ( $::deparse_opts = $1; _process_deparse_config(); } - if ($1 eq 'lxperf') { - die "perf only available on linux" unless $^O eq 'linux'; - $::perf = 1; - next unless $2; - # $2 is either Reps or : delimited $k=$v pairs - my (@v) = split /:/, $2; - $cmdwrap{reps} = $v[0] if @v == 1 and $v[0] =~ /^\d+$/; - # parse as $k=$v to override %cmdwrap defaults - m/(.+?)=(.+)/ and $cmdwrap{$1} = $2 for @v; - } } @ARGV = @argv; } -if ($::do_nothing || $::do_nothing) { # set by harness b4 requiring us - return 1; -} - -if ($ENV{PERL_VALGRIND}) { - require TestValgrind; -} - chdir 't' if -f 't/TEST'; if (-f 'TEST' && -f 'harness' && -d '../lib') { @INC = '../lib'; @@ -195,8 +163,7 @@ if ($show_elapsed_time) { require Time::HiRes } my %timings = (); # testname => [@et] pairs if $show_elapsed_time. # Roll your own File::Find! -our @found; -sub _find_tests { @found = (); push @ARGV, _find_files('\.t$', $_[0]) } +sub _find_tests { our @found=(); push @ARGV, _find_files('\.t$', $_[0]) } sub _find_files { my($patt, @dirs) = @_; for my $dir (@dirs) { @@ -335,14 +302,6 @@ sub _cmd { } $perl = "$valgrind_exe $vg_opts $perl"; } - if ($::perf) { - my $ofile = "$cmdwrap{rptdir}/$::tstamp$cmdwrap{name}.perf"; - my $wrapper = "$cmdwrap{tool} $cmdwrap{cmd} " - . ( defined $cmdwrap{reps} && $cmdwrap{reps} > 0 - ? "--repeat $cmdwrap{reps}" : "" ) - . " --append -o $ofile $cmdwrap{opts} -- "; - $perl = "$wrapper $perl"; - } my $args = "$options->{testswitch} $options->{switch} $options->{utf8}"; $cmd = $perl . _quote_args($args) . " $test $redir"; @@ -571,8 +530,8 @@ EOT my $grind_ct = 0; # count of non-empty valgrind reports my $total_files = @tests; my $good_files = 0; - my $tested_files = 0; - my $totmax = 0; # += $plan after <$results> consumed. includes --repeats + my $tested_files = 0; + my $totmax = 0; my %failed_tests; my $toolnm; # valgrind, cachegrind, perf @@ -607,11 +566,12 @@ EOT my $results = _run_test($test, $type); - my $failure = ""; - my $plan = undef; # the N in "1..N" - my $next = 0; # ++ after each "ok M", reset on "1..N" - my $nextreps = 0; # ++ after each "ok M" - my $Reps = 0; # ++ when "1..N" seen + my $failure; + my $next = 0; + my $seen_leader = 0; + my $seen_ok = 0; + my $trailing_leader = 0; + my $max; my %todo; while (<$results>) { next if /^\s*$/; # skip blank lines @@ -627,45 +587,47 @@ EOT print $_; } unless (/^\#/) { + if ($trailing_leader) { + # shouldn't be anything following a postfix 1..n + $failure = 'FAILED--extra output after trailing 1..n'; + last; + } if (/^1\.\.([0-9]+)( todo ([\d ]+))?/) { - - # a "1..N" plan, maybe todos also - if (!$plan) { - $plan = $1; - } else { - # allow another plan agreeing on N - if ($1 != $plan) { - $failure = "latest plan disagrees: $1 != $plan\n"; + if ($seen_leader) { + $failure = 'FAILED--seen duplicate leader'; + last; + } + $max = $1; + %todo = map { $_ => 1 } split / /, $3 if $3; + $totmax = $totmax + $max; + $tested_files = $tested_files + 1; + if ($seen_ok) { + # 1..n appears at end of file + $trailing_leader = 1; + if ($next != $max) { + $failure = "FAILED--expected $max tests, saw $next"; last; } } - unless ($next == 0 or $next == $plan) { - $failure = "plan seen in middle of tests: $next\n"; - last; + else { + $next = 0; } - $Reps = $Reps + 1; - $next = 0; # reset for next "1..N" plan check - - $totmax = $totmax + $plan; - $tested_files = $tested_files + 1; - - # if $Reps>1, this work is redone $Reps-1 times, trivial extra. - # assume todos match, since plans do. - %todo = map { $_ => 1 } split / /, $3 if $3; - next; + $seen_leader = 1; } else { - if (/^(not )?ok(?:\s+(\d+))?[^\#]*(\s*\#.*)?/) { + if (/^(not )?ok(?: (\d+))?[^\#]*(\s*\#.*)?/) { + unless ($seen_leader) { + unless ($seen_ok) { + $next = 0; + } + } + $seen_ok = 1; $next = $next + 1; - $nextreps = $nextreps + 1; - my ($not, $num, $extra, $istodo) = ($1, $2, $3, 0); + my($not, $num, $extra, $istodo) = ($1, $2, $3, 0); + $num = $next unless $num; + + if ($num == $next) { - $num = $next unless $num; # tolerate un-numbered - if ($num != $next) { - $failure ="FAILED--expected test $next, saw test $num"; - last; - } - else { # SKIP is essentially the same as TODO for t/TEST # this still conforms to TAP: # http://testanything.org/wiki/index.php/TAP_specification @@ -677,6 +639,10 @@ EOT last; } } + else { + $failure ="FAILED--expected test $next, saw test $num"; + last; + } } elsif (/^Bail out!\s*(.*)/i) { # magic words die "FAILED--Further testing stopped" . ($1 ? ": $1\n" : ".\n"); @@ -693,8 +659,8 @@ EOT } close $results; - if (not $failure) { - $failure = "FAILED--no plan found next:$next" unless defined $plan; + if (not defined $failure) { + $failure = 'FAILED--no leader found' unless $seen_leader; } _check_valgrind(\$toolnm, \$grind_ct, \$test); @@ -702,11 +668,13 @@ EOT if ($type eq 'deparse' && !$ENV{KEEP_DEPARSE_FILES}) { unlink "./$test.dp"; } - if (not $failure and $nextreps != $Reps * $plan) { - $failure="FAILED--expected $Reps * $plan tests, saw $nextreps"; + if (not defined $failure and $next != $max) { + $failure="FAILED--expected $max tests, saw $next"; } - if (not $failure and $? ) { # don't mask a test failure + if( !defined $failure # don't mask a test failure + and $? ) + { $failure = "FAILED--non-zero wait status: $?"; } @@ -723,7 +691,7 @@ EOT } } - if ($failure) { + if (defined $failure) { print "${te}$failure\n"; $::bad_files = $::bad_files + 1; if ($test =~ /^base/ && ! defined &DynaLoader::boot_DynaLoader) { @@ -735,7 +703,7 @@ EOT $failed_tests{$test} = 1; } else { - if ($plan) { + if ($max) { my ($elapsed, $etms) = ("", 0); if ( $show_elapsed_time ) { $etms = (Time::HiRes::time() - $test_start_time) * 1000; @@ -765,8 +733,6 @@ EOT } else { die "FAILED--no tests were run for some reason.\n"; - # forex: ./perl TEST run/dtrace.t - # 1..0 # Skip no dtrace } } else { @@ -818,13 +784,15 @@ SHRDLU_5 print "$tot\n"; if ($good_files) { if (-d $show_elapsed_time) { - # HARNESS_TIMER = <a-directory>. Save a storable file of - # timings data into the dir. NB: the test cds to ./t/, so - # relative path must account for that, or better, just - # give an abs-path. + # HARNESS_TIMER = <a-directory>. Save timings etc to + # storable file there. NB: the test cds to ./t/, so + # relative path must account for that, ie ../../perf + # points to dir next to source tree. require Storable; - my $fn = "$show_elapsed_time/$::tstamp.ttimes"; - Storable::store({ times => \%timings, + my @dt = localtime; + $dt[5] += 1900; $dt[4] += 1; # fix year, month + my $fn = "$show_elapsed_time/".join('-', @dt[5,4,3,2,1]).".ttimes"; + Storable::store({ perf => \%timings, gather_conf_platform_info(), total => $tot, }, $fn); @@ -863,7 +831,7 @@ sub gather_conf_platform_info { load => [ grep chomp, `uptime` ], }, host => (grep chomp, `hostname -f`), - version => '0.031', # bump for conf, platform, or data collection changes + version => '0.03', # bump for conf, platform, or data collection changes ); } @@ -883,12 +851,10 @@ sub _check_valgrind { warn "$0: Failed to open '$Valgrind_Log': $!\n"; } } - # todo: precede if clause with $ENV{VG_OPTS} && if ($ENV{VG_OPTS} =~ /(cachegrind)/ or $$toolnm =~ /(perf)/) { $$toolnm = $1; if ($$toolnm eq 'perf') { - # TBD: need VG_TEST=--help to pass test.valgrind when VALGRIND=/usr/bin/perf - # VG_OPTS='stat -o perf-stat --append --' is also needed to run perf this way. + # append perfs subcommand, not just stat my ($sub) = split /\s/, $ENV{VG_OPTS}; $$toolnm .= "-$sub"; } diff --git a/t/TestValgrind.pm b/t/TestValgrind.pm deleted file mode 100644 index 0afc604..0000000 --- a/t/TestValgrind.pm +++ /dev/null @@ -1 +0,0 @@ -1; -- Perl5 Master Repository
