$output_rules .= file_contents ('dejagnu', new Automake::Location);
}
+sub handle_per_suffix_test
+{
+ my ($test_suffix, %transform) = @_;
+ my ($pfx, $generic, $parallel_tests_option, $am_exeext);
+ prog_error ("called with 'parallel-tests' option not set")
+ unless $parallel_tests_option = option 'parallel-tests';
+ if ($test_suffix eq '')
+ {
+ $pfx = '';
+ $generic = 0;
+ $am_exeext = 'FALSE';
+ }
+ else
+ {
+ 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.
+ if (! var "${pfx}LOG_DRIVER")
+ {
+ require_conf_file ($parallel_tests_option->{position}, FOREIGN,
+ 'test-driver');
+ define_variable ("${pfx}LOG_DRIVER",
+ "\$(SHELL) $am_config_aux_dir/test-driver",
+ INTERNAL);
+ }
+ my $driver = '$(' . $pfx . 'LOG_DRIVER)';
+ my $driver_flags = '$(AM_' . $pfx . 'LOG_DRIVER_FLAGS)'
+ . ' $(' . $pfx . 'LOG_DRIVER_FLAGS)';
+ my $compile = "${pfx}LOG_COMPILE";
+ define_variable ($compile,
+ '$(' . $pfx . 'LOG_COMPILER)'
+ . ' $(AM_' . $pfx . 'LOG_FLAGS)'
+ . ' $(' . $pfx . 'LOG_FLAGS)',
+ INTERNAL);
+ $output_rules .= file_contents ('check2', new Automake::Location,
+ GENERIC => $generic,
+ DRIVER => $driver,
+ DRIVER_FLAGS => $driver_flags,
+ COMPILE => '$(' . $compile . ')',
+ EXT => $test_suffix,
+ am__EXEEXT => $am_exeext,
+ %transform);
+}
# Handle TESTS variable and other checks.
sub handle_tests
}
my $base = $obj;
$obj .= '.log';
- # 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.
- if (! var 'LOG_DRIVER')
- {
- require_conf_file ($parallel_tests->{position}, FOREIGN,
- 'test-driver');
- define_variable ('LOG_DRIVER',
- "\$(SHELL) $am_config_aux_dir/test-driver",
- INTERNAL);
- }
- my $driver = '$(LOG_DRIVER)';
- my $driver_flags = '$(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS)';
- my $compile = 'LOG_COMPILE';
- define_variable ($compile,
- '$(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)', INTERNAL);
- $output_rules .= file_contents ('check2', new Automake::Location,
- GENERIC => 0,
- OBJ => $obj,
- BASE => $base,
- SOURCE => $val,
- DRIVER => $driver,
- DRIVER_FLAGS => $driver_flags,
- COMPILE =>'$(' . $compile . ')',
- EXT => '',
- am__EXEEXT => 'FALSE');
+ handle_per_suffix_test ('',
+ OBJ => $obj,
+ BASE => $base,
+ SOURCE => $val);
return $obj;
});
$nhelper++;
if ($test_suffix ne $at_exeext && $test_suffix ne '')
{
- (my $ext = $test_suffix) =~ s/^\.//;
- $ext = uc $ext;
- # See comments about definition of LOG_DRIVER, above.
- if (! var "${ext}_LOG_DRIVER")
- {
- require_conf_file ($parallel_tests->{position}, FOREIGN,
- 'test-driver');
- define_variable ("${ext}_LOG_DRIVER",
- "\$(SHELL) $am_config_aux_dir/test-driver",
- INTERNAL);
- }
- my $driver = '$(' . $ext . '_LOG_DRIVER)';
- my $driver_flags = '$(AM_' . $ext . '_LOG_DRIVER_FLAGS) ' .
- '$(' . $ext . '_LOG_DRIVER_FLAGS)';
- my $compile = $ext . '_LOG_COMPILE';
- define_variable ($compile,
- '$(' . $ext . '_LOG_COMPILER) $(AM_' . $ext . '_LOG_FLAGS)'
- . ' $(' . $ext . '_LOG_FLAGS)', INTERNAL);
- my $am_exeext = $handle_exeext ? 'am__EXEEXT' : 'FALSE';
- $output_rules .= file_contents ('check2', new Automake::Location,
- GENERIC => 1,
- OBJ => '',
- BASE => '$*',
- SOURCE => '$<',
- DRIVER => $driver,
- DRIVER_FLAGS => $driver_flags,
- COMPILE => '$(' . $compile . ')',
- EXT => $test_suffix,
- am__EXEEXT => $am_exeext);
+ handle_per_suffix_test ($test_suffix,
+ OBJ => '',
+ BASE => '$*',
+ SOURCE => '$<');
}
}
$clean_files{'$(TEST_LOGS)'} = MOSTLY_CLEAN;
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# parallel-tests:
+# - check2.am and interaction with $(EXEEXT)
+
+parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+dnl We need to fool the init.m4 internals a little.
+AC_DEFUN([_AM_FOO],
+ [m4_provide([_AM_COMPILER_EXEEXT])
+ AC_SUBST([CC], [false])
+ AC_SUBST([EXEEXT])])
+_AM_FOO
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TESTS = x y a.test b.test
+LOG_COMPILER = true
+TEST_LOG_COMPILER = true
+## We also need to fool the automake internals a little.
+EXTRA_PROGRAMS = y
+y_SOURCES =
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+$EGREP 'EXEEXT|\.log|\.test' Makefile.in # For debugging.
+
+./configure EXEEXT=
+touch x y a.test b.test
+$MAKE check
+
+$MAKE distclean
+rm -f x y a.test b.test *.log *.trs
+
+./configure EXEEXT=.bin
+touch x y.bin a.test b.test.bin
+$MAKE check
+ls -l # For debugging.
+test -f y.log
+test ! -r y.bin.log
+test -f b.log
+test ! -r b.test.log
+
+$EGREP '^y\.log: y(\$\(EXEEXT\)|\.bin)' Makefile
+$EGREP '^\.test(\$\(EXEEXT\)|\.bin)\.log:' Makefile
+
+: