From be83292657494709b48a5915a3385869a3b21288 Mon Sep 17 00:00:00 2001 From: Tomasz Kulasek Date: Fri, 24 May 2019 14:44:21 +0200 Subject: [PATCH] test/json_config: wait for clean config Fixes issue #789 Signed-off-by: Tomasz Kulasek Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455668 (master) (cherry picked from commit b7080d47c56d9c85317a44c109b39de036b7fef1) Change-Id: I795247e3b19c24dbf1564e2c0f6c5c44e850ab8b Signed-off-by: Tomasz Zawadzki Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458346 Reviewed-by: Darek Stojaczyk Reviewed-by: Ben Walker Tested-by: SPDK CI Jenkins --- test/json_config/json_config.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/test/json_config/json_config.sh b/test/json_config/json_config.sh index 1e4be1cfa..36a3f3ccc 100755 --- a/test/json_config/json_config.sh +++ b/test/json_config/json_config.sh @@ -401,8 +401,21 @@ function json_config_clear() { # Check if config is clean. # Global params can't be cleared so need to filter them out. local config_filter="$rootdir/test/json_config/config_filter.py" - $rootdir/scripts/rpc.py -s "${app_socket[$1]}" save_config | \ - $config_filter -method delete_global_parameters | $config_filter -method check_empty + + # RPC's used to cleanup configuration (e.g. to delete split and nvme bdevs) + # complete immediately and they don't wait for the unregister callback. + # It causes that configuration may not be fully cleaned at this moment and + # we should to wait a while. (See github issue #789) + count=100 + while [ $count -gt 0 ] ; do + $rootdir/scripts/rpc.py -s "${app_socket[$1]}" save_config | $config_filter -method delete_global_parameters | $config_filter -method check_empty && break + count=$(( $count -1 )) + sleep 0.1 + done + + if [ $count -eq 0 ] ; then + return 1 + fi } on_error_exit() {