diff options
author | chrisrd <[email protected]> | 2018-03-03 04:57:29 +1100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-03-02 09:57:29 -0800 |
commit | d0f6fbaff383d0ea0b11f4e4547d6b062ef7ddad (patch) | |
tree | 0d2f13081c7999cae8cc2c7462b4e702cb61aaa6 | |
parent | e086e717c3fc2c5b0867ee4b5ec07200a53b8dac (diff) |
ZTS: fix spurious failures in mv_files
The test could fail because of a race condition between the files being
generated in the background and attempting to move the files. Wait for
all file generation to complete before trying to move the files around.
Also, clean up the waiting: the 'wait' command without arguments waits
for all child pids.
Reviewed-by: George Melikov <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Chris Dunlop <[email protected]>
Closes #7220
Closes #7242
Closes #7258
-rw-r--r-- | tests/zfs-tests/tests/functional/mv_files/mv_files_common.kshlib | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/tests/zfs-tests/tests/functional/mv_files/mv_files_common.kshlib b/tests/zfs-tests/tests/functional/mv_files/mv_files_common.kshlib index c48c07d8d..6728e950b 100644 --- a/tests/zfs-tests/tests/functional/mv_files/mv_files_common.kshlib +++ b/tests/zfs-tests/tests/functional/mv_files/mv_files_common.kshlib @@ -108,16 +108,6 @@ function init_setup } -function wait_pid -{ - for pid in $1 - do - ps -e | grep $pid >/dev/null 2>&1 - (( $? == 0 )) && wait $pid - done -} - - # # Generate given number files in a # directory of zfs file system @@ -141,18 +131,17 @@ function generate_files cp /etc/passwd $1/file_$count \ > /dev/null 2>&1 & - PIDS="$PIDS $!" + (( proc_num = proc_num + 1 )) - proc_num=`echo $PIDS | wc -w` if (( proc_num >= GANGPIDS )); then - wait_pid "$PIDS" + wait proc_num=0 - PIDS="" fi (( count = count + 1 )) done + wait } # |