* tests/test_driver.pl: Enhance error messages

This commit is contained in:
Dmitry Goncharov 2020-01-05 10:46:58 -05:00 committed by Paul Smith
parent ec946d7e21
commit 4e277f6fbd

View file

@ -237,7 +237,7 @@ sub toplevel
if (-d $workpath) { if (-d $workpath) {
print "Clearing $workpath...\n"; print "Clearing $workpath...\n";
&remove_directory_tree("$workpath/") &remove_directory_tree("$workpath/")
or &error ("Couldn't wipe out $workpath\n"); or &error ("Couldn't wipe out $workpath: $!\n");
} else { } else {
mkdir ($workpath, 0777) or &error ("Couldn't mkdir $workpath: $!\n"); mkdir ($workpath, 0777) or &error ("Couldn't mkdir $workpath: $!\n");
} }
@ -1129,8 +1129,9 @@ sub remove_directory_tree
-e $targetdir or return 1; -e $targetdir or return 1;
&remove_directory_tree_inner ("RDT00", $targetdir) or return 0; &remove_directory_tree_inner ("RDT00", $targetdir) or return 0;
if ($nuketop) { if ($nuketop && !rmdir ($targetdir)) {
rmdir($targetdir) or return 0; print "Cannot remove $targetdir: $!\n";
return 0;
} }
return 1; return 1;
@ -1149,10 +1150,16 @@ sub remove_directory_tree_inner
lstat ($object); lstat ($object);
if (-d _ && &remove_directory_tree_inner ($subdirhandle, $object)) { if (-d _ && &remove_directory_tree_inner ($subdirhandle, $object)) {
rmdir $object or return 0; if (!rmdir($object)) {
print "Cannot remove $object: $!\n";
return 0;
}
} else { } else {
if ($^O ne 'VMS') { if ($^O ne 'VMS') {
unlink $object or return 0; if (!unlink $object) {
print "Cannot unlink $object: $!\n";
return 0;
}
} else { } else {
# VMS can have multiple versions of a file. # VMS can have multiple versions of a file.
1 while unlink $object; 1 while unlink $object;