Revision: 1198 Author: [email protected] Date: Fri Apr 23 05:27:23 2010 Log: Make t/10-run.t less likely to fail due to low resolution clocks. Allow t/lib/NYTProfTest.pm to find scripts in bin if blib doesn't exist.
http://code.google.com/p/perl-devel-nytprof/source/detail?r=1198 Modified: /trunk/t/10-run.t /trunk/t/lib/NYTProfTest.pm ======================================= --- /trunk/t/10-run.t Mon Apr 5 16:22:16 2010 +++ /trunk/t/10-run.t Fri Apr 23 05:27:23 2010 @@ -8,9 +8,10 @@ use Devel::NYTProf::Run qw(profile_this); +my $n = 10_000; my @src = ( - "1+1;\n", - "2+2;\n", + "1+1 for (1..$n);\n", + "2+2 for (1..$n);\n", ); run_test_group( { @@ -49,10 +50,10 @@ my $line_time_data = $fi->line_time_data; is ref $line_time_data, 'ARRAY'; - is $fi->sum_of_stmts_count, 2; + is $fi->sum_of_stmts_count, 4; # XXX these timings will probably cause test failures cmp_ok $fi->sum_of_stmts_time, '>', 0; - cmp_ok $fi->sum_of_stmts_time, '<', 0.001; # should be tiny + cmp_ok $fi->sum_of_stmts_time, '<', 10; # should be tiny }, }); ======================================= --- /trunk/t/lib/NYTProfTest.pm Mon Apr 19 04:08:57 2010 +++ /trunk/t/lib/NYTProfTest.pm Fri Apr 23 05:27:23 2010 @@ -69,7 +69,12 @@ if (-d '../blib') { unshift @INC, '../blib/arch', '../blib/lib'; } -my $bindir = (grep {-d} qw(./blib/script ../blib/script))[0]; +my $bindir = (grep {-d} qw(./blib/script ../blib/script))[0] || do { + my $bin = (grep {-d} qw(./bin ../bin))[0] + or die "Can't find scripts"; + warn "Couldn't find blib/script directory, so using $bin"; + $bin; +}; my $nytprofcsv = "$bindir/nytprofcsv"; my $nytprofhtml = "$bindir/nytprofhtml"; my $nytprofmerge= "$bindir/nytprofmerge"; -- You've received this message because you are subscribed to the Devel::NYTProf Development User group. Group hosted at: http://groups.google.com/group/develnytprof-dev Project hosted at: http://perl-devel-nytprof.googlecode.com CPAN distribution: http://search.cpan.org/dist/Devel-NYTProf To post, email: [email protected] To unsubscribe, email: [email protected]
