diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2016-10-22 21:05:47 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2016-10-24 11:19:24 -0400 |
commit | 3c8233869d34713860c48b1230c3ea06b8767b88 (patch) | |
tree | d2c95dd2370cfd8b1255c08c83b953c29ccd91f2 /tests.sh | |
parent | 087b29c53e13299e195942e48ae309817f4f1d93 (diff) | |
download | bfs-3c8233869d34713860c48b1230c3ea06b8767b88.tar.xz |
Implement -ignore_readdir_race.
Diffstat (limited to 'tests.sh')
-rwxr-xr-x | tests.sh | 30 |
1 files changed, 22 insertions, 8 deletions
@@ -62,11 +62,12 @@ function make_weirdnames() { weirdnames="$(mktemp -d "${TMPDIR:-/tmp}"/bfs.weirdnames.XXXXXXXXXX)" make_weirdnames "$weirdnames" -out="$(mktemp -d "${TMPDIR:-/tmp}"/bfs.out.XXXXXXXXXX)" +# Create a scratch directory that tests can modify +scratch="$(mktemp -d "${TMPDIR:-/tmp}"/bfs.weirdnames.XXXXXXXXXX)" # Clean up temporary directories on exit function cleanup() { - rm -rf "$out" + rm -rf "$scratch" rm -rf "$weirdnames" rm -rf "$links" rm -rf "$perms" @@ -359,12 +360,12 @@ function test_0064() { } function test_0065() { - find "$basic" -fprint "$out/out.find" - "$BFS" "$basic" -fprint "$out/out.bfs" + find "$basic" -fprint "$scratch/out.find" + "$BFS" "$basic" -fprint "$scratch/out.bfs" - sort -o "$out/out.find" "$out/out.find" - sort -o "$out/out.bfs" "$out/out.bfs" - diff -u "$out/out.find" "$out/out.bfs" + sort -o "$scratch/out.find" "$scratch/out.find" + sort -o "$scratch/out.bfs" "$scratch/out.bfs" + diff -u "$scratch/out.find" "$scratch/out.bfs" } function test_0066() { @@ -377,7 +378,20 @@ function test_0067() { find_diff -L -- -type f } -for i in {1..67}; do +function test_0068() { + # Make sure -ignore_readdir_race doesn't suppress ENOENT at the root + ! "$BFS" "$basic/nonexistent" -ignore_readdir_race 2>/dev/null +} + +function test_0069() { + rm -rf "$scratch"/* + touch "$scratch"/{foo,bar} + + # -links 1 forces a stat() call, which will fail for the second file + "$BFS" "$scratch" -ignore_readdir_race -links 1 -exec ./tests/remove-sibling.sh '{}' ';' +} + +for i in {1..69}; do test="test_$(printf '%04d' $i)" ("$test" "$dir") status=$? |