tests: Convert %CONFIG_FLAGS to get_config()

* tests/config-flags.pm.W32: Create a predefined Windows file.
* Makefile.am (test_FILES): Add it to the distribution.
* build_w32.bat: Install tests/config-flags.pm if not existing.
* tests/run_make_tests.pl (get_config): Create new function.
* tests/scripts/features/archives: Call get_config() rather than
using %CONFIG_FLAGS directly.
* tests/scripts/features/load: Ditto.
* tests/scripts/features/loadapi: Ditto.
* tests/scripts/functions/wildcard: Ditto.
This commit is contained in:
Paul Smith 2019-10-05 14:26:52 -04:00
parent bd7d03f8cd
commit 393d2a2d4a
8 changed files with 32 additions and 14 deletions

View file

@ -94,6 +94,7 @@ m4_FILES = m4/gnulib-cache.m4
test_FILES = tests/run_make_tests tests/run_make_tests.bat \
tests/run_make_tests.pl tests/test_driver.pl \
tests/config-flags.pm.in tests/config_flags_pm.com \
tests/config-flags.pm.W32 \
tests/mkshadow tests/jhelp.pl tests/guile.supp tests/README
# test/scripts are added via dist-hook below.

View file

@ -258,6 +258,7 @@ exit 1
:Success
echo %OUTDIR% build succeeded.
if exist Basic.mk copy /Y Basic.mk Makefile
if not exist tests\config-flags.pm copy /Y tests\config-flags.pm.W32 tests\config-flags.pm
call :Reset
goto :EOF

View file

@ -0,0 +1,9 @@
# This is a -*-perl-*- script
#
# Set variables for Windows systems.
%CONFIG_FLAGS = (
USE_SYSTEM_GLOB => 'no'
);
1;

View file

@ -483,10 +483,14 @@ sub find_prog
return ($v, $d, $f);
}
sub get_config
{
return exists($CONFIG_FLAGS{$_[0]}) ? $CONFIG_FLAGS{$_[0]} : '';
}
sub set_more_defaults
{
local($string);
local($index);
my $string;
# Now that we have located make_path, locate the srcdir and blddir
my ($mpv, $mpd, $mpf) = find_prog($make_path);

View file

@ -29,11 +29,8 @@ if ($osname eq 'VMS') {
utouch(-60, qw(a1.o a2.o a3.o));
}
my $ar = $CONFIG_FLAGS{AR};
# Fallback if configure did not find AR, such as VMS
# which does not run configure.
$ar = 'ar' if $ar eq '';
# Fallback if configure did not find AR
my $ar = get_config('AR') || 'ar';
my $redir = '2>&1';
$redir = '' if $osname eq 'VMS';

View file

@ -6,8 +6,8 @@ $details = "Test dynamic loading of modules.";
# Don't do anything if this system doesn't support "load"
exists $FEATURES{load} or return -1;
# CONFIG_FLAGS are loaded from config-flags.pm and set by configure
if (! exists $CONFIG_FLAGS{CC}) {
my $cc = get_config('CC');
if (! $cc) {
$verbose and print "Skipping load test: no CC defined\n";
return -1;
}
@ -46,7 +46,10 @@ close($F) or die "close: testload.c: $!\n";
# Make sure we can compile
my $sobuild = "$CONFIG_FLAGS{CC} ".($srcdir? "-I$srcdir/src":'')." $CONFIG_FLAGS{CPPFLAGS} $CONFIG_FLAGS{CFLAGS} -shared -fPIC $CONFIG_FLAGS{LDFLAGS} -o testload.so testload.c";
my $cflags = get_config('CFLAGS');
my $cppflags = get_config('CPPFLAGS');
my $ldflags = get_config('LDFLAGS');
my $sobuild = "$cc ".($srcdir? "-I$srcdir/src":'')." $cppflags $cflags -shared -fPIC $ldflags -o testload.so testload.c";
my $clog = `$sobuild 2>&1`;
if ($? != 0) {

View file

@ -6,8 +6,8 @@ $details = "Verify the different aspects of the shared object API.";
# Don't do anything if this system doesn't support "load"
exists $FEATURES{load} or return -1;
# CONFIG_FLAGS are loaded from config-flags.pm and set by configure
if (! exists $CONFIG_FLAGS{CC}) {
my $cc = get_config('CC');
if (! $cc) {
$verbose and print "Skipping load test: no CC defined\n";
return -1;
}
@ -80,7 +80,10 @@ close($F) or die "close: testapi.c: $!\n";
# Make sure we can compile
my $sobuild = "$CONFIG_FLAGS{CC} ".($srcdir? "-I$srcdir/src":'')." $CONFIG_FLAGS{CPPFLAGS} $CONFIG_FLAGS{CFLAGS} -shared -fPIC $CONFIG_FLAGS{LDFLAGS} -o testapi.so testapi.c";
my $cflags = get_config('CFLAGS');
my $cppflags = get_config('CPPFLAGS');
my $ldflags = get_config('LDFLAGS');
my $sobuild = "$cc ".($srcdir? "-I$srcdir/src":'')." $cppflags $cflags -shared -fPIC $ldflags -o testapi.so testapi.c";
my $clog = `$sobuild 2>&1`;
if ($? != 0) {

View file

@ -145,7 +145,7 @@ if ($port_type ne 'W32' && eval { symlink("",""); 1 }) {
# Test for dangling symlinks
# This doesn't work with the built-in glob... needs to be updated!
if ($CONFIG_FLAGS{USE_SYSTEM_GLOB} eq 'yes') {
if (get_config('USE_SYSTEM_GLOB') eq 'yes') {
symlink($dir, $lnk);
run_make_test(qq!all: ; \@echo \$(wildcard $lnk)!, '', "$lnk");