Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[tools/test_summary.pl] add --timing option for simple benchmarking
  • Loading branch information
mberends committed Aug 24, 2011
1 parent 6e4aa6c commit 40fbe3e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lib/Test.pm
Expand Up @@ -12,6 +12,7 @@ my $todo_reason = '';
my $num_of_tests_planned;
my $no_plan = 1;
my $die_on_fail;
my $perl6_test_times = ? %*ENV<PERL6_TEST_TIMES>;

## If done_testing hasn't been run when we hit our END block, we need to know
## so that it can be run. This allows compatibility with old tests that use
Expand Down Expand Up @@ -45,8 +46,8 @@ multi sub plan($number_of_tests) {
}
# Emit two successive timestamps to measure the measurment overhead,
# and to eliminate cacheing bias, if it exists, from the first test.
#say '# t=' ~ pir::time__N if %*ENV{'PERL6_TEST_TIMES'};
#say '# t=' ~ pir::time__N if %*ENV{'PERL6_TEST_TIMES'};
say '# t=' ~ nqp::p6box_s(pir::time__n) if $perl6_test_times;
say '# t=' ~ nqp::p6box_s(pir::time__n) if $perl6_test_times;
# Ideally the time readings above could be made with the expression
# now.to-posix[0], but the execution time showed by the difference
# between the two successive readings is far slower than when the
Expand Down Expand Up @@ -247,7 +248,7 @@ sub proclaim($cond, $desc) {
print $todo_reason;
}
print "\n";
#say '# t=' ~ pir::time__N if %*ENV{'PERL6_TEST_TIMES'};
say '# t=' ~ nqp::p6box_s(pir::time__n) if $perl6_test_times;

if !$cond && $die_on_fail && !$todo_reason {
die "Test failed. Stopping test";
Expand Down
5 changes: 4 additions & 1 deletion tools/test_summary.pl
Expand Up @@ -18,10 +18,13 @@
use warnings;
use Time::Local;
use Time::HiRes;
use Getopt::Long;

my $timing;
GetOptions('timing', \$timing);
my $benchmark;
# Comment out the next line to skip benchmarking; see docs below
$benchmark = Simple::Relative::Benchmarking::begin(); # defined below
$benchmark = Simple::Relative::Benchmarking::begin() if $timing;

# Build the list of test scripts to run in @tfiles
my $testlist = $ARGV[0] || 't/spectest.data';
Expand Down

0 comments on commit 40fbe3e

Please sign in to comment.