mirror of
https://github.com/versity/scoutfs.git
synced 2025-12-23 13:35:18 +00:00
Fix race in offline-extent-waiting test
Before comparing file contents, wait for the background dd to complete. Also fix a typo. Signed-off-by: Chris Kirby <ckirby@versity.com>
This commit is contained in:
@@ -49,7 +49,7 @@ offline wating should be empty:
|
|||||||
0
|
0
|
||||||
== truncating does wait
|
== truncating does wait
|
||||||
truncate should be waiting for first block:
|
truncate should be waiting for first block:
|
||||||
trunate should no longer be waiting:
|
truncate should no longer be waiting:
|
||||||
0
|
0
|
||||||
== writing waits
|
== writing waits
|
||||||
should be waiting for write
|
should be waiting for write
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ echo "truncate should be waiting for first block:"
|
|||||||
expect_wait "$DIR/file" "change_size" $ino 0
|
expect_wait "$DIR/file" "change_size" $ino 0
|
||||||
scoutfs stage "$DIR/golden" "$DIR/file" -V "$vers" -o 0 -l $BYTES
|
scoutfs stage "$DIR/golden" "$DIR/file" -V "$vers" -o 0 -l $BYTES
|
||||||
sleep .1
|
sleep .1
|
||||||
echo "trunate should no longer be waiting:"
|
echo "truncate should no longer be waiting:"
|
||||||
scoutfs data-waiting -B 0 -I 0 -p "$DIR" | wc -l
|
scoutfs data-waiting -B 0 -I 0 -p "$DIR" | wc -l
|
||||||
cat "$DIR/golden" > "$DIR/file"
|
cat "$DIR/golden" > "$DIR/file"
|
||||||
vers=$(scoutfs stat -s data_version "$DIR/file")
|
vers=$(scoutfs stat -s data_version "$DIR/file")
|
||||||
@@ -168,10 +168,13 @@ scoutfs release "$DIR/file" -V "$vers" -o 0 -l $BYTES
|
|||||||
# overwrite, not truncate+write
|
# overwrite, not truncate+write
|
||||||
dd if="$DIR/other" of="$DIR/file" \
|
dd if="$DIR/other" of="$DIR/file" \
|
||||||
bs=$BS count=$BLOCKS conv=notrunc status=none &
|
bs=$BS count=$BLOCKS conv=notrunc status=none &
|
||||||
|
pid="$!"
|
||||||
sleep .1
|
sleep .1
|
||||||
echo "should be waiting for write"
|
echo "should be waiting for write"
|
||||||
expect_wait "$DIR/file" "write" $ino 0
|
expect_wait "$DIR/file" "write" $ino 0
|
||||||
scoutfs stage "$DIR/golden" "$DIR/file" -V "$vers" -o 0 -l $BYTES
|
scoutfs stage "$DIR/golden" "$DIR/file" -V "$vers" -o 0 -l $BYTES
|
||||||
|
# wait for the background dd to complete
|
||||||
|
wait "$pid" 2> /dev/null
|
||||||
cmp "$DIR/file" "$DIR/other"
|
cmp "$DIR/file" "$DIR/other"
|
||||||
|
|
||||||
echo "== cleanup"
|
echo "== cleanup"
|
||||||
|
|||||||
Reference in New Issue
Block a user