This fixes test failures seen on Haiku.

* tests/ls/recursive.sh: Run 'ls' even if ulimit fails.
* tests/split/r-chunk.sh: Run 'split' even if ulimit fails.
* tests/sort/sort-merge-fdlimit.sh: Skip test if 'ulimit -n' cannot set
file descriptor limits.
Reported by Bruno Haible.
---
 tests/ls/recursive.sh            | 2 +-
 tests/sort/sort-merge-fdlimit.sh | 4 +++-
 tests/split/r-chunk.sh           | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/ls/recursive.sh b/tests/ls/recursive.sh
index 74673680e..477f92f54 100755
--- a/tests/ls/recursive.sh
+++ b/tests/ls/recursive.sh
@@ -62,7 +62,7 @@ compare exp out || fail=1
 # Check that we don't run out of file descriptors when visiting
 # directories recursively.
 mkdir -p $(seq 30 | tr '\n' '/') || framework_failure_
-(ulimit -n 20 && ls -R 1 > out 2> err) || fail=1
+(ulimit -n 20; ls -R 1 > out 2> err) || fail=1
 test $(wc -l < out) = 88 || fail=1
 test $(wc -l < err) = 0 || fail=1
 
diff --git a/tests/sort/sort-merge-fdlimit.sh b/tests/sort/sort-merge-fdlimit.sh
index 6ec34cfd9..bb9c2c081 100755
--- a/tests/sort/sort-merge-fdlimit.sh
+++ b/tests/sort/sort-merge-fdlimit.sh
@@ -35,10 +35,12 @@ seq 17 >some-data
 # the ATF but fail inside it.
 
 # The default batch size (nmerge) is 16.
-(ulimit -n 19 \
+(ulimit -n 19 && touch ulimit-worked \
    && sort -m --batch-size=16 in/* 2>err/merge-default-err \
    || ! grep "open failed" err/merge-default-err) || fail=1
 
+test -f ulimit-worked || skip_ 'cannot modify open file descriptor limit'
+
 # If sort opens a file to sort by random hashes of keys,
 # it needs to consider this file against its limit on open file
 # descriptors.  Test once with the default random source
diff --git a/tests/split/r-chunk.sh b/tests/split/r-chunk.sh
index d946697fb..71fdb3ad5 100755
--- a/tests/split/r-chunk.sh
+++ b/tests/split/r-chunk.sh
@@ -58,7 +58,7 @@ compare exp out || fail=1
 # Ensure we fall back to appending to a file at a time
 # if we hit the limit for the number of open files.
 rm x*
-(ulimit -n 20 && yes | head -n90 | split -n r/30 ) || fail=1
+(ulimit -n 20; yes | head -n90 | split -n r/30 ) || fail=1
 test "$(stat -c %s x* | uniq -c | sed 's/^ *//; s/ /x/')" = "30x6" || fail=1
 
 Exit $fail
-- 
2.52.0


Reply via email to