Skip to content

Commit

Permalink
automated_pp_test: make more subtests use unique executables
Browse files Browse the repository at this point in the history
  • Loading branch information
rschupp committed Dec 14, 2023
1 parent 24d8583 commit 514fc26
Showing 1 changed file with 58 additions and 6 deletions.
64 changes: 58 additions & 6 deletions contrib/automated_pp_test/automated_pp_test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2034,6 +2034,7 @@ sub pp_minus_I_foo_hello {
my $cmd = "";
my $sub_test = 0;
my $print_cannot_locate_message = $TRUE;
my $common_a_default_executable = $a_default_executable;

#..............................................
my $foo_top_of_file_text = '
Expand Down Expand Up @@ -2093,6 +2094,8 @@ sub hidden_print {
return (EXIT_FAILURE);
}
#..........................................................
($a_default_executable = $common_a_default_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

$cmd = "$RUN_PP -o \"$a_default_executable\" foo.pl";
if (system("$cmd")) {
$$message_ref = "\namsg169: sub $test_name_string cannot system $cmd\n";
Expand Down Expand Up @@ -2128,6 +2131,8 @@ sub hidden_print {
print ("\n"); # To add a line after the above expected error messages.

#.................................................................
($a_default_executable = $common_a_default_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

$cmd = "$RUN_PP -o \"$a_default_executable\" -I \"$hidden_dir\" foo.pl";
if (system("$cmd")) {
$$message_ref = "\namsg170: sub $test_name_string cannot system $cmd\n";
Expand Down Expand Up @@ -2257,7 +2262,7 @@ sub pp_minus_lib_foo_hello {
my $cmd = "";
my $sub_test = 0;
my $print_cannot_locate_message = $TRUE;

my $common_a_default_executable = $a_default_executable;

#..............................................
my $foo_top_of_file_text = '
Expand Down Expand Up @@ -2315,6 +2320,8 @@ sub hidden_print {
return (EXIT_FAILURE);
}
#..........................................................
($a_default_executable = $common_a_default_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

$cmd = "$RUN_PP -o \"$a_default_executable\" foo.pl";
if (system("$cmd")) {
$$message_ref = "\namsg178: sub $test_name_string cannot system $cmd\n";
Expand Down Expand Up @@ -2350,6 +2357,8 @@ sub hidden_print {
print ("\n"); # To add a line after the above expected error messages.

#.................................................................
($a_default_executable = $common_a_default_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

$cmd = "$RUN_PP -o \"$a_default_executable\" --lib \"$foo_dir\" foo.pl";
if (system("$cmd")) {
$$message_ref = "\namsg180: sub $test_name_string cannot system $cmd\n";
Expand Down Expand Up @@ -2426,7 +2435,6 @@ sub hidden_print {

#.................................................................
return ($error);

}

#########################################################################
Expand Down Expand Up @@ -2502,7 +2510,7 @@ sub pp_minus_I_foo_minus_I_bar_hello {
my $cmd = "";
my $sub_test = 0;
my $print_cannot_locate_message = $TRUE;

my $common_a_default_executable = $a_default_executable;
#..............................................
my $foo_top_of_file_text = '
use hidden_print_caller;
Expand Down Expand Up @@ -2592,6 +2600,8 @@ sub hidden_print {
}

#..........................................................
($a_default_executable = $common_a_default_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

$cmd = "$RUN_PP -o \"$a_default_executable\" \"$foo_file\"";
if (system("$cmd")) {
$$message_ref = "\namsg190: sub $test_name_string cannot system $cmd\n";
Expand Down Expand Up @@ -2627,6 +2637,8 @@ sub hidden_print {
print ("\n"); # To add a line after the above expected error messages.

#.................................................................
($a_default_executable = $common_a_default_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

$cmd = "$RUN_PP -o \"$a_default_executable\" -I \"$foo_dir\" -I \"$bar_dir\" \"$foo_file\"";
if (system("$cmd")) {
$$message_ref = "\namsg194: sub $test_name_string cannot system $cmd\n";
Expand Down Expand Up @@ -2704,7 +2716,6 @@ sub hidden_print {
#.................................................................
return ($error);
#.................................................................

}

#########################################################################
Expand Down Expand Up @@ -2765,6 +2776,7 @@ sub pp_minus_lib_foo_minus_lib_bar_hello {
my $cmd = "";
my $sub_test = 0;
my $print_cannot_locate_message = $TRUE;
my $common_a_default_executable = $a_default_executable;

#..............................................
my $foo_top_of_file_text = '
Expand Down Expand Up @@ -2854,6 +2866,8 @@ sub hidden_print {
return (EXIT_FAILURE);
}
#..........................................................
($a_default_executable = $common_a_default_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

$cmd = "$RUN_PP -o \"$a_default_executable\" foo.pl";
if (system("$cmd")) {
$$message_ref = "\namsg204: sub $test_name_string cannot system $cmd\n";
Expand Down Expand Up @@ -2889,6 +2903,8 @@ sub hidden_print {
print ("\n"); # To add a line after the above expected error messages.

#.................................................................
($a_default_executable = $common_a_default_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

$cmd = "$RUN_PP -o \"$a_default_executable\" --lib \"$foo_dir\"" .
' --lib ' . "\"$bar_dir\"" . ' foo.pl';
if (system("$cmd")) {
Expand Down Expand Up @@ -3024,6 +3040,7 @@ sub pp_minus_M_foo_hidden_print_foo {
my $sub_test = 0;
my $hidden_print_file = File::Spec->catfile($foo_dir, "hidden_print\.pm");
my $print_cannot_locate_message = $FALSE;
my $common_a_default_executable = $a_default_executable;

#..............................................
my $foo_top_of_file_text = '
Expand Down Expand Up @@ -3082,6 +3099,8 @@ sub hidden_print {
return (EXIT_FAILURE);
}
#..........................................................
($a_default_executable = $common_a_default_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

$cmd = "$RUN_PP -o \"$a_default_executable\" foo.pl";
if (system("$cmd")) {
$$message_ref = "\namsg214: sub $test_name_string cannot system $cmd\n";
Expand Down Expand Up @@ -3116,6 +3135,7 @@ sub hidden_print {
}

#..........................................................
($a_default_executable = $common_a_default_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

$cmd = "$RUN_PP -o \"$a_default_executable\" -M ${SUBDIR1}::hidden_print foo.pl";
if (system("$cmd")) {
Expand Down Expand Up @@ -3256,6 +3276,7 @@ sub pp_minus_M_foo_minus_M_bar_hello {
my $bar_dir = File::Spec->catdir($test_dir, $SUBDIR2);
my $subdir_foo_file = File::Spec->catfile($foo_dir, "foo_1\.pm");
my $print_cannot_locate_message = $FALSE;
my $common_a_default_executable = $a_default_executable;

#..............................................
my $foo_top_of_file_text = '
Expand Down Expand Up @@ -3342,6 +3363,8 @@ sub bar_1 {
return (EXIT_FAILURE);
}
#..........................................................
($a_default_executable = $common_a_default_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

$cmd = "$RUN_PP -o \"$a_default_executable\" foo.pl";
if (system("$cmd")) {
$$message_ref = "\namsg238: sub $test_name_string cannot system $cmd\n";
Expand Down Expand Up @@ -3376,6 +3399,8 @@ sub bar_1 {
}

#.................................................................
($a_default_executable = $common_a_default_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

$cmd = "$RUN_PP -o \"$a_default_executable\" -M ${SUBDIR1}::foo_1 -M ${SUBDIR2}::bar_1 foo.pl";

if (system("$cmd")) {
Expand Down Expand Up @@ -3498,6 +3523,7 @@ sub pp_minus_X_module_foo {
my $cmd = "";
my $sub_test = 0;
my $print_cannot_locate_message = $FALSE;
my $common_a_default_executable = $a_default_executable;

#..............................................
my $foo_top_of_file_text = '
Expand Down Expand Up @@ -3538,6 +3564,8 @@ sub pp_minus_X_module_foo {
}

#..........................................................
($a_default_executable = $common_a_default_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

$cmd = "$RUN_PP -o \"$a_default_executable\" \"" . File::Spec->catfile($test_dir, $foo_pl_file) . '"';
if (system("$cmd")) {
$$message_ref = "\namsg284: sub $test_name_string cannot system $cmd\n";
Expand Down Expand Up @@ -3572,6 +3600,7 @@ sub pp_minus_X_module_foo {
}

#.................................................................
($a_default_executable = $common_a_default_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

$cmd = "$RUN_PP -o \"$a_default_executable\" -X File::Basename \""
. File::Spec->catfile($test_dir, $foo_pl_file) . '"';
Expand Down Expand Up @@ -3832,6 +3861,7 @@ sub pp_hello_to_log_file {
my $sub_test = 0;
my $log_file = 'c.txt';
my $print_cannot_locate_message = $FALSE;
my $common_a_default_executable = $a_default_executable;

#..............................................
my $hello_top_of_file_text = '
Expand Down Expand Up @@ -3865,6 +3895,8 @@ sub pp_hello_to_log_file {
}

#..........................................................
($a_default_executable = $common_a_default_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

$cmd = "$RUN_PP -o \"$a_default_executable\" hello.pl -v --log=$log_file";
if (system("$cmd")) {
$$message_ref = "\namsg312: sub $test_name_string cannot system $cmd\n";
Expand Down Expand Up @@ -3919,6 +3951,8 @@ sub pp_hello_to_log_file {
return(EXIT_FAILURE);
}
#..........................................................
($a_default_executable = $common_a_default_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

$log_file = 'd.txt';
$cmd = "$RUN_PP -o \"$a_default_executable\" -L $log_file -v hello.pl";
if (system("$cmd")) {
Expand Down Expand Up @@ -4758,6 +4792,7 @@ sub test_par_clean {
my $ignore_errors = $TRUE;
my $left_over_cache_dirs = 0;
my $should_be_cache_dirs = 0;
my $common_hello_executable = $hello_executable;

#..........................................................
$$message_ref = "";
Expand Down Expand Up @@ -4802,6 +4837,8 @@ sub test_par_clean {
#.................................................................
$ENV{PAR_GLOBAL_CLEAN} = 0;
#.................................................................
($hello_executable = $common_hello_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

$cmd = "$RUN_PP -o \"$hello_executable\" \"$hello_pl_file\" ";
print ("\namsg452: About to $cmd with PAR_GLOBAL_CLEAN = 0\n") if ($verbose);
if (system("$cmd")) {
Expand Down Expand Up @@ -4879,6 +4916,8 @@ sub test_par_clean {
#.................................................................
$ENV{PAR_GLOBAL_CLEAN} = 1;
#.................................................................
($hello_executable = $common_hello_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

$cmd = "$RUN_PP -o \"$hello_executable\" \"$hello_pl_file\" ";
print ("\namsg461: About to $cmd with PAR_GLOBAL_CLEAN = 1\n") if ($verbose);
if (system("$cmd")) {
Expand Down Expand Up @@ -4954,6 +4993,8 @@ sub test_par_clean {
}

#.................................................................
($hello_executable = $common_hello_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

if ( $Config{useshrplib} and ($Config{useshrplib} ne 'false') ) {
# Perl was built as shared library, so the -d option is valid.
#.................................................................
Expand Down Expand Up @@ -5016,6 +5057,7 @@ sub test_par_clean {
#######################
# Next sub test
#######################

#.................................................................
print ("amsg489:Removing $par_scratch_dir caches\n") if $verbose;
$error = deltree($par_scratch_dir, 0, $message_ref, $ignore_errors);
Expand All @@ -5032,6 +5074,8 @@ sub test_par_clean {
}

#.................................................................
($hello_executable = $common_hello_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

if ( $Config{useshrplib} and ($Config{useshrplib} ne 'false') ) {
# Perl was built as shared library, so the -d option is valid.
#.................................................................
Expand Down Expand Up @@ -5096,6 +5140,7 @@ sub test_par_clean {
#######################
# Next sub test
#######################

#.................................................................
print ("amsg502: Removing $par_scratch_dir caches\n") if $verbose;
$error = deltree($par_scratch_dir, 0, $message_ref, $ignore_errors);
Expand All @@ -5118,6 +5163,8 @@ sub test_par_clean {
#.................................................................
$ENV{PAR_GLOBAL_CLEAN} = 0;
#.................................................................
($hello_executable = $common_hello_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

# Careful! The -C should clean the cache
$cmd = "$RUN_PP -C -o \"$hello_executable\" \"$hello_pl_file\" ";
print ("\namsg505: About to $cmd with PAR_GLOBAL_CLEAN = 0\n") if ($verbose);
Expand Down Expand Up @@ -5188,6 +5235,8 @@ sub test_par_clean {
#.................................................................
$ENV{PAR_GLOBAL_CLEAN} = 1;
#.................................................................
($hello_executable = $common_hello_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

$cmd = "$RUN_PP -C -o \"$hello_executable\" \"$hello_pl_file\" ";
print ("\bamsg521: About to $cmd with PAR_GLOBAL_CLEAN = 1\n") if ($verbose);
if (system("$cmd")) {
Expand Down Expand Up @@ -5269,6 +5318,8 @@ sub test_par_clean {
print ("\namsg537: There are $left_over_cache_dirs cache dirs\n") if $verbose;

#.................................................................
($hello_executable = $common_hello_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

if ( $Config{useshrplib} and ($Config{useshrplib} ne 'false') ) {
# Perl was built as shared library, so the -d option is valid.
#.................................................................
Expand Down Expand Up @@ -5372,6 +5423,8 @@ sub test_par_clean {
# Since $ENV{PAR_GLOBAL_CLEAN} is 1, the -C should do NOTHING.
#.................................................................
#.................................................................
($hello_executable = $common_hello_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

if ( $Config{useshrplib} and ($Config{useshrplib} ne 'false') ) {
# Perl was built as shared library, so the -d option is valid.
#.................................................................
Expand Down Expand Up @@ -5433,7 +5486,6 @@ sub test_par_clean {
#.................................................................
return(EXIT_SUCCESS);
#.................................................................

}
}
#########################################################################
Expand Down Expand Up @@ -6199,6 +6251,7 @@ sub create_large_minus_a_pl_file {
}

print ("\namsg634: sub create_large_minus_a_pl_file was successful\n") if $verbose;

return(EXIT_SUCCESS);

}
Expand Down Expand Up @@ -6325,7 +6378,6 @@ sub pp_test_large_minus_A {
($hello_executable = $common_hello_executable) =~ s/(\Q$_out\E)$/-$sub_test$1/;

#.................................................................
print STDERR "FOO ", __LINE__, " cwd=", cwd(), "\n";
$error = create_large_minus_a_pl_file ($test_name_string,
$sub_test,
$verbose,
Expand Down

0 comments on commit 514fc26

Please sign in to comment.