Advanced-Config
view release on metacpan or search on metacpan
full_developer_test.pl.src view on Meta::CPAN
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_all_tests ( $make, $fail_summary_flag, $fail_detail_flag ); # Does via "make test".
}
exit (0);
}
# ==============================================================================
# Start of the functions called ...
# ==============================================================================
# Run the test suite in both configurations ...
sub run_all_tests
{
my $make = shift;
my $summary_flag = shift;
my $details_flag = shift;
my ( $summary_msg, $detail_msg );
my $t0 = time ();
# Run the summary test ...
eval {
local $ENV{FAIL_TEST_99} = 1 if ( $summary_flag );
run_make_test ( $make, 1, MAX, "=", "Fred::Fish::DBUG::OFF, just high level logs generated. (fast)" );
};
if ( $@ ) {
$summary_msg = $@;
}
my $t1 = time ();
# Run the detailed test ...
eval {
local $ENV{FAIL_TEST_99} = 1 if ( $details_flag );
run_make_test ( $make, 0, MAX, "-", "Fred::Fish::DBUG::ON, providing detailed logging. (slow)" );
};
if ( $@ ) {
$detail_msg = $@;
}
my $t2 = time ();
print_status ( $summary_msg, $detail_msg );
printf "Pass 1: %.1f second(s)\n", ($t1 - $t0);
printf "Pass 2: %.1f second(s)\n", ($t2 - $t1);
print "\n";
return;
}
# Run a test suite in the requested mode ...
sub run_make_test
{
my $make = shift; # Which make command to use.
my $off_flag = shift; # Which setting to use: 0, 1.
my $num_fish = shift; # The number of fish files to expect ...
my $sep_char = shift;
my $log_msg = shift;
my $mk = basename ($make);
printf ("\n%s\n", ${sep_char}x50);
print "Running '${mk} test' for ${log_msg} ...\n";
printf ("%s\n\n", ${sep_char}x50);
# Determine the test mode to use ...
$ENV{FISH_OFF_FLAG} = ${off_flag};
# Run the tests ...
my $res = system ("${make} test");
my $cnt = show_fish_logs ( ${off_flag} ? $fish_dir_summary : $fish_dir_details );
# Check out the results ...
if ( $res != 0 ) {
die ("Failed one or more test cases! FISH_OFF_FLAG == ${off_flag} (${log_msg}!)\n\n");
}
if ( $cnt != ${num_fish} ) {
die ("Failed final test case! FISH_OFF_FLAG == ${off_flag} (${log_msg}!)\n",
"Wrong number of fish logs generated! (${cnt} vs ${num_fish})\n\n");
}
return;
}
# Run a single test in both modes using "prove" ...
sub run_specific_test
{
my $prog = shift;
my $fish = shift; # The basename of the fish log file ...
my $summary_flag = shift;
my $details_flag = shift;
my $log_s = File::Spec->catfile ($fish_dir_summary, $fish);
my $log_d = File::Spec->catfile ($fish_dir_details, $fish);
# Delte both log files ...
unlink ( $log_s, $log_d );
my ( $summary_msg, $detail_msg );
my $prove = which_prove ( $prog );
# Run the summary test ...
( run in 0.560 second using v1.01-cache-2.11-cpan-39bf76dae61 )