Merge pull request #1102 from gaul/test/concurrent-write

Add a test for concurrent writes
This commit is contained in:
Takeshi Nakatani 2019-07-17 22:24:45 +09:00 committed by GitHub
commit 2c4c78fd65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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
}