DProf fixes
[p5sagit/p5-mst-13.2.git] / ext / Devel / DProf / DProf.t
index be711f1..3488bc8 100644 (file)
@@ -3,6 +3,7 @@
 BEGIN {
     chdir( 't' ) if -d 't';
     @INC = '../lib';
+    require './test.pl';      # for which_perl() etc
     require Config; import Config;
     if ($Config{'extensions'} !~ /\bDevel\/DProf\b/){
       print "1..0 # Skip: Devel::DProf was not built\n";
@@ -27,7 +28,7 @@ getopts('vI:p:');
 
 $path_sep = $Config{path_sep} || ':';
 $perl5lib = $opt_I || join( $path_sep, @INC );
-$perl = $opt_p || $^X;
+$perl = $opt_p || which_perl();
 
 if( $opt_v ){
        print "tests: @tests\n";
@@ -49,7 +50,7 @@ sub profile {
        my $t_start = new Benchmark;
         open( R, "$perl \"$opt_d\" $test |" ) || warn "$0: Can't run. $!\n";
        @results = <R>;
-       close R;
+       close R or warn "Could not close: $!";
        my $t_total = timediff( new Benchmark, $t_start );
 
        if( $opt_v ){
@@ -57,7 +58,7 @@ sub profile {
                print @results
        }
 
-        print '# ',timestr( $t_total, 'nop' ), "\n";
+        print '# ' . timestr( $t_total, 'nop' ), "\n";
 }
 
 
@@ -72,7 +73,7 @@ sub verify {
 
 
 $| = 1;
-print "1..18\n";
+print "1..20\n";
 while( @tests ){
        $test = shift @tests;
         $test =~ s/\.$// if $^O eq 'VMS';