From 6f7cb2ad58ad545cb4be9f0cb089425d1f726c73 Mon Sep 17 00:00:00 2001 From: Pawel Kaminski Date: Wed, 5 Feb 2020 09:24:09 -0500 Subject: [PATCH] test/vhost: Move negative tests from nightly to per-patch. Change-Id: Ia679f176f84b1d461f6bcc69b3fd509b6f7a66d1 Signed-off-by: Pawel Kaminski Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/556 Reviewed-by: Karol Latecki Reviewed-by: Maciej Wawryk Reviewed-by: Shuhei Matsumoto Reviewed-by: Darek Stojaczyk Tested-by: SPDK CI Jenkins --- test/vhost/other/negative.sh | 201 +++++++++++++++++------------------ 1 file changed, 99 insertions(+), 102 deletions(-) diff --git a/test/vhost/other/negative.sh b/test/vhost/other/negative.sh index a28ec798c..6566b07d7 100755 --- a/test/vhost/other/negative.sh +++ b/test/vhost/other/negative.sh @@ -63,109 +63,106 @@ if ! $VHOST_APP -t vhost_scsi -h; then warning "vhost did not started with trace flags enabled but ignoring this as it might not be a debug build" fi -if [[ $RUN_NIGHTLY -eq 1 ]]; then - # Run with valid config and try some negative rpc calls - notice "===============" - notice "" - notice "running SPDK" - notice "" - vhost_run 0 - vhost_load_config 0 $testdir/conf.json - notice "" +# Run with valid config and try some negative rpc calls +notice "===============" +notice "" +notice "running SPDK" +notice "" +vhost_run 0 +vhost_load_config 0 $testdir/conf.json +notice "" +rpc_py="$rootdir/scripts/rpc.py -s $(get_vhost_dir 0)/rpc.sock" - rpc_py="$rootdir/scripts/rpc.py -s $(get_vhost_dir 0)/rpc.sock" - - # Try to get nonexistent vhost controller - if $rpc_py vhost_get_controllers -n nonexistent; then - error "vhost returned controller that does not exist" - fi - - notice "Set coalescing for nonexistent controller" - if $rpc_py vhost_controller_set_coalescing nonexistent 1 100; then - error "Set coalescing for nonexistent controller should fail" - fi - - # General commands - notice "Trying to remove nonexistent controller" - if $rpc_py vhost_delete_controller unk0 > /dev/null; then - error "Removing nonexistent controller succeeded, but it shouldn't" - fi - - # SCSI - notice "Trying to create scsi controller with incorrect cpumask" - if $rpc_py vhost_create_scsi_controller vhost.invalid.cpumask --cpumask 0x2; then - error "Creating scsi controller with incorrect cpumask succeeded, but it shouldn't" - fi - - notice "Trying to remove device from nonexistent scsi controller" - if $rpc_py vhost_scsi_controller_remove_target vhost.nonexistent.name 0; then - error "Removing device from nonexistent scsi controller succeeded, but it shouldn't" - fi - - notice "Trying to add device to nonexistent scsi controller" - if $rpc_py vhost_scsi_controller_add_target vhost.nonexistent.name 0 Malloc0; then - error "Adding device to nonexistent scsi controller succeeded, but it shouldn't" - fi - - notice "Trying to create scsi controller with incorrect name" - if $rpc_py vhost_create_scsi_controller .; then - error "Creating scsi controller with incorrect name succeeded, but it shouldn't" - fi - - notice "Creating controller naa.0" - $rpc_py vhost_create_scsi_controller naa.0 - - notice "Pass invalid parameter for vhost_controller_set_coalescing" - if $rpc_py vhost_controller_set_coalescing naa.0 -1 100; then - error "Set coalescing with invalid parameter should fail" - fi - - notice "Trying to add nonexistent device to scsi controller" - if $rpc_py vhost_scsi_controller_add_target naa.0 0 nonexistent_bdev; then - error "Adding nonexistent device to scsi controller succeeded, but it shouldn't" - fi - - notice "Adding initial device (0) to naa.0" - $rpc_py vhost_scsi_controller_add_target naa.0 0 Malloc0 - - notice "Trying to remove nonexistent device on existing controller" - if $rpc_py vhost_scsi_controller_remove_target naa.0 1 > /dev/null; then - error "Removing nonexistent device (1) from controller naa.0 succeeded, but it shouldn't" - fi - - notice "Trying to remove existing device from a controller" - $rpc_py vhost_scsi_controller_remove_target naa.0 0 - - notice "Trying to remove a just-deleted device from a controller again" - if $rpc_py vhost_scsi_controller_remove_target naa.0 0 > /dev/null; then - error "Removing device 0 from controller naa.0 succeeded, but it shouldn't" - fi - - notice "Re-adding device 0 to naa.0" - $rpc_py vhost_scsi_controller_add_target naa.0 0 Malloc0 - - # BLK - notice "Trying to create block controller with incorrect cpumask" - if $rpc_py vhost_create_blk_controller vhost.invalid.cpumask Malloc0 --cpumask 0x2; then - error "Creating block controller with incorrect cpumask succeeded, but it shouldn't" - fi - - notice "Trying to remove nonexistent block controller" - if $rpc_py vhost_delete_controller vhost.nonexistent.name; then - error "Removing nonexistent block controller succeeded, but it shouldn't" - fi - - notice "Trying to create block controller with incorrect name" - if $rpc_py vhost_create_blk_controller . Malloc0; then - error "Creating block controller with incorrect name succeeded, but it shouldn't" - fi - - notice "Testing done -> shutting down" - notice "killing vhost app" - vhost_kill 0 - - notice "EXIT DONE" - notice "===============" +# Try to get nonexistent vhost controller +if $rpc_py vhost_get_controllers -n nonexistent; then + error "vhost returned controller that does not exist" fi +notice "Set coalescing for nonexistent controller" +if $rpc_py vhost_controller_set_coalescing nonexistent 1 100; then + error "Set coalescing for nonexistent controller should fail" +fi + +# General commands +notice "Trying to remove nonexistent controller" +if $rpc_py vhost_delete_controller unk0 > /dev/null; then + error "Removing nonexistent controller succeeded, but it shouldn't" +fi + +# SCSI +notice "Trying to create scsi controller with incorrect cpumask" +if $rpc_py vhost_create_scsi_controller vhost.invalid.cpumask --cpumask 0x2; then + error "Creating scsi controller with incorrect cpumask succeeded, but it shouldn't" +fi + +notice "Trying to remove device from nonexistent scsi controller" +if $rpc_py vhost_scsi_controller_remove_target vhost.nonexistent.name 0; then + error "Removing device from nonexistent scsi controller succeeded, but it shouldn't" +fi + +notice "Trying to add device to nonexistent scsi controller" +if $rpc_py vhost_scsi_controller_add_target vhost.nonexistent.name 0 Malloc0; then + error "Adding device to nonexistent scsi controller succeeded, but it shouldn't" +fi + +notice "Trying to create scsi controller with incorrect name" +if $rpc_py vhost_create_scsi_controller .; then + error "Creating scsi controller with incorrect name succeeded, but it shouldn't" +fi + +notice "Creating controller naa.0" +$rpc_py vhost_create_scsi_controller naa.0 + +notice "Pass invalid parameter for vhost_controller_set_coalescing" +if $rpc_py vhost_controller_set_coalescing naa.0 -1 100; then + error "Set coalescing with invalid parameter should fail" +fi + +notice "Trying to add nonexistent device to scsi controller" +if $rpc_py vhost_scsi_controller_add_target naa.0 0 nonexistent_bdev; then + error "Adding nonexistent device to scsi controller succeeded, but it shouldn't" +fi + +notice "Adding initial device (0) to naa.0" +$rpc_py vhost_scsi_controller_add_target naa.0 0 Malloc0 + +notice "Trying to remove nonexistent device on existing controller" +if $rpc_py vhost_scsi_controller_remove_target naa.0 1 > /dev/null; then + error "Removing nonexistent device (1) from controller naa.0 succeeded, but it shouldn't" +fi + +notice "Trying to remove existing device from a controller" +$rpc_py vhost_scsi_controller_remove_target naa.0 0 + +notice "Trying to remove a just-deleted device from a controller again" +if $rpc_py vhost_scsi_controller_remove_target naa.0 0 > /dev/null; then + error "Removing device 0 from controller naa.0 succeeded, but it shouldn't" +fi + +notice "Re-adding device 0 to naa.0" +$rpc_py vhost_scsi_controller_add_target naa.0 0 Malloc0 + +# BLK +notice "Trying to create block controller with incorrect cpumask" +if $rpc_py vhost_create_blk_controller vhost.invalid.cpumask Malloc0 --cpumask 0x2; then + error "Creating block controller with incorrect cpumask succeeded, but it shouldn't" +fi + +notice "Trying to remove nonexistent block controller" +if $rpc_py vhost_delete_controller vhost.nonexistent.name; then + error "Removing nonexistent block controller succeeded, but it shouldn't" +fi + +notice "Trying to create block controller with incorrect name" +if $rpc_py vhost_create_blk_controller . Malloc0; then + error "Creating block controller with incorrect name succeeded, but it shouldn't" +fi + +notice "Testing done -> shutting down" +notice "killing vhost app" +vhost_kill 0 + +notice "EXIT DONE" +notice "===============" + vhosttestfini