Advanced-Config
view release on metacpan or search on metacpan
full_developer_test.pl.src view on Meta::CPAN
use ExtUtils::MakeMaker 6.30;
use File::Spec;
use Cwd 'abs_path';
use File::Basename;
use File::Copy;
use File::Glob qw (bsd_glob);
# The number of fish log files to locate for each 'make test' run!
use constant MAX => 28;
my $fish_dir_summary;
my $fish_dir_details;
BEGIN {
eval {
require Time::HiRes;
Time::HiRes->import ( qw(time sleep) );
};
}
# Main Program ...
{
$fish_dir_summary = File::Spec->catdir ("t", "log_summary");
$fish_dir_details = File::Spec->catdir ("t", "log_details");
unless ( -d "t" ) {
die ("No such sub-dir './t'. Must run from the build dir!\n");
}
unless ( -d $fish_dir_summary ) {
die ("No such sub-dir '${fish_dir_summary}'. Must run from the build dir!\n");
}
unless ( -d $fish_dir_details ) {
die ("No such sub-dir '${fish_dir_details}'. Must run from the build dir!\n");
}
# Delete %ENV entry so t/99-failure.t will pass all it's tests!
delete $ENV{FAIL_TEST_99};
# Create %ENV entry so t/75-check_all_languages.t will fully write to fish.
# Also used by t/76-check_all_languages2.t
$ENV{FULL_75_TEST} = 1;
my $fail_test_msg = "";
my $one_test_prog;
my $one_fish_base;
# --------------------------------------------------------------------------
# This implements
# PL_FILES => { 'full_developer_test.pl.src' => 'full_developer_test.pl' }
# from Makefile.PL ...
# --------------------------------------------------------------------------
# This is only true during "make".
# --------------------------------------------------------------------------
if ( defined $ARGV[0] ) {
my $prog = basename ( $0, ".src" );
if ( $prog eq $ARGV[0] ) {
my $file = File::Spec->catfile ( dirname ($0), $prog );
copy ( $0, $file ) or die ("Can't create file: $file\n");
chmod ( 0755, $file ); # Executable by everyone!
print STDERR "Created file: $file\n";
exit 0;
# Requesting that we run a specific test program in sub-dir "t" ...
# Must enforce since "prove" always reports failure if not true!
} elsif ( -f $ARGV[0] && -r _ ) {
$one_test_prog = $one_fish_base = $ARGV[0];
# Logic is from helper1234::turn_fish_on_off_for_advanced_config () ...
$one_fish_base =~ s/[.]t$//;
$one_fish_base =~ s/[.]pl$//;
$one_fish_base .= ".fish.txt";
$one_fish_base = basename ( $one_fish_base );
# Can't use prove if the program isn't in the "t" sub-dir.
if ( dirname ( $one_test_prog ) ne "t" ) {
print STDERR "Program \"${one_test_prog}\" must reside in the \"t\" sub-directory!\n";
exit 3;
}
$fail_test_msg = uc ($ARGV[1] || "");
} elsif ( uc ($ARGV[0]) eq "BOTH" ) {
$fail_test_msg = uc ($ARGV[0]);
} elsif ( uc ($ARGV[0]) eq "DETAIL" ) {
$fail_test_msg = uc ($ARGV[0]);
} elsif ( uc ($ARGV[0]) eq "SUMMARY" ) {
$fail_test_msg = uc ($ARGV[0]);
# Something unexpected on the command line ...
} else {
print STDERR "Unknown program '$ARGV[0]'\n";
exit 3;
}
}
# --------------------------------------------------------------------------
# If not building the *.pl file, lets run the requested tests ...
# Each test will be run 2 times. Resetting the special environment
# variable between runs. The 2nd run is much slower than the 1st run.
# --------------------------------------------------------------------------
# Locate the "make" variant & then run ${make} ...
my $make = find_and_run_make ();
my ( $fail_summary_flag, $fail_detail_flag ) = ( 0, 0 );
if ( $fail_test_msg eq "BOTH" ) {
$fail_summary_flag = $fail_detail_flag = 1;
} elsif ( $fail_test_msg eq "DETAIL" ) {
$fail_detail_flag = 1;
} elsif ( $fail_test_msg eq "SUMMARY" ) {
$fail_summary_flag = 1;
}
if ( $one_test_prog ) {
run_specific_test ( $one_test_prog, $one_fish_base, $fail_summary_flag, $fail_detail_flag );
} else {
delete_old_fish_logs ();
( run in 0.687 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )