From 57b13c80200f896ab919c5e3fb2c3b6bb43a1c3c Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Sat, 14 Sep 2019 15:58:57 -0400 Subject: [PATCH] * tests/test_driver.pl: Remember error for "running" a directory. * tests/scripts/features/errors: Check errors "running" a directory. --- tests/scripts/features/errors | 19 +++++++++++++++++++ tests/test_driver.pl | 8 ++++++++ 2 files changed, 27 insertions(+) diff --git a/tests/scripts/features/errors b/tests/scripts/features/errors index ec49547b..1e155622 100644 --- a/tests/scripts/features/errors +++ b/tests/scripts/features/errors @@ -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; diff --git a/tests/test_driver.pl b/tests/test_driver.pl index 30e19435..6ae523d1 100644 --- a/tests/test_driver.pl +++ b/tests/test_driver.pl @@ -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";