$output_rules .= file_contents ('dejagnu', new Automake::Location);
}
-sub handle_per_suffix_test
+sub handle_per_suffix_test($)
{
- my ($test_suffix, %transform) = @_;
- my ($pfx, $generic, $am_exeext);
+ my $test_suffix = shift;
- my ($pfx, $parallel_tests_option);
- prog_error ("called with 'parallel-tests' option not set")
- unless $parallel_tests_option = option 'parallel-tests';
++ my $pfx;
if ($test_suffix eq '')
{
$pfx = '';
prog_error ("test suffix '$test_suffix' lacks leading dot")
unless $test_suffix =~ m/^\.(.*)/;
$pfx = uc ($1) . '_';
- $generic = 1;
- $am_exeext = exists $configure_vars{'EXEEXT'} ? 'am__EXEEXT'
- : 'FALSE';
}
# The "test driver" program, deputed to handle tests protocol used by
- # test scripts. By default, it's assumed that no protocol is used,
- # so we fall back to the old "parallel-tests" behaviour, implemented
- # by the 'test-driver' auxiliary script.
+ # test scripts. By default, it's assumed that no protocol is used, so
+ # we fall back to the old behaviour, implemented by the 'test-driver'
+ # auxiliary script.
if (! var "${pfx}LOG_DRIVER")
{
- require_conf_file ($parallel_tests_option->{position}, FOREIGN,
- 'test-driver');
+ require_conf_file ("parallel-tests", FOREIGN, 'test-driver');
define_variable ("${pfx}LOG_DRIVER",
"\$(SHELL) $am_config_aux_dir/test-driver",
INTERNAL);
if (var ('TESTS'))
{
push (@check_tests, 'check-TESTS');
- my $check_deps = "@check";
$output_rules .= &file_contents ('check', new Automake::Location,
COLOR => !! option 'color-tests',
- PARALLEL_TESTS => !! option 'parallel-tests',
+ SERIAL_TESTS => !! option 'serial-tests',
- CHECK_DEPS => $check_deps);
-
- # Tests that are known programs should have $(EXEEXT) appended.
- # For matching purposes, we need to adjust XFAIL_TESTS as well.
- append_exeext { exists $known_programs{$_[0]} } 'TESTS';
- append_exeext { exists $known_programs{$_[0]} } 'XFAIL_TESTS'
- if (var ('XFAIL_TESTS'));
-
- if (! option 'serial-tests')
+ CHECK_DEPS => "@check");
-
- if (my $parallel_tests = option 'parallel-tests')
++ if (option 'serial-tests')
++ {
++ # Tests that are known programs should have $(EXEEXT) appended.
++ # For matching purposes, we need to adjust XFAIL_TESTS as well.
++ append_exeext { exists $known_programs{$_[0]} } 'TESTS';
++ append_exeext { exists $known_programs{$_[0]} } 'XFAIL_TESTS'
++ if (var ('XFAIL_TESTS'));
++ }
++ else
{
define_variable ('TEST_SUITE_LOG', 'test-suite.log', INTERNAL);
my $suff = '.test';
"invalid test extensions: @invalid_test_suffixes";
}
@test_suffixes = grep { is_valid_test_extension $_ } @test_suffixes;
- if ($handle_exeext)
- {
- unshift (@test_suffixes, $at_exeext)
- unless $test_suffixes[0] eq $at_exeext;
- }
- unshift (@test_suffixes, '');
-
- transform_variable_recursively
- ('TESTS', 'TEST_LOGS', 'am__testlogs', 1, INTERNAL,
- sub {
- my ($subvar, $val, $cond, $full_cond) = @_;
- my $obj = $val;
- return $obj
- if $val =~ /^\@.*\@$/;
- $obj =~ s/\$\(EXEEXT\)$//o;
-
- if ($val =~ /(\$\((top_)?srcdir\))\//o)
- {
- msg ('error', $subvar->rdef ($cond)->location,
- "using '$1' in TESTS is currently broken: '$val'");
- }
-
- foreach my $test_suffix (@test_suffixes)
- {
- next
- if $test_suffix eq $at_exeext || $test_suffix eq '';
- return substr ($obj, 0, length ($obj) - length ($test_suffix)) . '.log'
- if substr ($obj, - length ($test_suffix)) eq $test_suffix;
- }
- my $base = $obj;
- $obj .= '.log';
- handle_per_suffix_test ('',
- OBJ => $obj,
- BASE => $base,
- SOURCE => $val);
- return $obj;
- });
-
- my $nhelper=1;
- my $prev = 'TESTS';
- my $post = '';
- my $last_suffix = $test_suffixes[$#test_suffixes];
- my $cur = '';
+ # It is *imperative* that the empty 'suffix goes last.
+ # Otherwise, a declaration like "TESTS = all.test" would cause GNU
+ # make to mistakenly try to build the 'all.log' and 'all.trs' files
+ # from a non-existent 'all' program (because the Makefile contains
+ # an explicit 'all' target) rather than from the 'all.test' script,
+ # thus causing all sort of mishaps and confusion.
+ push @test_suffixes, '';
foreach my $test_suffix (@test_suffixes)
{
- if ($test_suffix eq $last_suffix)
- {
- $cur = 'TEST_LOGS';
- }
- else
- {
- $cur = 'am__test_logs' . $nhelper;
- }
- define_variable ($cur,
- '$(' . $prev . ':' . $test_suffix . $post . '=.log)', INTERNAL);
- $post = '.log';
- $prev = $cur;
- $nhelper++;
- if ($test_suffix ne $at_exeext && $test_suffix ne '')
- {
- handle_per_suffix_test ($test_suffix,
- OBJ => '',
- BASE => '$*',
- SOURCE => '$<');
- }
+ handle_per_suffix_test ($test_suffix);
}
- $clean_files{'$(TEST_LOGS)'} = MOSTLY_CLEAN;
- $clean_files{'$(TEST_LOGS:.log=.trs)'} = MOSTLY_CLEAN;
+ $clean_files{'$(am__test_logs)'} = MOSTLY_CLEAN;
+ $clean_files{'$(am__test_results)'} = MOSTLY_CLEAN;
$clean_files{'$(TEST_SUITE_LOG)'} = MOSTLY_CLEAN;
}
- else
- {
- # Tests that are known programs should have $(EXEEXT) appended.
- # For matching purposes, we need to adjust XFAIL_TESTS as well.
- append_exeext { exists $known_programs{$_[0]} } 'TESTS';
- append_exeext { exists $known_programs{$_[0]} } 'XFAIL_TESTS'
- if (var ('XFAIL_TESTS'));
- }
}
}