From b70aa3709e126953faeeec3f666885f9796eea14 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Sun, 20 Jan 2013 00:55:57 -0500 Subject: Allow dynamically loaded objects to be rebuilt by make. --- tests/scripts/features/load | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) (limited to 'tests/scripts') 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; -- cgit v1.2.3