Commit 34ae1172 authored by Seth Howell's avatar Seth Howell Committed by Tomasz Zawadzki
Browse files

test/vhost: shell_restore_x -> xtrace_restore



The shell_Restore_x variable and xtrace_restore were attempting to
accomplish the exact same thing. However, when assigning
shell_restore_x, if -x was not set, then the assignment would result in
an error causing the scripts to fail.
So just get rid of that variable entirely and replace it with the more
robust xtrace_disable, xtrace_restore mechanism.

Change-Id: Ic823ad8433bd3dc181aaa0930297cd9d74bcf528
Signed-off-by: default avatarSeth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477966


Reviewed-by: default avatarKarol Latecki <karol.latecki@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
parent 190b2245
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -10,12 +10,10 @@ if [ -z "${DEPENDENCY_DIR}" ]; then
fi

function ssh_vm() {
	local shell_restore_x
	shell_restore_x="$( [[ "$-" =~ x ]] && echo 'set -x' )"
	set +x
	xtrace_disable
	sshpass -p "$password" ssh -o PubkeyAuthentication=no \
	-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p 10022 root@localhost "$@"
	$shell_restore_x
	xtrace_restore
}

function monitor_cmd() {
+11 −18
Original line number Diff line number Diff line
@@ -480,10 +480,8 @@ function vm_kill_all()
#
function vm_shutdown_all()
{
	local shell_restore_x
	shell_restore_x="$( [[ "$-" =~ x ]] && echo 'set -x' )"
	# XXX: temporally disable to debug shutdown issue
	# set +x
	# XXX: temporarily disable to debug shutdown issue
	# xtrace_disable

	local vms
	vms=$(vm_list_all)
@@ -506,7 +504,7 @@ function vm_shutdown_all()

		if [[ $all_vms_down == 1 ]]; then
			notice "All VMs successfully shut down"
			$shell_restore_x
			xtrace_restore
			return 0
		fi

@@ -516,15 +514,12 @@ function vm_shutdown_all()

	rm -rf $VM_DIR

	$shell_restore_x
	error "Timeout waiting for some VMs to shutdown"
	return 1
	xtrace_restore
}

function vm_setup()
{
	local shell_restore_x
	shell_restore_x="$( [[ "$-" =~ x ]] && echo 'set -x' )"
	xtrace_disable
	local OPTIND optchar vm_num

	local os=""
@@ -586,7 +581,7 @@ function vm_setup()
			local vm_dir="$VM_DIR/$i"
			[[ ! -d $vm_dir ]] && break
		done
		$shell_restore_x
		xtrace_restore

		vm_num=$i
	fi
@@ -683,7 +678,7 @@ function vm_setup()
		queue_number=$cpu_num
	fi

	$shell_restore_x
	xtrace_restore

	local node_num=${!qemu_numa_node_param}
	local boot_disk_present=false
@@ -913,9 +908,7 @@ function vm_wait_for_boot()
{
	assert_number $1

	local shell_restore_x
	shell_restore_x="$( [[ "$-" =~ x ]] && echo 'set -x' )"
	set +x
	xtrace_disable

	local all_booted=false
	local timeout_time=$1
@@ -943,14 +936,14 @@ function vm_wait_for_boot()
			if ! vm_is_running $vm_num; then
				warning "VM $vm_num is not running"
				vm_print_logs $vm_num
				$shell_restore_x
				xtrace_restore
				return 1
			fi

			if [[ $(date +%s) -gt $timeout_time ]]; then
				warning "timeout waiting for machines to boot"
				vm_print_logs $vm_num
				$shell_restore_x
				xtrace_restore
				return 1
			fi
			if (( i > 30 )); then
@@ -972,7 +965,7 @@ function vm_wait_for_boot()
	done

	notice "all VMs ready"
	$shell_restore_x
	xtrace_restore
	return 0
}

+2 −4
Original line number Diff line number Diff line
@@ -127,9 +127,7 @@ function vm_migrate()

function is_fio_running()
{
	local shell_restore_x
	shell_restore_x="$( [[ "$-" =~ x ]] && echo 'set -x' )"
	set +x
	xtrace_disable

	if vm_exec $1 'kill -0 $(cat /root/fio.pid)'; then
		local ret=0
@@ -137,7 +135,7 @@ function is_fio_running()
		local ret=1
	fi

	$shell_restore_x
	xtrace_restore
	return $ret
}