tests: use `test -f` instead of `ls` to see if a file is present (
issue6662)
ls's exit code when file doesn't exist is 2 on Linux and 1 on NetBSD, so let's
use something that's supposedly more portable, since we only care whether the
file is there or not.
--- a/tests/test-status-tracked-key.t Mon Dec 05 17:28:40 2022 +0100
+++ b/tests/test-status-tracked-key.t Mon Dec 05 19:37:12 2022 +0400
@@ -165,8 +165,7 @@
Test upgrade and downgrade
==========================
- $ ls .hg/dirstate-tracked-hint
- .hg/dirstate-tracked-hint
+ $ test -f .hg/dirstate-tracked-hint
$ hg debugrequires | grep 'tracked'
dirstate-tracked-key-v1
@@ -181,9 +180,8 @@
no revlogs to process
- $ ls -1 .hg/dirstate-tracked-hint
- ls: *.hg/dirstate-tracked-hint*: $ENOENT$ (glob)
- [2]
+ $ test -f .hg/dirstate-tracked-hint
+ [1]
$ hg debugrequires | grep 'tracked'
[1]
@@ -198,8 +196,7 @@
no revlogs to process
- $ ls -1 .hg/dirstate-tracked-hint
- .hg/dirstate-tracked-hint
+ $ test -f .hg/dirstate-tracked-hint
$ hg debugrequires | grep 'tracked'
dirstate-tracked-key-v1
$ cd ..