Commit 5b03ae4e authored by Michal Berger's avatar Michal Berger Committed by Ben Walker
Browse files

test/common: vm_setup.sh cleanup



Some minor code shuffle + removal of the autorun-spdk.conf creation.
Creating this config has little sense as some of these flags cannot
be used together anyway - it basically serves as a dump of all
supported flags which we usually are having a hard time to keep up
to date. That said, autotest_common.sh (and get_config_params())
gives a better view as to what flags are actually supported and
how they are used in practice.

Signed-off-by: default avatarMichal Berger <michal.berger@intel.com>
Change-Id: Ib223ec90be58e68ecab69176d213c353df530498
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16925


Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarKarol Latecki <karol.latecki@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 66e0ed8e
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ install() {
}

upgrade() {
	sudo "$package_manager" update
	update
	sudo "$package_manager" upgrade -y
}

@@ -44,7 +44,6 @@ packages=(
	gdb
	fio
	libaio-dev
	linux-headers-generic
	libgflags-dev
	autoconf
	automake
@@ -94,6 +93,10 @@ install_vagrant_dependencies() {
	install "${vagrant_packages[@]}"
}

if [[ $OSID != ubuntu ]]; then
	echo "Located apt-get package manager, but it was tested for Ubuntu only"
if [[ $OSID == debian ]]; then
	packages+=("linux-headers-$kernel_ver-*")
else
	packages+=(linux-headers-generic)
fi

export DEBIAN_FRONTEND=noninteractive
+17 −76
Original line number Diff line number Diff line
@@ -3,23 +3,10 @@
#  Copyright (C) 2017 Intel Corporation
#  All rights reserved.
#
# Virtual Machine environment requirements:
# 8 GiB of RAM (for DPDK)
# enable intel_kvm on your host machine

# The purpose of this script is to provide a simple procedure for spinning up a new
# virtual test environment capable of running our whole test suite. This script, when
# applied to a fresh install of fedora 26 or ubuntu 16,18 server will install all of the
# necessary dependencies to run almost the complete test suite. The main exception being VHost.
# Vhost requires the configuration of a second virtual machine. instructions for how to configure
# that vm are included in the file TEST_ENV_SETUP_README inside this repository

# it is important to enable nesting for vms in kernel command line of your machine for the vhost tests.
#     in /etc/default/grub
#     append the following to the GRUB_CMDLINE_LINUX line
#     intel_iommu=on kvm-intel.nested=1

# We have made a lot of progress with removing hardcoded paths from the tests,
# test environment capable of running our whole test suite. This script will install
# all of the necessary dependencies to run almost the complete test suite.

sudo() {
	"$(type -P sudo)" -E "$@"
@@ -28,8 +15,6 @@ sudo() {
set -e
shopt -s extglob

VM_SETUP_PATH=$(readlink -f ${BASH_SOURCE%/*})

UPGRADE=false
INSTALL=false
CONF="rocksdb,fio,flamegraph,tsocks,qemu,libiscsi,nvmecli,qat,spdk,refspdk,vagrant,igb_uio,ice"
@@ -51,12 +36,12 @@ function usage() {
	echo "  -c --conf-path Path to configuration file"
	echo "  -d --dir-git Path to where git sources should be saved"
	echo "  -s --disable-tsocks Disable use of tsocks"
	exit ${1:-0}
}

function error() {
	printf "%s\n\n" "$1" >&2
	usage 1
	usage
	return 1
}

function set_os_id_version() {
@@ -71,7 +56,7 @@ function set_os_id_version() {
		VERSION_ID=${VERSION_ID//.*/}
	else
		echo "File os-release not found" >&2
		exit 3
		return 1
	fi

	OSID=$ID
@@ -92,8 +77,6 @@ function detect_package_manager() {
			return
		fi
	done

	package_manager="undefined"
}

vmsetupdir=$(readlink -f "$(dirname "$0")")
@@ -101,6 +84,7 @@ rootdir=$(readlink -f "$vmsetupdir/../../../")
source "$rootdir/scripts/common.sh"

set_os_id_version
source "$vmsetupdir/pkgdep/git"
detect_package_manager

if [[ -e $vmsetupdir/pkgdep/os/$OSID ]]; then
@@ -112,7 +96,10 @@ while getopts 'd:siuht:c:-:' optchar; do
	case "$optchar" in
		-)
			case "$OPTARG" in
				help) usage ;;
				help)
					usage
					exit 0
					;;
				upgrade) UPGRADE=true ;;
				install-deps) INSTALL=true ;;
				test-conf=*) CONF="${OPTARG#*=}" ;;
@@ -122,7 +109,10 @@ while getopts 'd:siuht:c:-:' optchar; do
				*) error "Invalid argument '$OPTARG'" ;;
			esac
			;;
		h) usage ;;
		h)
			usage
			exit 0
			;;
		u) UPGRADE=true ;;
		i) INSTALL=true ;;
		t) CONF="$OPTARG" ;;
@@ -133,22 +123,17 @@ while getopts 'd:siuht:c:-:' optchar; do
	esac
done

if [[ $package_manager == undefined ]]; then
if [[ -z $package_manager ]]; then
	echo "Supported package manager not found. Script supports:"
	printf " * %s\n" "${manager_scripts[@]##*/}"
	exit 1
fi

if [[ $package_manager == apt-get ]]; then
	export DEBIAN_FRONTEND=noninteractive
fi

if [[ -n $CONF_PATH ]]; then
	if [[ -f $CONF_PATH ]]; then
		source "$CONF_PATH"
	else
	if [[ ! -f $CONF_PATH ]]; then
		error "Configuration file does not exist: '$CONF_PATH'"
	fi
	source "$CONF_PATH"
fi

if $UPGRADE; then
@@ -161,48 +146,4 @@ if $INSTALL; then
	install "${packages[@]}"
fi

source "$vmsetupdir/pkgdep/git"
install_sources

# create autorun-spdk.conf in home folder. This is sourced by the autotest_common.sh file.
# By setting any one of the values below to 0, you can skip that specific test. If you are
# using your autotest platform to do sanity checks before uploading to the build pool, it is
# probably best to only run the tests that you believe your changes have modified along with
# Scanbuild and check format. This is because running the whole suite of tests in series can
# take ~40 minutes to complete.
if [[ ! -e ~/autorun-spdk.conf ]]; then
	cat > ~/autorun-spdk.conf << EOF
# assign a value of 1 to all of the pertinent tests
SPDK_RUN_VALGRIND=1
SPDK_TEST_CRYPTO=1
SPDK_RUN_FUNCTIONAL_TEST=1
SPDK_TEST_AUTOBUILD="full"
SPDK_TEST_UNITTEST=1
SPDK_TEST_ISCSI=1
SPDK_TEST_ISCSI_INITIATOR=1
SPDK_TEST_NVME=1
SPDK_TEST_NVME_PMR=1
SPDK_TEST_NVME_SCC=1
SPDK_TEST_NVME_BP=1
SPDK_TEST_NVME_CLI=1
SPDK_TEST_NVMF=1
SPDK_TEST_NVMF_MDNS=1
SPDK_TEST_VFIOUSER=1
SPDK_TEST_RBD=1
SPDK_TEST_BLOCKDEV=1
SPDK_TEST_BLOBFS=1
SPDK_TEST_LVOL=1
SPDK_TEST_NVME_CUSE=1
SPDK_TEST_BLOBFS=1
SPDK_TEST_URING=1
SPDK_RUN_ASAN=1
SPDK_RUN_UBSAN=1
# doesn't work on vm
SPDK_TEST_IOAT=0
# requires some extra configuration. see TEST_ENV_SETUP_README
SPDK_TEST_VHOST=0
SPDK_TEST_VHOST_INIT=0
SPDK_TEST_DAOS=0

EOF
fi