tests: make running ls in a no longer existing directory more portable stable
authorAnton Shestakov <av6@dwimlabs.net>
Mon, 14 Nov 2022 19:58:44 +0400
branchstable
changeset 49594 88a8de821b5e
parent 49593 e11760daee12
child 49595 b78ae134ac92
tests: make running ls in a no longer existing directory more portable On Linux, ls -A simply returns nothing and the exit code is 0. On NetBSD, ls -A complains that . doesn't exist and the exit code is 1. Sadly, it's not possible to do something like "[1] (?)", so " || true" is the best I could come up with.
tests/test-removeemptydirs.t
--- a/tests/test-removeemptydirs.t	Mon Nov 14 19:38:57 2022 +0400
+++ b/tests/test-removeemptydirs.t	Mon Nov 14 19:58:44 2022 +0400
@@ -155,7 +155,8 @@
   <directory is no longer accessible>
   $ ls -A $TESTTMP/hghistedit/somedir
   foo
-  $ ls -A
+  $ ls -A || true
+  ls: .: $ENOENT$ (?)
 #endif
 
 Get out of the doomed directory