diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2017-07-16 13:14:06 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2017-07-16 13:14:06 -0400 |
commit | dfa5bbfa84f8177234e8ba46dd5596a8d0e1a0c4 (patch) | |
tree | d1ea64fbb507aa2dfdf8ec02cc209ddc4deb04d6 /tests.sh | |
parent | 0fc17759476ca38f55b479a12d88f8a7614b7a3b (diff) | |
download | bfs-dfa5bbfa84f8177234e8ba46dd5596a8d0e1a0c4.tar.xz |
tests.sh: Close extraneous fds for tests that depend on ulimit
Diffstat (limited to 'tests.sh')
-rwxr-xr-x | tests.sh | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -433,6 +433,19 @@ function bfs_diff() { fi } +function closefrom() { + for fd in /dev/fd/*; do + if [ ! -e "$fd" ]; then + continue + fi + + fd="${fd##*/}" + if [ "$fd" -gt "$1" ]; then + eval "exec ${fd}<&-" + fi + done +} + cd "$TMP" # Test cases @@ -1160,11 +1173,15 @@ function test_colors() { } function test_deep() { + closefrom 2 + ulimit -n 8 bfs_diff deep -mindepth 18 } function test_deep_strict() { + closefrom 2 + # Not even enough fds to keep the root open ulimit -n 6 bfs_diff deep -mindepth 18 |