Add a test for concurrent writes

This commit is contained in:
Andrew Gaul 2019-07-16 12:55:14 -07:00
parent c7f8f61d09
commit 5cb7a31c09

View File

@ -545,6 +545,16 @@ function test_concurrency {
rm -f `seq 5`
}
function test_concurrent_writes {
describe "Test concurrent updates to a file"
dd if=/dev/urandom of=${TEST_TEXT_FILE} bs=$BIG_FILE_LENGTH count=1
for process in `seq 10`; do
dd if=/dev/zero of=${TEST_TEXT_FILE} seek=$(($RANDOM % $BIG_FILE_LENGTH)) count=1 bs=1024 conv=notrunc &
done
wait
rm_test_file
}
function test_open_second_fd {
describe "read from an open fd"
rm -f ${TEST_TEXT_FILE}
@ -581,6 +591,7 @@ function add_all_tests {
add_tests test_write_after_seek_ahead
add_tests test_overwrite_existing_file_range
add_tests test_concurrency
add_tests test_concurrent_writes
add_tests test_open_second_fd
}