Allow Devel::DProf's tests to run without text.pl
authorFlorian Ragwitz <rafl@debian.org>
Tue, 25 Jan 2011 16:16:06 +0000 (17:16 +0100)
committerFlorian Ragwitz <rafl@debian.org>
Fri, 18 Feb 2011 20:44:58 +0000 (21:44 +0100)
This allows us to run the tests outside of the core.

ext/Devel-DProf/t/DProf.t

index 7d3a170..c5e1d7b 100644 (file)
@@ -1,11 +1,17 @@
 #!perl
 
 BEGIN {
-    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";
-      exit 0;
+    if ($ENV{PERL_CORE}) {
+       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";
+           exit 0;
+       }
+       $perl = which_perl();
+    }
+    else {
+       $perl = $^X;
     }
 }
 
@@ -26,7 +32,7 @@ getopts('vI:p:');
 
 $path_sep = $Config{path_sep} || ':';
 $perl5lib = $opt_I || join( $path_sep, @INC );
-$perl = $opt_p || which_perl();
+$perl = $opt_p if $opt_p;
 
 if( $opt_v ){
        print "tests: @tests\n";