test/vhost: Clean up data outside of repository after tests
The vhost tests create some temporary files as they run outside of the SPDK repostiroy. Clean these up. Change-Id: Ic964fc6672b8a4ea088ace1b11c712eb70f7be08 Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454933 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
6de97c1a91
commit
ad15da1317
@ -4,13 +4,10 @@ set -e
|
|||||||
: ${QEMU_PREFIX="/usr/local/qemu/spdk-3.0.0"}
|
: ${QEMU_PREFIX="/usr/local/qemu/spdk-3.0.0"}
|
||||||
|
|
||||||
BASE_DIR=$(readlink -f $(dirname ${BASH_SOURCE[0]}))
|
BASE_DIR=$(readlink -f $(dirname ${BASH_SOURCE[0]}))
|
||||||
|
|
||||||
# Default running dir -> spdk/..
|
|
||||||
[[ -z "$TEST_DIR" ]] && TEST_DIR=$BASE_DIR/../../../
|
|
||||||
|
|
||||||
TEST_DIR="$(mkdir -p $TEST_DIR && cd $TEST_DIR && echo $PWD)"
|
|
||||||
SPDK_BUILD_DIR=$BASE_DIR/../../
|
SPDK_BUILD_DIR=$BASE_DIR/../../
|
||||||
|
|
||||||
|
TEST_DIR=$(readlink -f $SPDK_BUILD_DIR/..)
|
||||||
|
|
||||||
SPDK_VHOST_SCSI_TEST_DIR=$TEST_DIR/vhost
|
SPDK_VHOST_SCSI_TEST_DIR=$TEST_DIR/vhost
|
||||||
|
|
||||||
# SSH key file
|
# SSH key file
|
||||||
@ -23,7 +20,6 @@ echo "Using SSH key file $SPDK_VHOST_SSH_KEY_FILE"
|
|||||||
|
|
||||||
VM_BASE_DIR="$TEST_DIR/vms"
|
VM_BASE_DIR="$TEST_DIR/vms"
|
||||||
|
|
||||||
|
|
||||||
mkdir -p $TEST_DIR
|
mkdir -p $TEST_DIR
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -464,6 +460,7 @@ function vm_kill()
|
|||||||
if /bin/kill $vm_pid; then
|
if /bin/kill $vm_pid; then
|
||||||
notice "process $vm_pid killed"
|
notice "process $vm_pid killed"
|
||||||
rm $vm_dir/qemu.pid
|
rm $vm_dir/qemu.pid
|
||||||
|
rm -rf $vm_dir
|
||||||
elif vm_is_running $1; then
|
elif vm_is_running $1; then
|
||||||
error "Process $vm_pid NOT killed"
|
error "Process $vm_pid NOT killed"
|
||||||
return 1
|
return 1
|
||||||
@ -488,6 +485,8 @@ function vm_kill_all()
|
|||||||
for vm in $(vm_list_all); do
|
for vm in $(vm_list_all); do
|
||||||
vm_kill $vm
|
vm_kill $vm
|
||||||
done
|
done
|
||||||
|
|
||||||
|
rm -rf $VM_BASE_DIR
|
||||||
}
|
}
|
||||||
|
|
||||||
# Shutdown all VM in $VM_BASE_DIR
|
# Shutdown all VM in $VM_BASE_DIR
|
||||||
@ -526,6 +525,8 @@ function vm_shutdown_all()
|
|||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
|
rm -rf $VM_BASE_DIR
|
||||||
|
|
||||||
$shell_restore_x
|
$shell_restore_x
|
||||||
error "Timeout waiting for some VMs to shutdown"
|
error "Timeout waiting for some VMs to shutdown"
|
||||||
return 1
|
return 1
|
||||||
|
@ -46,6 +46,7 @@ $VHOST_APP -c /path/to/non_existing_file/conf -S $testdir -e 0x0 -s 1024 -d -h -
|
|||||||
if $VHOST_APP -c /path/to/non_existing_file/conf -f $SPDK_VHOST_SCSI_TEST_DIR/vhost.pid; then
|
if $VHOST_APP -c /path/to/non_existing_file/conf -f $SPDK_VHOST_SCSI_TEST_DIR/vhost.pid; then
|
||||||
fail "vhost started when specifying invalid config file"
|
fail "vhost started when specifying invalid config file"
|
||||||
fi
|
fi
|
||||||
|
rm -f $SPDK_VHOST_SCSI_TEST_DIR/vhost.pid
|
||||||
|
|
||||||
# Testing vhost start with invalid config. Vhost will exit with error as bdev module init failed
|
# Testing vhost start with invalid config. Vhost will exit with error as bdev module init failed
|
||||||
if $VHOST_APP -c $testdir/invalid.config; then
|
if $VHOST_APP -c $testdir/invalid.config; then
|
||||||
|
Loading…
Reference in New Issue
Block a user