summaryrefslogtreecommitdiff
path: root/src/kmk/tests/scripts/features/patternrules
diff options
context:
space:
mode:
Diffstat (limited to 'src/kmk/tests/scripts/features/patternrules')
-rw-r--r--src/kmk/tests/scripts/features/patternrules85
1 files changed, 80 insertions, 5 deletions
diff --git a/src/kmk/tests/scripts/features/patternrules b/src/kmk/tests/scripts/features/patternrules
index 44355dc..e123954 100644
--- a/src/kmk/tests/scripts/features/patternrules
+++ b/src/kmk/tests/scripts/features/patternrules
@@ -15,11 +15,13 @@ $dir =~ s,.*/([^/]+)$,../$1,;
# to match properly.
#
-run_make_test('
+run_make_test(q!
.PHONY: all
all: case.1 case.2 case.3
-a: void
+
+# We can't have this, due to "Implicit Rule Search Algorithm" step 5c
+#xxx: void
# 1 - existing file
%.1: void
@@ -41,9 +43,7 @@ a: void
@exit 0
3.implicit-phony:
-',
-'',
-'');
+!, '', '');
# TEST #1: make sure files that are built via implicit rules are marked
# as targets (Savannah bug #12202).
@@ -149,5 +149,80 @@ echo foo.c foo.h >foo.o');
unlink('foo.in', 'foo.h', 'foo.c', 'foo.o');
+# TEST #5: make sure both prefix and suffix patterns work with multiple
+# target patterns (Savannah bug #26593).
+#
+run_make_test('
+all: foo.s1 foo.s2 p1.foo p2.foo
+
+p1.% p2.%: %.orig
+ @echo $@
+%.s1 %.s2: %.orig
+ @echo $@
+
+.PHONY: foo.orig
+',
+ '', "foo.s1\np1.foo\n");
+
+# TEST 6: Make sure that non-target files are still eligible to be created
+# as part of implicit rule chaining. Savannah bug #17752.
+
+run_make_test(q!
+BIN = xyz
+COPY = $(BIN).cp
+SRC = $(BIN).c
+allbroken: $(COPY) $(BIN) ; @echo ok
+$(SRC): ; @echo 'main(){}' > $@
+%.cp: % ; @cp $< $@
+% : %.c ; @cp $< $@
+clean: ; @rm -rf $(SRC) $(COPY) $(BIN)
+!,
+ '', "ok\n");
+
+unlink(qw(xyz xyz.cp xyz.c));
+
+# TEST 7: Make sure that all prereqs of all "also_make" targets get created
+# before any of the things that depend on any of them. Savannah bug #19108.
+
+run_make_test(q!
+final: x ; @echo $@
+x: x.t1 x.t2 ; @echo $@
+x.t2: dep
+dep: ; @echo $@
+%.t1 %.t2: ; @echo $*.t1 ; echo $*.t2
+!,
+ '', "dep\nx.t1\nx.t2\nx\nfinal\n");
+
+
+# TEST 8: Verify we can remove pattern rules. Savannah bug #18622.
+
+my @f = (qw(foo.w foo.ch));
+touch(@f);
+
+run_make_test(q!
+CWEAVE := :
+
+# Disable builtin rules
+%.tex : %.w
+%.tex : %.w %.ch
+!,
+ 'foo.tex',
+ "#MAKE#: *** No rule to make target `foo.tex'. Stop.", 512);
+
+unlink(@f);
+
+# TEST #9: Test shortest stem selection in pattern rules.
+
+run_make_test('
+%.x: ;@echo one
+%-mt.x: ;@echo two
+
+all: foo.x foo-mt.x
+',
+'',
+"one\ntwo");
+
+1;
+
# This tells the test driver that the perl test script executed properly.
1;