From a63f51340b540074dd98bfc7201e2221c5671d28 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Fri, 17 Sep 1999 03:15:37 +0000 Subject: [PATCH] * A few script fixes and updates for 3.78. --- ChangeLog | 9 +++++ Makefile.DOS.template | 12 ++++--- NEWS | 4 ++- README.DOS.template | 4 +-- TODO.private | 5 ++- configure.in | 2 +- main.c | 1 + tests/ChangeLog | 45 +++++++++++++++++++---- tests/run_make_tests.pl | 54 +++++++++++++++++++--------- tests/scripts/features/default_names | 6 ++-- tests/scripts/features/reinvoke | 12 +++---- tests/scripts/functions/foreach | 2 +- tests/scripts/functions/origin | 11 +++--- tests/scripts/options/dash-l | 2 +- tests/scripts/options/dash-n | 8 ++--- tests/scripts/variables/MAKECMDGOALS | 4 ++- tests/test_driver.pl | 24 +++++++++---- 17 files changed, 145 insertions(+), 60 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5c84a1ec..25c432dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +1999-09-17 Paul D. Smith + + * Version 3.78 released. + +1999-09-16 Paul D. Smith + + * main.c (define_makeflags): Zero out FLAGSTRING to avoid + uninitialized memory reads when checking *p != '-' in the loop. + 1999-09-15 Paul D. Smith * Version 3.77.97 released. diff --git a/Makefile.DOS.template b/Makefile.DOS.template index 80cb22a1..7970c929 100644 --- a/Makefile.DOS.template +++ b/Makefile.DOS.template @@ -471,10 +471,14 @@ dist-hook: # Note: check-loadavg is NOT a prerequisite of check-local, since # there's no uptime utility, and the test it does doesn't make sense # on MSDOS anyway. -check-local: check-loadavg check-regression - @echo "=========================" \ - echo "Regression passed: GNU Make $(VERSION) ($(MAKE_HOST)) built with $(CC)"; \ - echo "=========================" +check-local: check-shell check-regression + @banner=" Regression PASSED: GNU Make $(VERSION) ($(MAKE_HOST)) built with $(CC) "; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes"; \ + echo .PHONY: check-loadavg check-shell check-regression diff --git a/NEWS b/NEWS index 3f775fd5..6cc6fb95 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,6 @@ GNU make NEWS -*-indented-text-*- History of user-visible changes. - 21 Jul 1999 + 17 Sep 1999 Copyright (C) 1992,93,94,95,96,97,98,1999 Free Software Foundation, Inc. See the end for copying conditions. @@ -9,6 +9,8 @@ All changes mentioned here are more fully described in the GNU make manual, which is contained in this distribution as the file make.texinfo. Please send GNU make bug reports to bug-make@gnu.org. +See the README file and the GNU make manual for details on sending bug +reports. Version 3.78 diff --git a/README.DOS.template b/README.DOS.template index 40a6cbf6..4d786771 100644 --- a/README.DOS.template +++ b/README.DOS.template @@ -104,8 +104,8 @@ To build: and `rm' programs (the latter from Fileutils). 8. To run the test suite, type "make check". This requires a Unix - shell (I used the DJGPP port of Bash 2.03), Perl, Fileutils and - Sh-utils. + shell (I used the DJGPP port of Bash 2.03), Perl, Sed, Fileutils + and Sh-utils. Notes: diff --git a/TODO.private b/TODO.private index ea2c99ec..5af05449 100644 --- a/TODO.private +++ b/TODO.private @@ -36,9 +36,6 @@ feel free to make whatever changes you like to the current tests, given some high-level goals, and that you'll port the current tests to whatever you do :). -If someone does this work I'll be able to start including the test suite -with make itself, which would be very cool. - The Rest of the List -------------------- @@ -60,6 +57,8 @@ The Rest of the List that's OK. I have paperwork for their work so if you want to do this one talk to me to get what they've already done. + [K R Praveen ] + 3) Currently you can use "%.foo %.bar : %.baz" to mean that one invocation of the rule builds both targets. GNU make needs a way to do that for explicit rules, too. I heard a rumor that some versions diff --git a/configure.in b/configure.in index ff594d4e..27686532 100644 --- a/configure.in +++ b/configure.in @@ -3,7 +3,7 @@ AC_REVISION([$Id$]) AC_PREREQ(2.13)dnl dnl Minimum Autoconf version required. AC_INIT(vpath.c)dnl dnl A distinctive file to look for in srcdir. -AM_INIT_AUTOMAKE(make, 3.77.97) +AM_INIT_AUTOMAKE(make, 3.78) AM_CONFIG_HEADER(config.h) dnl Regular configure stuff diff --git a/main.c b/main.c index 0810a925..132421bf 100644 --- a/main.c +++ b/main.c @@ -2403,6 +2403,7 @@ define_makeflags (all, makefile) /* Construct the value in FLAGSTRING. We allocate enough space for a preceding dash and trailing null. */ flagstring = (char *) alloca (1 + flagslen + 1); + bzero (flagstring, 1 + flagslen + 1); p = flagstring; words = 1; *p++ = '-'; diff --git a/tests/ChangeLog b/tests/ChangeLog index dd763b1b..b40612f6 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,14 +1,45 @@ +1999-09-16 Paul D. Smith + + * 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 * 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 484dbe1d..4130b3d0 100755 --- a/tests/run_make_tests.pl +++ b/tests/run_make_tests.pl @@ -9,7 +9,6 @@ # [-verbose] # [-keep] # [-make ] -# [-work ] # (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 824f889b..501f1fc9 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 99fb4664..713580c5 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 0c63c474..b80751b2 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 < $makefile"); diff --git a/tests/scripts/options/dash-l b/tests/scripts/options/dash-l index 445b8696..58216f9f 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 97dac7a7..c1f4aab8 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 ec333586..879283b0 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 001d2477..8e388136 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 "";