From e8fa077f8381bbfc2decd28ee71f9de399278845 Mon Sep 17 00:00:00 2001 From: Pawel Kaminski Date: Fri, 13 Dec 2019 16:31:33 -0500 Subject: [PATCH] test/lvol: rewrite SIGTERM to bash Change-Id: I6d98bd447030db361e8f702a481aa41b44780dfd Signed-off-by: Pawel Kaminski Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/702 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Tomasz Zawadzki --- test/lvol/basic.sh | 15 ++++++++++++++- test/lvol/lvol.sh | 1 - test/lvol/test_cases.py | 29 ----------------------------- 3 files changed, 14 insertions(+), 31 deletions(-) diff --git a/test/lvol/basic.sh b/test/lvol/basic.sh index c269cd70c..b38cb8bfc 100755 --- a/test/lvol/basic.sh +++ b/test/lvol/basic.sh @@ -381,6 +381,16 @@ function test_construct_nested_lvol() { check_leftover_devices } +# Send SIGTERM after creating lvol store +function test_sigterm() { + # create an lvol store + malloc_name=$(rpc_cmd bdev_malloc_create $MALLOC_SIZE_MB $MALLOC_BS) + lvs_uuid=$(rpc_cmd bdev_lvol_create_lvstore "$malloc_name" lvs_test) + + # Send SIGTERM signal to the application + killprocess $spdk_pid +} + $rootdir/app/spdk_tgt/spdk_tgt & spdk_pid=$! trap 'killprocess "$spdk_pid"; exit 1' SIGINT SIGTERM EXIT @@ -398,6 +408,9 @@ run_test "test_construct_lvol_inexistent_lvs" test_construct_lvol_inexistent_lvs run_test "test_construct_lvol_full_lvs" test_construct_lvol_full_lvs run_test "test_construct_lvol_alias_conflict" test_construct_lvol_alias_conflict run_test "test_construct_nested_lvol" test_construct_nested_lvol +run_test "test_sigterm" test_sigterm trap - SIGINT SIGTERM EXIT -killprocess $spdk_pid +if ps -p $spdk_pid; then + killprocess $spdk_pid +fi diff --git a/test/lvol/lvol.sh b/test/lvol/lvol.sh index 6c6e6062e..7a42aec9b 100755 --- a/test/lvol/lvol.sh +++ b/test/lvol/lvol.sh @@ -37,7 +37,6 @@ function usage() { 655: 'thin_provisioning_filling_disks_less_than_lvs_size', 850: 'clear_method_none', 851: 'clear_method_unmap', - 10000: 'SIGTERM' or all: This parameter runs all tests Ex: \"1,2,19,20\", default: all" diff --git a/test/lvol/test_cases.py b/test/lvol/test_cases.py index 759ecd3d6..ac580433d 100644 --- a/test/lvol/test_cases.py +++ b/test/lvol/test_cases.py @@ -128,8 +128,6 @@ def case_message(func): # logical volume clear_method test 850: 'clear_method_none', 851: 'clear_method_unmap', - # SIGTERM - 10000: 'SIGTERM', } num = int(func.__name__.strip('test_case')[:]) print("************************************") @@ -1101,30 +1099,3 @@ class TestCases(object): # - get_bdevs: no change # - no other operation fails return fail_count - - @case_message - def test_case10000(self): - """ - SIGTERM - - Call CTRL+C (SIGTERM) occurs after creating lvol store - """ - pid_path = path.join(self.path, 'vhost.pid') - # Create malloc bdev - base_name = self.c.bdev_malloc_create(self.total_size, - self.block_size) - # Construct lvol store on created malloc bddev - uuid_store = self.c.bdev_lvol_create_lvstore(base_name, - self.lvs_name) - # Check correct uuid values in response bdev_lvol_get_lvstores command - fail_count = self.c.check_bdev_lvol_get_lvstores(base_name, uuid_store, - self.cluster_size) - - # Send SIGTERM signal to the application - fail_count += self._stop_vhost(pid_path) - - # Expected result: - # - calls successful, return code = 0 - # - bdev_get_bdevs: no change - # - no other operation fails - return fail_count