]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
runtests.pl: tolerate test directories without Makefile.inc
authorFabian Keil <fk@fabiankeil.de>
Tue, 1 Feb 2022 10:46:53 +0000 (11:46 +0100)
committerJay Satiro <raysatiro@yahoo.com>
Thu, 3 Feb 2022 21:38:36 +0000 (16:38 -0500)
Silences the following warnings when using a Makefile.inc-free
TESTDIR using the "-o" argument:

   readline() on closed filehandle D at ./runtests.pl line 592.
   Use of uninitialized value $disttests in pattern match (m//) at
   ./runtests.pl line 3602.

Closes https://github.com/curl/curl/pull/8379

tests/runtests.pl

index d67f40a12384405d3fe6f5da779caeaa6d0b1cae..f726d223bab651c50fc985ffff299db2477120f5 100755 (executable)
@@ -586,9 +586,11 @@ sub checkcmd {
 #######################################################################
 # Get the list of tests that the tests/data/Makefile.am knows about!
 #
-my $disttests;
+my $disttests = "";
 sub get_disttests {
-    open(D, "<$TESTDIR/Makefile.inc");
+    # If a non-default $TESTDIR is being used there may not be any
+    # Makefile.inc in which case there's nothing to do.
+    open(D, "<$TESTDIR/Makefile.inc") or return;
     while(<D>) {
         chomp $_;
         if(($_ =~ /^#/) ||($_ !~ /test/)) {