summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2022-10-28 15:21:55 -0400
committerPaul Smith <psmith@gnu.org>2022-10-29 13:36:21 -0400
commit4e18732a1d6be8720615b18408cbd0d0195b5b6e (patch)
tree783a824c0ab3e3bd5207d0435bcae6ac65b7b2f8 /tests
parent11f9da227e8b31e1831522214f4e088857d787f1 (diff)
downloadmake-git-4e18732a1d6be8720615b18408cbd0d0195b5b6e.tar.gz
tests: Avoid the use of File::Temp->newdir()
This was added in Perl 5.8 but some systems still only provide older versions such as Perl 5.6. We don't really need it anyway. Paul Eggert <eggert@cs.ucla.edu> reported this issue. * tests/README: Update this to be a bit more modern. * tests/test_driver.pl: Delete the $TEMPDIR variable. * tests/scripts/features/temp_stdin: Use $temppath not $TEMPDIR.
Diffstat (limited to 'tests')
-rw-r--r--tests/README54
-rw-r--r--tests/scripts/features/temp_stdin5
-rw-r--r--tests/test_driver.pl4
3 files changed, 30 insertions, 33 deletions
diff --git a/tests/README b/tests/README
index c46a3446..6ffa19a7 100644
--- a/tests/README
+++ b/tests/README
@@ -23,10 +23,9 @@ distributed under the following terms:
this program. If not, see <http://www.gnu.org/licenses/>.
-----------------------------------------------------------------------------
-The test suite requires Perl. These days, you should have at least Perl
-5.004 (available from ftp.gnu.org, and portable to many machines). It
-used to work with Perl 4.036 but official support for Perl 4.x was
-abandoned a long time ago, due to lack of testbeds, as well as interest.
+The test suite requires Perl. These days, you should have at least Perl 5.6.
+Newer versions may be required: I don't test regularly with older versions
+than what is installed by default on my development systems.
The test suite assumes that the first "diff" it finds on your PATH is
GNU diff, but that only matters if a test fails.
@@ -54,14 +53,6 @@ with your network or file server, not GNU make (I believe). This
shouldn't happen very often anymore: I've done a lot of work on the
tests to reduce the impacts of this situation.
-The options/dash-l test will not really test anything if the copy of
-make you are using can't obtain the system load. Some systems require
-make to be setgid sys or kmem for this; if you don't want to install
-make just to test it, make it setgid to kmem or whatever group /dev/kmem
-is (i.e., "chgrp kmem make;chmod g+s make" as root). In any case, the
-options/dash-l test should no longer *fail* because make can't read
-/dev/kmem.
-
A directory named "work" will be created when the tests are run which
will contain any makefiles and "diff" files of tests that fail so that
you may look at them afterward to see the output of make and the
@@ -74,28 +65,35 @@ other possible options for the test suite.
Open Issues
-----------
-The test suite has a number of problems which should be addressed. One
-VERY serious one is that there is no real documentation. You just have
-to see the existing tests. Use the newer tests: many of the tests
-haven't been updated to use the latest/greatest test methods. See the
-ChangeLog in the tests directory for pointers.
+The test suite has a number of problems which should be addressed. One VERY
+serious one is that there is no real documentation. You just have to see the
+existing tests. Use the newer tests: many of the tests haven't been updated
+to use the latest/greatest test methods. See the ChangeLogs for pointers.
+
+The second serious problem is that it's not relocatable: when you build out of
+the source tree it creates symlinks, which doesn't work on every system and is
+just bogus to boot.
+
+The third serious problem is that it's not parallelizable: it scribbles all
+over its installation directory and so can only test one make at a time.
+
+The fourth serious problem is that since the tests scribble all over the same
+directory (a) they can interfere with each other and (b) we cannot preserve
+the full environment for every test, if it involves creating temporary files
+etc. as they must be deleted before the next test.
-The second serious problem is that it's not parallelizable: it scribbles
-all over its installation directory and so can only test one make at a
-time. The third serious problem is that it's not relocatable: the only
-way it works when you build out of the source tree is to create
-symlinks, which doesn't work on every system and is bogus to boot. The
-fourth serious problem is that it doesn't create its own sandbox when
-running tests, so that if a test forgets to clean up after itself that
-can impact future tests.
+To solve these the suite should create a separate directory for EVERY test,
+local to the build directory, and all temporary files should exist in that
+directory. The directory can be preserved on error, or removed if the test
+succeeds (unless --keep is given).
Bugs
----
-Any complaints/suggestions/bugs/etc. for the test suite itself (as
-opposed to problems in make that the suite finds) should be handled the
-same way as normal GNU make bugs/problems (see the README for GNU make).
+Any complaints/suggestions/bugs/etc. for the test suite itself should be
+handled the same way as normal GNU make bugs/problems (see the README for GNU
+make).
Paul D. Smith
diff --git a/tests/scripts/features/temp_stdin b/tests/scripts/features/temp_stdin
index b4aa60a8..b06df53e 100644
--- a/tests/scripts/features/temp_stdin
+++ b/tests/scripts/features/temp_stdin
@@ -84,7 +84,9 @@ unlink($fout);
use File::Spec;
use File::Copy;
-my $makecopy = File::Spec->catfile($TEMPDIR, "make");
+my $tmakedir = File::Spec->catfile($cwdpath, 'tmakedir');
+mkdir($tmakedir, 0770);
+my $makecopy = File::Spec->catfile($tmakedir, 'make');
copy("$mkpath", $makecopy);
# Set file mode bits, because perl copy won't.
chmod 0700, $makecopy;
@@ -106,6 +108,7 @@ force:
@make_command = @make_orig;
unlink($makecopy);
+rmdir($tmakedir);
}
close(STDIN);
diff --git a/tests/test_driver.pl b/tests/test_driver.pl
index 964d3908..58a782f6 100644
--- a/tests/test_driver.pl
+++ b/tests/test_driver.pl
@@ -62,10 +62,6 @@ $test_timeout = 60;
$diff_name = undef;
-# Create a temporary directory that tests can use, outside the temp
-# directory that make is using.
-$TEMPDIR = File::Temp->newdir();
-
# Path to Perl
$perl_name = $^X;
if ($^O ne 'VMS') {