summaryrefslogtreecommitdiff
path: root/tests/scripts/features/vpathplus
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>1999-09-14 02:03:19 +0000
committerPaul Smith <psmith@gnu.org>1999-09-14 02:03:19 +0000
commit0d366b668244112846554c42045ff1d9956276ed (patch)
tree3802242fe18a5e90d889f5d1ac66fb487361888b /tests/scripts/features/vpathplus
parent4121dea6a59367b4431cbe7a3c43d74fec9fd832 (diff)
downloadgunmake-0d366b668244112846554c42045ff1d9956276ed.tar.gz
* Added the test suite to the main distribution.
Diffstat (limited to 'tests/scripts/features/vpathplus')
-rw-r--r--tests/scripts/features/vpathplus125
1 files changed, 125 insertions, 0 deletions
diff --git a/tests/scripts/features/vpathplus b/tests/scripts/features/vpathplus
new file mode 100644
index 0000000..6c9a2a0
--- /dev/null
+++ b/tests/scripts/features/vpathplus
@@ -0,0 +1,125 @@
+# -*-perl-*-
+$description = "Tests the new VPATH+ functionality added in 3.76.";
+
+$details = "";
+
+$VP = "$workdir$pathsep";
+
+open(MAKEFILE,"> $makefile");
+
+# The Contents of the MAKEFILE ...
+
+print MAKEFILE "VPATH = $VP\n";
+
+print MAKEFILE <<'EOMAKE';
+
+SHELL = /bin/sh
+
+.SUFFIXES: .a .b .c .d
+.PHONY: general rename notarget intermediate
+
+%.a:
+%.b:
+%.c:
+%.d:
+
+%.a : %.b
+ cat $^ > $@
+%.b : %.c
+ cat $^ > $@ 2>/dev/null || exit 1
+%.c :: %.d
+ cat $^ > $@
+
+# General testing info:
+
+general: foo.b
+foo.b: foo.c bar.c
+
+# Rename testing info:
+
+rename: $(VPATH)/foo.c foo.d
+
+# Target not made testing info:
+
+notarget: notarget.b
+notarget.c: notarget.d
+ -@echo "not creating $@ from $^"
+
+# Intermediate files:
+
+intermediate: inter.a
+
+EOMAKE
+
+close(MAKEFILE);
+
+@touchedfiles = ();
+
+sub touchfiles {
+ foreach (@_) {
+ ($f = $_) =~ s,VP/,$VP,g;
+ &touch($f);
+ push(@touchedfiles, $f);
+ # Sleep 2 seconds for DOS/Windows FAT volumes which have 2-second
+ # granularity of file times.
+ sleep(2);
+ }
+}
+
+# Run the general-case test
+
+&touchfiles("VP/foo.d", "VP/bar.d", "VP/foo.c", "VP/bar.c", "foo.b", "bar.d");
+
+&run_make_with_options($makefile,"general",&get_logfile);
+
+push(@touchedfiles, "bar.c");
+
+$answer = "cat bar.d > bar.c
+cat ${VP}foo.c bar.c > foo.b 2>/dev/null || exit 1
+";
+&compare_output($answer,&get_logfile(1));
+
+# Test rules that don't make the target correctly
+
+&touchfiles("VP/notarget.c", "notarget.b", "notarget.d");
+
+&run_make_with_options($makefile,"notarget",&get_logfile,512);
+
+$answer = "not creating notarget.c from notarget.d
+cat notarget.c > notarget.b 2>/dev/null || exit 1
+$make_name: *** [notarget.b] Error 1
+";
+
+&compare_output($answer,&get_logfile(1));
+
+# Test intermediate file handling (part 1)
+
+&touchfiles("VP/inter.d");
+
+&run_make_with_options($makefile,"intermediate",&get_logfile);
+
+push(@touchedfiles, "inter.a", "inter.b");
+
+$answer = "cat ${VP}inter.d > inter.c
+cat inter.c > inter.b 2>/dev/null || exit 1
+cat inter.b > inter.a
+rm inter.b inter.c
+";
+&compare_output($answer,&get_logfile(1));
+
+# Test intermediate file handling (part 2)
+
+&touchfiles("VP/inter.b", "VP/inter.d");
+
+&run_make_with_options($makefile,"intermediate",&get_logfile);
+
+$answer = "cat ${VP}inter.d > inter.c
+cat inter.c > inter.b 2>/dev/null || exit 1
+cat inter.b > inter.a
+rm inter.c
+";
+&compare_output($answer,&get_logfile(1));
+
+unlink @touchedfiles unless $keep;
+
+1;