summaryrefslogtreecommitdiff
path: root/tests/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'tests/scripts')
-rw-r--r--tests/scripts/features/reinvoke15
-rw-r--r--tests/scripts/features/vpathgpath6
-rw-r--r--tests/scripts/features/vpathplus21
-rw-r--r--tests/scripts/misc/general431
-rw-r--r--tests/scripts/misc/version35
-rw-r--r--tests/scripts/options/dash-n10
-rw-r--r--tests/scripts/options/dash-t38
-rw-r--r--tests/scripts/targets/INTERMEDIATE8
-rw-r--r--tests/scripts/targets/SECONDARY6
9 files changed, 98 insertions, 72 deletions
diff --git a/tests/scripts/features/reinvoke b/tests/scripts/features/reinvoke
index 3e9ae66..a5a475c 100644
--- a/tests/scripts/features/reinvoke
+++ b/tests/scripts/features/reinvoke
@@ -18,7 +18,6 @@ all: ; \@echo 'running rules.'
$makefile $makefile2: $makefile_orig
\@echo 'rebuilding \$\@.'
- \@sleep $wtime
\@echo >> \$\@
include $makefile2
@@ -27,13 +26,8 @@ EOM
close(MAKEFILE);
-&touch($makefile2);
-
-# Sleep 2 seconds for DOS/Windows FAT volumes which have 2-second
-# granularity of file times.
-sleep($wtime);
-
-&touch("$makefile_orig");
+&utouch(-10, $makefile, $makefile2);
+&touch($makefile_orig);
&run_make_with_options($makefile, "", &get_logfile, 0);
@@ -66,9 +60,8 @@ EOM
close(MAKEFILE);
-&touch('b');
-&touch('a');
-sleep($wtime);
+&utouch(-20, 'b','a');
+#&utouch(-10, 'a');
&touch('c');
# First try with the file that's not updated "once removed" from the
diff --git a/tests/scripts/features/vpathgpath b/tests/scripts/features/vpathgpath
index 581d16d..f7683f5 100644
--- a/tests/scripts/features/vpathgpath
+++ b/tests/scripts/features/vpathgpath
@@ -38,12 +38,14 @@ close(MAKEFILE);
@touchedfiles = ();
+$off = -500;
+
sub touchfiles {
foreach (@_) {
($f = $_) =~ s,VP/,$VP,g;
- &touch($f);
+ &utouch($off, $f);
+ $off += 10;
push(@touchedfiles, $f);
- sleep(1);
}
}
diff --git a/tests/scripts/features/vpathplus b/tests/scripts/features/vpathplus
index 76312b3..a37fbed 100644
--- a/tests/scripts/features/vpathplus
+++ b/tests/scripts/features/vpathplus
@@ -55,18 +55,19 @@ close(MAKEFILE);
@touchedfiles = ();
+$off = -500;
+
sub touchfiles {
foreach (@_) {
- sleep($wtime);
- ($f = $_) =~ s,VP/,$VP,g;
- &touch($f);
- push(@touchedfiles, $f);
+ &utouch($off, $_);
+ $off += 10;
+ push(@touchedfiles, $_);
}
}
# Run the general-case test
-&touchfiles("VP/foo.d", "VP/bar.d", "VP/foo.c", "VP/bar.c", "foo.b", "bar.d");
+&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);
@@ -79,7 +80,7 @@ cat ${VP}foo.c bar.c > foo.b 2>/dev/null || exit 1
# Test rules that don't make the target correctly
-&touchfiles("VP/notarget.c", "notarget.b", "notarget.d");
+&touchfiles("$VP/notarget.c", "notarget.b", "notarget.d");
&run_make_with_options($makefile,"notarget",&get_logfile,512);
@@ -92,7 +93,7 @@ $make_name: *** [notarget.b] Error 1
# Test intermediate file handling (part 1)
-&touchfiles("VP/inter.d");
+&touchfiles("$VP/inter.d");
&run_make_with_options($makefile,"intermediate",&get_logfile);
@@ -107,7 +108,11 @@ rm inter.b inter.c
# Test intermediate file handling (part 2)
-&touchfiles("VP/inter.b", "VP/inter.d");
+&utouch(-20, "inter.a");
+&utouch(-10, "$VP/inter.b");
+&touch("$VP/inter.d");
+
+push(@touchedfiles, "$VP/inter.b", "$VP/inter.d");
&run_make_with_options($makefile,"intermediate",&get_logfile);
diff --git a/tests/scripts/misc/general4 b/tests/scripts/misc/general4
new file mode 100644
index 0000000..dd77f53
--- /dev/null
+++ b/tests/scripts/misc/general4
@@ -0,0 +1,31 @@
+# -*-perl-*-
+
+$description = "\
+This tests random features of make's algorithms, often somewhat obscure,
+which have either broken at some point in the past or seem likely to
+break.";
+
+open(MAKEFILE,"> $makefile");
+
+# The contents of the Makefile ...
+
+print MAKEFILE <<'EOF';
+# Make sure that subdirectories built as prerequisites are actually handled
+# properly.
+
+all: dir/subdir/file.a
+
+dir/subdir: ; @echo mkdir -p dir/subdir
+
+dir/subdir/file.b: dir/subdir ; @echo touch dir/subdir/file.b
+
+dir/subdir/%.a: dir/subdir/%.b ; @echo cp $< $@
+EOF
+
+close(MAKEFILE);
+
+&run_make_with_options($makefile,"",&get_logfile);
+$answer = "mkdir -p dir/subdir\ntouch dir/subdir/file.b\ncp dir/subdir/file.b dir/subdir/file.a\n";
+&compare_output($answer,&get_logfile(1));
+
+1;
diff --git a/tests/scripts/misc/version b/tests/scripts/misc/version
deleted file mode 100644
index d49b153..0000000
--- a/tests/scripts/misc/version
+++ /dev/null
@@ -1,35 +0,0 @@
-$description = "The following test creates a makefile to ... \n";
-
-$details = "Fill in Later\n";
-
-open(MAKEFILE,"> $makefile");
-
-# The Contents of the MAKEFILE ...
-
-print MAKEFILE "all: \n";
-
-# END of Contents of MAKEFILE
-
-close(MAKEFILE);
-
-&run_make_with_options($makefile,"-v",&get_logfile,0);
-
-# This tells the test driver that the perl test script executed properly.
-1;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/scripts/options/dash-n b/tests/scripts/options/dash-n
index 35f317d..de19f42 100644
--- a/tests/scripts/options/dash-n
+++ b/tests/scripts/options/dash-n
@@ -49,14 +49,8 @@ EOF
close(MAKEFILE);
-&touch('b');
-# Sometimes, on my Solaris 2.5.1 box with a NetApp filesystem NFS-mounted,
-# just touching b first then a isn't good enough: the nsec field in the
-# stat result shows b is _newer_ than a once every 5 or 6 tries!!! I've
-# no idea what this is about, but that's why there's a sleep(1) here...
-sleep(1);
-&touch('a');
-sleep(1);
+&utouch(-20, 'b');
+&utouch(-10, 'a');
&touch('c');
# TEST 2
diff --git a/tests/scripts/options/dash-t b/tests/scripts/options/dash-t
new file mode 100644
index 0000000..8192fbf
--- /dev/null
+++ b/tests/scripts/options/dash-t
@@ -0,0 +1,38 @@
+# -*-perl-*-
+
+$description = "Test the -t option.\n";
+
+$details = "Look out for regressions of prior bugs related to -t.\n";
+# That means, nobody has even tried to make the tests below comprehensive
+
+# TEST 0
+# bug reported by Henning Makholm <henning@makholm.net> on 2001-11-03:
+# make 3.79.1 touches only interm-[ab] but reports final-[a] as
+# 'up to date' without touching them.
+# The 'obvious' fix didn't work for double-colon rules, so pay special
+# attention to them.
+
+open(MAKEFILE, "> $makefile");
+print MAKEFILE <<'EOMAKE';
+final-a: interm-a ; echo >> $@
+final-b: interm-b ; echo >> $@
+interm-a:: orig1-a ; echo >> $@
+interm-a:: orig2-a ; echo >> $@
+interm-b:: orig1-b ; echo >> $@
+interm-b:: orig2-b ; echo >> $@
+EOMAKE
+close(MAKEFILE);
+
+&utouch(-30, 'orig1-a','orig2-b');
+&utouch(-20, 'interm-a','interm-b');
+&utouch(-10, 'final-a','final-b');
+&touch('orig2-a','orig1-b');
+
+&run_make_with_options($makefile, "-t final-a final-b", &get_logfile);
+$answer = "touch interm-a\ntouch final-a\ntouch interm-b\ntouch final-b\n";
+&compare_output($answer, &get_logfile(1));
+
+unlink('orig1-a', 'orig2-a', 'interm-a', 'final-a');
+unlink('orig1-b', 'orig2-b', 'interm-b', 'final-b');
+
+1;
diff --git a/tests/scripts/targets/INTERMEDIATE b/tests/scripts/targets/INTERMEDIATE
index 725ab0e..4fdd7a2 100644
--- a/tests/scripts/targets/INTERMEDIATE
+++ b/tests/scripts/targets/INTERMEDIATE
@@ -33,9 +33,7 @@ close(MAKEFILE);
# TEST #0
-&touch('foo.f');
-&touch('bar.f');
-sleep($wtime);
+&utouch(-20, 'foo.f', 'bar.f');
&run_make_with_options($makefile,'foo.d',&get_logfile);
$answer = "cp foo.f foo.e\ncp foo.e foo.d\nrm foo.e\n";
@@ -49,7 +47,7 @@ $answer = "$make_name: `foo.d' is up to date.\n";
# TEST #2
-sleep($wtime);
+&utouch(-10, 'foo.d');
&touch('foo.f');
&run_make_with_options($makefile,'foo.d',&get_logfile);
@@ -70,7 +68,7 @@ $answer = "$make_name: `foo.c' is up to date.\n";
# TEST #5
-sleep($wtime);
+&utouch(-10, 'foo.c');
&touch('foo.f');
&run_make_with_options($makefile,'foo.c',&get_logfile);
diff --git a/tests/scripts/targets/SECONDARY b/tests/scripts/targets/SECONDARY
index 3ae34fd..5a60ed2 100644
--- a/tests/scripts/targets/SECONDARY
+++ b/tests/scripts/targets/SECONDARY
@@ -33,7 +33,7 @@ close(MAKEFILE);
# TEST #1
-&touch('foo.f');
+&utouch(-20, 'foo.f');
&run_make_with_options($makefile,'foo.d',&get_logfile);
$answer = "cp foo.f foo.e\ncp foo.e foo.d\n";
@@ -49,7 +49,7 @@ $answer = "$make_name: `foo.d' is up to date.\n";
# TEST #3
-sleep($wtime);
+&utouch(-10, 'foo.d');
&touch('foo.f');
&run_make_with_options($makefile,'foo.d',&get_logfile);
@@ -72,7 +72,7 @@ $answer = "$make_name: `foo.c' is up to date.\n";
# TEST #6
-sleep($wtime);
+&utouch(-10, 'foo.c');
&touch('foo.f');
&run_make_with_options($makefile,'foo.c',&get_logfile);