summaryrefslogtreecommitdiff
path: root/tests/scripts
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2013-01-20 00:55:57 -0500
committerPaul Smith <psmith@gnu.org>2013-01-20 00:55:57 -0500
commitb70aa3709e126953faeeec3f666885f9796eea14 (patch)
tree7be879e8d450b5533b15141f8140e9e96817ca1c /tests/scripts
parent8e0a5645b8ba0077caa0f657e93fca1f7e36a6ac (diff)
downloadgunmake-b70aa3709e126953faeeec3f666885f9796eea14.tar.gz
Allow dynamically loaded objects to be rebuilt by make.
Diffstat (limited to 'tests/scripts')
-rw-r--r--tests/scripts/features/load37
1 files changed, 30 insertions, 7 deletions
diff --git a/tests/scripts/features/load b/tests/scripts/features/load
index 8117bbd..dd3daf8 100644
--- a/tests/scripts/features/load
+++ b/tests/scripts/features/load
@@ -49,7 +49,7 @@ run_make_test('testload.so: testload.c ; @$(CC) -g -shared -fPIC -o $@ $<',
# TEST 1
run_make_test(q!
all: ; @echo $(func-a foo) $(func-b bar)
-load ./testload.so
+load testload.so
!,
'', "func-a\n");
@@ -64,19 +64,42 @@ load ./testload.so(explicit_setup)
# TEST 3
# Verify the .LOADED variable
run_make_test(q!
-all: ; @echo $(filter ./testload.so,$(.LOADED)) $(func-a foo) $(func-b bar)
-load ./testload.so(explicit_setup)
+all: ; @echo $(filter testload.so,$(.LOADED)) $(func-a foo) $(func-b bar)
+load testload.so(explicit_setup)
!,
- '', "./testload.so func-b\n");
+ '', "testload.so func-b\n");
# TEST 4
# Check multiple loads
run_make_test(q!
-all: ; @echo $(filter ./testload.so,$(.LOADED)) $(func-a foo) $(func-b bar)
+all: ; @echo $(filter testload.so,$(.LOADED)) $(func-a foo) $(func-b bar)
load ./testload.so
-load ./testload.so(explicit_setup)
+load testload.so(explicit_setup)
+!,
+ '', "testload.so func-a\n");
+
+# TEST 5
+# Check auto-rebuild of loaded file that's out of date
+utouch(-10, 'testload.so');
+touch('testload.c');
+
+run_make_test(q!
+all: ; @echo $(func-a foo) $(func-b bar)
+load ./testload.so
+testload.so: testload.c ; @echo "rebuilding $@"; $(CC) -g -shared -fPIC -o $@ $<
+!,
+ '', "rebuilding testload.so\nfunc-a\n");
+
+# TEST 5
+# Check auto-rebuild of loaded file when it doesn't exist
+unlink('testload.so');
+
+run_make_test(q!
+all: ; @echo $(func-a foo) $(func-b bar)
+-load ./testload.so(explicit_setup)
+%.so: %.c ; @echo "rebuilding $@"; $(CC) -g -shared -fPIC -o $@ $<
!,
- '', "./testload.so func-a\n");
+ '', "rebuilding testload.so\nfunc-b\n");
unlink(qw(testload.c testload.so)) unless $keep;