From: Dmitry Goncharov Date: Sun, 5 Jan 2020 15:46:58 +0000 (-0500) Subject: * tests/test_driver.pl: Enhance error messages X-Git-Tag: 4.3~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4e277f6fbdc9361a006f00f18a13125cc709d0f8;p=thirdparty%2Fmake.git * tests/test_driver.pl: Enhance error messages --- diff --git a/tests/test_driver.pl b/tests/test_driver.pl index 49c5c0e4..f18e7854 100644 --- a/tests/test_driver.pl +++ b/tests/test_driver.pl @@ -237,7 +237,7 @@ sub toplevel if (-d $workpath) { print "Clearing $workpath...\n"; &remove_directory_tree("$workpath/") - or &error ("Couldn't wipe out $workpath\n"); + or &error ("Couldn't wipe out $workpath: $!\n"); } else { mkdir ($workpath, 0777) or &error ("Couldn't mkdir $workpath: $!\n"); } @@ -1129,8 +1129,9 @@ sub remove_directory_tree -e $targetdir or return 1; &remove_directory_tree_inner ("RDT00", $targetdir) or return 0; - if ($nuketop) { - rmdir($targetdir) or return 0; + if ($nuketop && !rmdir ($targetdir)) { + print "Cannot remove $targetdir: $!\n"; + return 0; } return 1; @@ -1149,10 +1150,16 @@ sub remove_directory_tree_inner lstat ($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 { if ($^O ne 'VMS') { - unlink $object or return 0; + if (!unlink $object) { + print "Cannot unlink $object: $!\n"; + return 0; + } } else { # VMS can have multiple versions of a file. 1 while unlink $object;