aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2022-11-03 15:49:11 +0000
committerRon Yorston <rmy@pobox.com>2022-11-03 15:52:48 +0000
commit5f64589b84a7349316a04cdbe607a5824459b731 (patch)
treedae9145ccae5e67012ab172789f9bcb099db40dd /testsuite
parent0aceca8673c1d9a8bc34faa460389768efa08eb7 (diff)
downloadbusybox-w32-5f64589b84a7349316a04cdbe607a5824459b731.tar.gz
busybox-w32-5f64589b84a7349316a04cdbe607a5824459b731.tar.bz2
busybox-w32-5f64589b84a7349316a04cdbe607a5824459b731.zip
make: fixes to inference rules
Austin Group defect report 875 clarifies some aspects of inference rules. The crux of the issue is related to chained inference rules so it doesn't affect POSIX mode. The test makefile looks like this: .SUFFIXES: .a .b .c .a.c: @echo .a.c .b.c: @echo .b.c test.c: test.b test.a: test.b: The correct output is deemed to be '.a.c'. Additional complications are: - whether or not the prerequisite files are present; - the use of the suffixes '.a' and '.c' may result in the builtin inference rule '.c.a' being considered. In favourable circumstances pdpmake managed to give the correct result, in unfavourable it reported circular dependencies or segfaulted. Changes to fix these issues are: - When prerequisites are being recursively built the standard says: 'Upon recursion, each prerequisite shall become a target itself.' Follow this requirement. - At the end of make() the target being built should have its time (as represented by n_tim in struct name) updated when any action has been taken. - When dyndep() is looking for prerequisites it should: * skip candidates that are in the process of being built; * consider whether an explicit candidate is a target, not whether it has any commands associated with it. pdpmake now behaves similarly to GNU make when presented with makefiles like the above. bmake gives the incorrect output '.b.c'.
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/make.tests39
1 files changed, 39 insertions, 0 deletions
diff --git a/testsuite/make.tests b/testsuite/make.tests
index f52770438..7bb736ade 100755
--- a/testsuite/make.tests
+++ b/testsuite/make.tests
@@ -397,6 +397,45 @@ target:
397 : hash # hash 397 : hash # hash
398' 398'
399 399
400# Austin Group defect report 875 clarifies certain aspects of the
401# behaviour of inference rules. Study of this resulted in a number
402# of changes to pdpmake. Since the issue at hand involves the use
403# of chained inference rules it doesn't affect POSIX mode.
404mkdir make.tempdir && cd make.tempdir || exit 1
405touch test.j test.k
406testing "make proper handling of inference rules 1" \
407 "make -f -" \
408 ".j.l\n" "" '
409.SUFFIXES: .j .k .l
410.j.l:
411 @echo .j.l
412.k.l:
413 @echo .k.l
414test.l: test.k
415test.j:
416test.k:
417'
418cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
419
420# The actual test in the above-mentioned defect report was actually
421# more demanding. It used the suffixes '.a .b .c'. This results in
422# the built-in '.c.a' inference rule being introduced into the mix.
423mkdir make.tempdir && cd make.tempdir || exit 1
424touch test.a test.b
425testing "make proper handling of inference rules 2" \
426 "make -f -" \
427 ".a.c\n" "" '
428.SUFFIXES: .a .b .c
429.a.c:
430 @echo .a.c
431.b.c:
432 @echo .b.c
433test.c: test.b
434test.a:
435test.b:
436'
437cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
438
400# Skip duplicate entries in $? and $^ 439# Skip duplicate entries in $? and $^
401mkdir make.tempdir && cd make.tempdir || exit 1 440mkdir make.tempdir && cd make.tempdir || exit 1
402touch -t 202206171200 file1 file3 441touch -t 202206171200 file1 file3