* tests/test_driver.pl: Remember error for "running" a directory.

* tests/scripts/features/errors: Check errors "running" a directory.
This commit is contained in:
Paul Smith 2019-09-14 15:58:57 -04:00
parent 02a4c2913a
commit 57b13c8020
2 changed files with 27 additions and 0 deletions

View 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;

View 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";