2012-10-29 07:05:21 +00:00
|
|
|
# -*-perl-*-
|
|
|
|
$description = "Test the load operator.";
|
|
|
|
|
|
|
|
$details = "Test dynamic loading of modules.";
|
|
|
|
|
|
|
|
# Don't do anything if this system doesn't support "load"
|
|
|
|
exists $FEATURES{load} or return -1;
|
|
|
|
|
Remove unsupported build facilities.
Over time the non-standard build and install systems (nmake files,
smake files, Visual Studio project files, etc.) have atrophied and
maintaining them is not worth the effort, for such a simple utility
as make. Remove all the non-standard build tool support and unify
OS-specific build rules under a basic set of (GNU make) makefiles.
Preserve the existing bootstrapping scripts (for POSIX, Windows,
and MS-DOS). Also the existing VMS build scripts are left unchanged:
I don't have enough experience with VMS to venture into this area.
Perhaps one of the VMS maintainers might like to determine whether
conversion would be appropriate.
Rather than create libraries for w32 and glob (non-POSIX), simply
link the object files directly to remove the complexity.
* NEWS: Update with user-facing notes.
* Makefile.am: Clean up to use the latest automake best practices.
Build Windows code directly from the root makefile to avoid recursion.
* README.Amiga, README.DOS.template, README.W32.template: Updated.
* INSTALL: Point readers at the README.git file.
* maintMakefile: Remove obsolete files. Create Basic.mk file.
* Basic.mk.template, mk/*.mk: Create basic GNU make-based makefiles.
* build_w32.bat: Copy Basic.mk to Makefile
* configure.ac: We no longer need AM_PROG_AR.
* dosbuild.bat: Rename to builddos.bat. Incorporate configure.bat.
* Makefile.DOS.template: Remove.
* NMakefile.template, w32/subproc/NMakefile: Remove.
* SMakefile.template, glob/SMakefile, glob/SCOPTIONS, make.lnk: Remove.
* configure.bat, glob/configure.bat: Remove.
* w32/Makefile.am: Remove.
* make_msvc_net2003.sln, make_msvc_net2003.vcproj: Remove.
2017-11-12 22:44:38 +00:00
|
|
|
# CONFIG_FLAGS are loaded from config-flags.pm and set by configure
|
|
|
|
if (! exists $CONFIG_FLAGS{CC}) {
|
|
|
|
$verbose and print "Skipping load test: no CC defined\n";
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2012-10-29 07:05:21 +00:00
|
|
|
# First build a shared object
|
|
|
|
# Provide both a default and non-default load symbol
|
|
|
|
|
|
|
|
unlink(qw(testload.c testload.so));
|
|
|
|
|
|
|
|
open(my $F, '> testload.c') or die "open: testload.c: $!\n";
|
|
|
|
print $F <<'EOF' ;
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2013-02-25 06:38:36 +00:00
|
|
|
#include "gnumake.h"
|
2012-10-29 07:05:21 +00:00
|
|
|
|
2013-05-15 02:53:42 +00:00
|
|
|
int plugin_is_GPL_compatible;
|
|
|
|
|
2012-10-29 07:05:21 +00:00
|
|
|
int
|
2013-05-03 13:09:12 +00:00
|
|
|
testload_gmk_setup (gmk_floc *pos)
|
2012-10-29 07:05:21 +00:00
|
|
|
{
|
2014-09-30 13:31:39 +00:00
|
|
|
(void)pos;
|
2013-02-25 06:38:36 +00:00
|
|
|
gmk_eval ("TESTLOAD = implicit", 0);
|
2012-10-29 07:05:21 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2013-05-03 13:09:12 +00:00
|
|
|
explicit_setup (gmk_floc *pos)
|
2012-10-29 07:05:21 +00:00
|
|
|
{
|
2014-09-30 13:31:39 +00:00
|
|
|
(void)pos;
|
2013-02-25 06:38:36 +00:00
|
|
|
gmk_eval ("TESTLOAD = explicit", 0);
|
2012-10-29 07:05:21 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
close($F) or die "close: testload.c: $!\n";
|
|
|
|
|
2013-02-25 06:38:36 +00:00
|
|
|
# Make sure we can compile
|
2013-10-19 19:39:15 +00:00
|
|
|
|
Rework directory structure to use GNU-recommended "src" directory.
Move the source code (other than glob) into the "src" subdirectory.
Update all scripting and recommendations to support this change.
* *.c, *.h, w32/*: Move to src/
* configure.ac, Makefile.am, maintMakefile: Locate new source files.
* Basic.mk.template, mk/*: Update for new source file locations.
* NEWS, README.DOS.template: Update for new locations.
* build.template, build_w32.bat, builddos.bat: Ditto.
* po/POTFILES.in: Ditto
* tests/run_make_tests.pl, tests/scripts/features/load*: Ditto.
* make.1: Move to doc.
* mk/VMS.mk: Add support for building on VMS (hopefully).
* makefile.vms, prepare_w32.bat: Remove.
* SCOPTIONS: Update to define HAVE_CONFIG_H
2017-11-19 18:49:26 +00:00
|
|
|
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";
|
2013-10-19 19:39:15 +00:00
|
|
|
|
|
|
|
my $clog = `$sobuild 2>&1`;
|
|
|
|
if ($? != 0) {
|
|
|
|
$verbose and print "Failed to build testload.so:\n$sobuild\n$_";
|
|
|
|
return -1;
|
|
|
|
}
|
2012-10-29 07:05:21 +00:00
|
|
|
|
|
|
|
# TEST 1
|
|
|
|
run_make_test(q!
|
2013-02-25 06:38:36 +00:00
|
|
|
PRE := $(.LOADED)
|
2013-01-20 05:55:57 +00:00
|
|
|
load testload.so
|
2013-02-25 06:38:36 +00:00
|
|
|
POST := $(.LOADED)
|
|
|
|
all: ; @echo pre=$(PRE) post=$(POST) $(TESTLOAD)
|
2012-10-29 07:05:21 +00:00
|
|
|
!,
|
2016-03-13 07:02:00 +00:00
|
|
|
'--warn-undefined-variables', "pre= post=testload.so implicit\n");
|
2012-10-29 07:05:21 +00:00
|
|
|
|
|
|
|
# TEST 2
|
2013-02-25 06:38:36 +00:00
|
|
|
# Load using an explicit function
|
2012-10-29 07:05:21 +00:00
|
|
|
run_make_test(q!
|
2013-02-25 06:38:36 +00:00
|
|
|
PRE := $(.LOADED)
|
2012-10-29 07:05:21 +00:00
|
|
|
load ./testload.so(explicit_setup)
|
2013-02-25 06:38:36 +00:00
|
|
|
POST := $(.LOADED)
|
|
|
|
all: ; @echo pre=$(PRE) post=$(POST) $(TESTLOAD)
|
2012-10-29 07:05:21 +00:00
|
|
|
!,
|
2013-02-25 06:38:36 +00:00
|
|
|
'', "pre= post=testload.so explicit\n");
|
2012-10-29 07:05:21 +00:00
|
|
|
|
|
|
|
# TEST 4
|
|
|
|
# Check multiple loads
|
|
|
|
run_make_test(q!
|
2013-02-25 06:38:36 +00:00
|
|
|
PRE := $(.LOADED)
|
2012-10-29 07:05:21 +00:00
|
|
|
load ./testload.so
|
2013-01-20 05:55:57 +00:00
|
|
|
load testload.so(explicit_setup)
|
2013-02-25 06:38:36 +00:00
|
|
|
POST := $(.LOADED)
|
|
|
|
all: ; @echo pre=$(PRE) post=$(POST) $(TESTLOAD)
|
2013-01-20 05:55:57 +00:00
|
|
|
!,
|
2013-02-25 06:38:36 +00:00
|
|
|
'', "pre= post=testload.so implicit\n");
|
2013-01-20 05:55:57 +00:00
|
|
|
|
|
|
|
# TEST 5
|
|
|
|
# Check auto-rebuild of loaded file that's out of date
|
|
|
|
utouch(-10, 'testload.so');
|
|
|
|
touch('testload.c');
|
|
|
|
|
|
|
|
run_make_test(q!
|
2013-02-25 06:38:36 +00:00
|
|
|
PRE := $(.LOADED)
|
2013-01-20 05:55:57 +00:00
|
|
|
load ./testload.so
|
2013-02-25 06:38:36 +00:00
|
|
|
POST := $(.LOADED)
|
|
|
|
all: ; @echo pre=$(PRE) post=$(POST) $(TESTLOAD)
|
|
|
|
testload.so: testload.c ; @echo "rebuilding $@"; !.$sobuild,
|
|
|
|
'', "rebuilding testload.so\npre= post=testload.so implicit\n");
|
2013-01-20 05:55:57 +00:00
|
|
|
|
|
|
|
# TEST 5
|
|
|
|
# Check auto-rebuild of loaded file when it doesn't exist
|
|
|
|
unlink('testload.so');
|
|
|
|
|
|
|
|
run_make_test(q!
|
2013-02-25 06:38:36 +00:00
|
|
|
PRE := $(.LOADED)
|
2013-01-20 05:55:57 +00:00
|
|
|
-load ./testload.so(explicit_setup)
|
2013-02-25 06:38:36 +00:00
|
|
|
POST := $(.LOADED)
|
|
|
|
all: ; @echo pre=$(PRE) post=$(POST) $(TESTLOAD)
|
|
|
|
%.so: %.c ; @echo "rebuilding $@"; !.$sobuild,
|
|
|
|
'', "rebuilding testload.so\npre= post=testload.so explicit\n");
|
2012-10-29 07:05:21 +00:00
|
|
|
|
|
|
|
unlink(qw(testload.c testload.so)) unless $keep;
|
|
|
|
|
|
|
|
# This tells the test driver that the perl test script executed properly.
|
|
|
|
1;
|