test/common: add NOT() utility function
Change-Id: Idde98fbbf7ff1f66caf4e46d217baf62b78a2e2a Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1152 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
52330a6b60
commit
c29329fe21
@ -378,6 +378,13 @@ function rpc_cmd_simple_data_json() {
|
|||||||
(( ${#jq_out[@]} > 0 )) || return 1
|
(( ${#jq_out[@]} > 0 )) || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# invert error code of any command and also trigger ERR on 0 (unlike bash ! prefix)
|
||||||
|
function NOT() {
|
||||||
|
if "$@"; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function timing() {
|
function timing() {
|
||||||
direction="$1"
|
direction="$1"
|
||||||
testname="$2"
|
testname="$2"
|
||||||
|
@ -17,7 +17,7 @@ function test_construct_lvs() {
|
|||||||
|
|
||||||
# try to destroy inexistent lvs, this should obviously fail
|
# try to destroy inexistent lvs, this should obviously fail
|
||||||
dummy_uuid="00000000-0000-0000-0000-000000000000"
|
dummy_uuid="00000000-0000-0000-0000-000000000000"
|
||||||
rpc_cmd bdev_lvol_delete_lvstore -u "$dummy_uuid" && false
|
NOT rpc_cmd bdev_lvol_delete_lvstore -u "$dummy_uuid"
|
||||||
# our lvs should not be impacted
|
# our lvs should not be impacted
|
||||||
rpc_cmd bdev_lvol_get_lvstores -u "$lvs_uuid"
|
rpc_cmd bdev_lvol_get_lvstores -u "$lvs_uuid"
|
||||||
|
|
||||||
@ -35,9 +35,9 @@ function test_construct_lvs() {
|
|||||||
|
|
||||||
# remove the lvs and verify it's gone
|
# remove the lvs and verify it's gone
|
||||||
rpc_cmd bdev_lvol_delete_lvstore -u "$lvs_uuid"
|
rpc_cmd bdev_lvol_delete_lvstore -u "$lvs_uuid"
|
||||||
rpc_cmd bdev_lvol_get_lvstores -u "$lvs_uuid" && false
|
NOT rpc_cmd bdev_lvol_get_lvstores -u "$lvs_uuid"
|
||||||
# make sure we can't delete the same lvs again
|
# make sure we can't delete the same lvs again
|
||||||
rpc_cmd bdev_lvol_delete_lvstore -u "$lvs_uuid" && false
|
NOT rpc_cmd bdev_lvol_delete_lvstore -u "$lvs_uuid"
|
||||||
|
|
||||||
rpc_cmd bdev_malloc_delete "$malloc_name"
|
rpc_cmd bdev_malloc_delete "$malloc_name"
|
||||||
check_leftover_devices
|
check_leftover_devices
|
||||||
|
Loading…
Reference in New Issue
Block a user