test/lvol: rewrite SIGTERM to bash

Change-Id: I6d98bd447030db361e8f702a481aa41b44780dfd
Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/702
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Pawel Kaminski 2019-12-13 16:31:33 -05:00 committed by Tomasz Zawadzki
parent 99a89f83a9
commit e8fa077f83
3 changed files with 14 additions and 31 deletions

View File

@ -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

View File

@ -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"

View File

@ -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