]> git.ipfire.org Git - thirdparty/make.git/commitdiff
* tests/test_driver.pl: Remember error for "running" a directory.
authorPaul Smith <psmith@gnu.org>
Sat, 14 Sep 2019 19:58:57 +0000 (15:58 -0400)
committerPaul Smith <psmith@gnu.org>
Mon, 16 Sep 2019 12:25:33 +0000 (08:25 -0400)
* tests/scripts/features/errors: Check errors "running" a directory.

tests/scripts/features/errors
tests/test_driver.pl

index ec49547b7d89b6c4d4a7804e7e417c0568975b2a..1e1556229fee9b5f9835c4f92180998966702841 100644 (file)
@@ -73,4 +73,23 @@ if ($ERR_nonexe_file) {
     unlink($noexe);
 }
 
+# Try failing by "running" a directory
+
+if ($ERR_exe_dir) {
+    mkdir('sd', 0775);
+
+    run_make_test(q!
+PATH := .
+all: ; sd
+!,
+              '', "sd\n#MAKE#: sd: $ERR_exe_dir\n#MAKE#: *** [#MAKEFILE#;3: all] Error 127", 512);
+
+    run_make_test(q!
+all: ; ./sd
+!,
+              '', "./sd\n#MAKE#: ./sd: $ERR_exe_dir\n#MAKE#: *** [#MAKEFILE#;2: all] Error 127", 512);
+
+    rmdir('sd');
+}
+
 1;
index 30e19435b1277b9bdf3af7ea7306093e00b56b57..6ae523d102dc731c46b04c78fcce6de8f1712973 100644 (file)
@@ -69,6 +69,7 @@ $ERR_no_such_file = undef;
 $ERR_read_only_file = undef;
 $ERR_unreadable_file = undef;
 $ERR_noexe_file = undef;
+$ERR_exe_dir = undef;
 
 if (open(my $F, '<', 'file.none')) {
     print "Opened non-existent file! Skipping related tests.\n";
@@ -94,6 +95,13 @@ if ($? == 0) {
     $ERR_nonexe_file = "$!";
 }
 
+$_ = `./.`;
+if ($? == 0) {
+    print "Executed directory!  Skipping related tests.\n";
+} else {
+    $ERR_exe_dir = "$!";
+}
+
 chmod(0000, 'file.out');
 if (open(my $F, '<', 'file.out')) {
     print "Opened unreadable file!  Skipping related tests.\n";