summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>1999-09-17 03:15:37 +0000
committerPaul Smith <psmith@gnu.org>1999-09-17 03:15:37 +0000
commita63f51340b540074dd98bfc7201e2221c5671d28 (patch)
tree8bea6f8caac20090a1951ab725bd942f7c9bd4ba /tests
parent45e04a5860476c40b0943e189c9a58f62dca07c8 (diff)
downloadgunmake-a63f51340b540074dd98bfc7201e2221c5671d28.tar.gz
* A few script fixes and updates for 3.78.
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog45
-rwxr-xr-xtests/run_make_tests.pl54
-rw-r--r--tests/scripts/features/default_names6
-rw-r--r--tests/scripts/features/reinvoke12
-rw-r--r--tests/scripts/functions/foreach2
-rw-r--r--tests/scripts/functions/origin11
-rw-r--r--tests/scripts/options/dash-l2
-rw-r--r--tests/scripts/options/dash-n8
-rw-r--r--tests/scripts/variables/MAKECMDGOALS4
-rw-r--r--tests/test_driver.pl24
10 files changed, 119 insertions, 49 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index dd763b1..b40612f 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,14 +1,45 @@
+1999-09-16 Paul D. Smith <psmith@gnu.org>
+
+ * scripts/features/reinvoke: Remove invocations of "touch" in
+ makefiles. See the comments on the touch function rewrite below.
+ Note that UNIX touch behaves the same way if the file already
+ exists: it sets the time to the _local_ time. We don't want
+ this. This is probably a good tip for makefile writers in
+ general, actually... where practical.
+ * scripts/options/dash-l: Ditto.
+ * scripts/options/dash-n: Ditto.
+
+ * test_driver.pl (run_each_test): In retrospect, I don't like the
+ .lN/.bN/.dN postfix required by DOS. So, for non-DOS systems I
+ changed it back to use .log, .base, and .diff.
+
+ * run_make_tests.pl (set_more_defaults): Move the check for the
+ make pathname to here from set_defaults (that's too early since it
+ happens before the command line processing).
+ Create a new variable $port_type, calculated from $osname, to
+ specify what kind of system we're running on. We should integrate
+ the VOS stuff here, too.
+ (valid_option): Comment out the workdir/-work stuff so people
+ won't be fooled into thinking it works... someone needs to fix
+ this, though!
+
+ * scripts/functions/origin: Use $port_type instead of $osname.
+ * scripts/functions/foreach: Ditto.
+ * scripts/features/default_names: Ditto.
+
1999-09-15 Paul D. Smith <psmith@gnu.org>
* test_driver.pl (touch): Rewrite this function. Previously it
used to use utime() to hard-set the time based on the current
- local clock. This fails badly on networked filesystems where the
- FS server clock is skewed from the local clock: normally modifying
- a file causes it to get a mod time based on the _server's_ clock.
- Hard-setting it based on the _local_ clock causes gratuitous
- errors and makes the tests unreliable except on local filesystems.
- The new function will simply modify the file, allowing the
- filesystem to set the mod time as it sees fit.
+ local clock, or, if the file didn't exist, it merely created it.
+ This mirrors exactly what real UNIX touch does, but it fails badly
+ on networked filesystems where the FS server clock is skewed from
+ the local clock: normally modifying a file causes it to get a mod
+ time based on the _server's_ clock. Hard-setting it based on the
+ _local_ clock causes gratuitous errors and makes the tests
+ unreliable except on local filesystems. The new function will
+ simply modify the file, allowing the filesystem to set the mod
+ time as it sees fit.
* scripts/features/parallelism: The second test output could
change depending on how fast some scripts completed; use "sleep"
diff --git a/tests/run_make_tests.pl b/tests/run_make_tests.pl
index 484dbe1..4130b3d 100755
--- a/tests/run_make_tests.pl
+++ b/tests/run_make_tests.pl
@@ -9,7 +9,6 @@
# [-verbose]
# [-keep]
# [-make <make prog>]
-# [-work <work dir>]
# (and others)
require "test_driver.pl";
@@ -27,11 +26,14 @@ sub valid_option
}
return 1;
}
- elsif ($option =~ /^-work([-_]?dir)?$/)
- {
- $workdir = shift @argv;
- return 1;
- }
+
+# This doesn't work--it _should_! Someone needs to fix this badly.
+#
+# elsif ($option =~ /^-work([-_]?dir)?$/)
+# {
+# $workdir = shift @argv;
+# return 1;
+# }
return 0;
}
@@ -120,16 +122,6 @@ sub set_defaults
$make_path = "make";
$tmpfilesuffix = "mk";
$pwd = &get_this_pwd;
-
- # Find the full pathname of Make. For DOS systems this is more
- # complicated, so we ask make itself.
-
- open(MAKEFILE,"> makefile.tmp");
- print MAKEFILE 'all: ; @echo $(MAKE)' . "\n";
- close(MAKEFILE);
- $make_path = `$make_path -f makefile.tmp`;
- chop $make_path;
- unlink "makefile.tmp";
}
sub set_more_defaults
@@ -137,6 +129,36 @@ sub set_more_defaults
local($string);
local($index);
+ # find the type of the port. We do this up front to have a single
+ # point of change if it needs to be tweaked.
+ #
+ # This is probably not specific enough.
+ #
+ if ($osname =~ /Windows/i) {
+ $port_type = 'W32';
+ }
+ # Bleah, the osname is so variable on DOS. This kind of bites.
+ # Well, as far as I can tell if we check for some text at the
+ # beginning of the line with either no spaces or a single space, then
+ # a D, then either "OS", "os", or "ev" and a space. That should
+ # match and be pretty specific.
+ elsif ($osname =~ /^([^ ]*|[^ ]* [^ ]*)D(OS|os|ev) /) {
+ $port_type = 'DOS';
+ }
+ # Everything else, right now, is UNIX. Note that we should integrate
+ # the VOS support into this as well and get rid of $vos; we'll do
+ # that next time.
+ else {
+ $port_type = 'UNIX';
+ }
+
+ # Find the full pathname of Make. For DOS systems this is more
+ # complicated, so we ask make itself.
+
+ $make_path = `sh -c 'echo "all:;\@echo \$(MAKE)" | $make_path -f-'`;
+ chop $make_path;
+ print "Make\t= `$make_path'\n" if $debug;
+
$string = `$make_path -v -f /dev/null 2> /dev/null`;
$string =~ /^(GNU Make [^,\n]*)/;
diff --git a/tests/scripts/features/default_names b/tests/scripts/features/default_names
index 824f889..501f1fc 100644
--- a/tests/scripts/features/default_names
+++ b/tests/scripts/features/default_names
@@ -1,3 +1,5 @@
+# -*-perl-*-
+
$description = "This script tests to make sure that Make looks for
default makefiles in the correct order (GNUmakefile,makefile,Makefile)";
@@ -13,7 +15,7 @@ close(MAKEFILE);
# DOS/WIN32 platforms preserve case, but Makefile is the same file as makefile.
# Just test what we can here (avoid Makefile versus makefile test).
#
-if ($osname !~ /DOS|Windows/i)
+if ($port_type eq 'UNIX')
{
# Create another makefile called "makefile"
open(MAKEFILE,"> makefile");
@@ -45,7 +47,7 @@ unlink $makefile;
# DOS/WIN32 platforms preserve case, but Makefile is the same file as makefile.
# Just test what we can here (avoid Makefile versus makefile test).
#
-if ($osname !~ /DOS|Windows/i)
+if ($port_type eq 'UNIX')
{
$answer = "It chose makefile\n";
diff --git a/tests/scripts/features/reinvoke b/tests/scripts/features/reinvoke
index 99fb466..713580c 100644
--- a/tests/scripts/features/reinvoke
+++ b/tests/scripts/features/reinvoke
@@ -18,7 +18,7 @@ all: ; \@echo 'running rules.'
$makefile $makefile2: $makefile_orig
\@echo 'rebuilding \$\@.'
- \@touch \$\@
+ \@echo >> \$\@
include $makefile2
@@ -54,11 +54,11 @@ SHELL = /bin/sh
all: ; @echo hello
-a : b ; touch $@
+a : b ; echo >> $@
-b : c ; [ -f $@ ] || touch $@
+b : c ; [ -f $@ ] || echo >> $@
-c: ; touch $@
+c: ; echo >> $@
include $(F)
EOM
@@ -74,7 +74,7 @@ sleep(2);
&run_make_with_options($makefile3, "F=a", &get_logfile, 0);
-$answer = "[ -f b ] || touch b\nhello\n";
+$answer = "[ -f b ] || echo >> b\nhello\n";
&compare_output($answer,&get_logfile(1));
# Now try with the file we're not updating being the actual file we're
@@ -82,7 +82,7 @@ $answer = "[ -f b ] || touch b\nhello\n";
&run_make_with_options($makefile3, "F=b", &get_logfile, 0);
-$answer = "[ -f b ] || touch b\nhello\n";
+$answer = "[ -f b ] || echo >> b\nhello\n";
&compare_output($answer,&get_logfile(1));
unlink('a','b','c');
diff --git a/tests/scripts/functions/foreach b/tests/scripts/functions/foreach
index 0c63c47..b80751b 100644
--- a/tests/scripts/functions/foreach
+++ b/tests/scripts/functions/foreach
@@ -20,7 +20,7 @@ open(MAKEFILE,"> $makefile");
# On WIN32 systems, the user's path is found in %Path% ($Path)
#
-$pathvar = (($osname =~ /Windows/i) ? "Path" : "PATH");
+$pathvar = (($port_type eq 'Windows') ? "Path" : "PATH");
print MAKEFILE <<EOF;
foo = bletch null \@ garf
diff --git a/tests/scripts/functions/origin b/tests/scripts/functions/origin
index 721d928..eab2d78 100644
--- a/tests/scripts/functions/origin
+++ b/tests/scripts/functions/origin
@@ -15,12 +15,13 @@ defined per the following list:
'override' defined by override in makefile
'automatic' Automatic variable\n";
-# On WIN32 systems, HOME is meaningless. SystemRoot should be defined though.
-# With DJGPP, HOME is not guaranteed to be defined. Use DJDIR instead.
+# On WIN32 systems, HOME is meaningless. SystemRoot should be defined
+# though. With DJGPP, HOME is not guaranteed to be defined. Use DJDIR
+# instead.
#
-$homevar = (($osname =~ /Windows/i)
- ? "SystemRoot"
- : (($osname =~ /DOS/i) ? "DJDIR" : "HOME"));
+$homevar = (($port_type eq 'Windows') ? "SystemRoot"
+ : (($port_type eq 'DOS') ? "DJDIR"
+ : "HOME"));
open(MAKEFILE,"> $makefile");
diff --git a/tests/scripts/options/dash-l b/tests/scripts/options/dash-l
index 445b869..58216f9 100644
--- a/tests/scripts/options/dash-l
+++ b/tests/scripts/options/dash-l
@@ -25,7 +25,7 @@ SHELL = /bin/sh
define test
if [ ! -f test-file ]; then \
- touch test-file; sleep 2; rm -f test-file; \
+ echo >> test-file; sleep 2; rm -f test-file; \
else \
echo $@ FAILED; \
fi
diff --git a/tests/scripts/options/dash-n b/tests/scripts/options/dash-n
index 97dac7a..c1f4aab 100644
--- a/tests/scripts/options/dash-n
+++ b/tests/scripts/options/dash-n
@@ -9,8 +9,8 @@ open(MAKEFILE, "> $makefile");
print MAKEFILE <<'EOMAKE';
-final: intermediate ; touch $@
-intermediate: orig ; touch $@
+final: intermediate ; echo >> $@
+intermediate: orig ; echo >> $@
EOMAKE
@@ -19,11 +19,11 @@ close(MAKEFILE);
&touch('orig');
&run_make_with_options($makefile, "", &get_logfile);
-$answer = "touch intermediate\ntouch final\n";
+$answer = "echo >> intermediate\necho >> final\n";
&compare_output($answer, &get_logfile(1));
&run_make_with_options($makefile, "-Worig -n", &get_logfile);
-$answer = "touch intermediate\ntouch final\n";
+$answer = "echo >> intermediate\necho >> final\n";
&compare_output($answer, &get_logfile(1));
unlink('orig', 'intermediate', 'final');
diff --git a/tests/scripts/variables/MAKECMDGOALS b/tests/scripts/variables/MAKECMDGOALS
index ec33358..879283b 100644
--- a/tests/scripts/variables/MAKECMDGOALS
+++ b/tests/scripts/variables/MAKECMDGOALS
@@ -1,4 +1,6 @@
-$description = "The following test creates a makefile to test the MAKECMDGOALS variable.";
+# -*-perl-*-
+
+$description = "Test the MAKECMDGOALS variable.";
$details = "\
We construct a makefile with various targets, all of which print out
diff --git a/tests/test_driver.pl b/tests/test_driver.pl
index 001d247..8e38813 100644
--- a/tests/test_driver.pl
+++ b/tests/test_driver.pl
@@ -153,7 +153,7 @@ sub toplevel
{
print "\n$num_failed Test";
print "s" unless $num_failed == 1;
- print " Failed (See .diff files in $workdir dir for details) :-(\n\n";
+ print " Failed (See .$diffext files in $workdir dir for details) :-(\n\n";
return 0;
}
else
@@ -363,9 +363,21 @@ sub run_each_test
$testpath = "$workpath$pathsep$testname";
# Leave enough space in the extensions to append a number, even
# though it needs to fit into 8+3 limits.
- $log_filename = "$testpath.l";
- $diff_filename = "$testpath.d";
- $base_filename = "$testpath.b";
+ if ($port_host eq 'DOS') {
+ $logext = 'l';
+ $diffext = 'd';
+ $baseext = 'b';
+ $extext = '';
+ }
+ else {
+ $logext = 'log';
+ $diffext = 'diff';
+ $baseext = 'base';
+ $extext = '.';
+ }
+ $log_filename = "$testpath.$logext";
+ $diff_filename = "$testpath.$diffext";
+ $base_filename = "$testpath.$baseext";
$tmp_filename = "$testpath.$tmpfilesuffix";
&setup_for_test; # suite-defined
@@ -602,7 +614,7 @@ sub compare_output
print "\nCreating Difference File ...\n";
}
# Create the difference file
- local($command) = "diff -u " . &get_basefile . " " . $logfile;
+ local($command) = "diff -c " . &get_basefile . " " . $logfile;
&run_command_with_output(&get_difffile,$command);
return 0;
@@ -1030,7 +1042,7 @@ sub num_suffix
local($num) = @_;
if (--$num > 0) {
- return "$num";
+ return "$extext$num";
}
return "";