Commit ad15da13 authored by Ben Walker's avatar Ben Walker Committed by Jim Harris
Browse files

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: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454933


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 6de97c1a
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -4,13 +4,10 @@ set -e
: ${QEMU_PREFIX="/usr/local/qemu/spdk-3.0.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/../../

TEST_DIR=$(readlink -f $SPDK_BUILD_DIR/..)

SPDK_VHOST_SCSI_TEST_DIR=$TEST_DIR/vhost

# SSH key file
@@ -23,7 +20,6 @@ echo "Using SSH key file $SPDK_VHOST_SSH_KEY_FILE"

VM_BASE_DIR="$TEST_DIR/vms"


mkdir -p $TEST_DIR

#
@@ -464,6 +460,7 @@ function vm_kill()
	if /bin/kill $vm_pid; then
		notice "process $vm_pid killed"
		rm $vm_dir/qemu.pid
		rm -rf $vm_dir
	elif vm_is_running $1; then
		error "Process $vm_pid NOT killed"
		return 1
@@ -488,6 +485,8 @@ function vm_kill_all()
	for vm in $(vm_list_all); do
		vm_kill $vm
	done

	rm -rf $VM_BASE_DIR
}

# Shutdown all VM in $VM_BASE_DIR
@@ -526,6 +525,8 @@ function vm_shutdown_all()
		sleep 1
	done

	rm -rf $VM_BASE_DIR

	$shell_restore_x
	error "Timeout waiting for some VMs to shutdown"
	return 1
+1 −0
Original line number Diff line number Diff line
@@ -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
	fail "vhost started when specifying invalid config file"
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
if $VHOST_APP -c $testdir/invalid.config; then