Lukasz Galka 3d738d4569 test/vhost: move fiotest functions to common directory
Move files from test/vhost/fiotest to test/vhost/common.
Scripts and functions from fio tests will be re-used in
any new test scripts.

Change-Id: I2423d636d41dcb2b2af12987769961607e969392
Signed-off-by: Lukasz Galka <lukaszx.galka@intel.com>
Reviewed-on: https://review.gerrithub.io/372545
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-05 13:54:47 -04:00

50 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
BASE_DIR=$(readlink -f $(dirname $0))
[[ -z "$COMMON_DIR" ]] && COMMON_DIR="$(cd $BASE_DIR/../common && pwd)"
[[ -z "$TEST_DIR" ]] && TEST_DIR="$(cd $BASE_DIR/../../../../ && pwd)"
function usage()
{
[[ ! -z $2 ]] && ( echo "$2"; echo ""; )
echo "Shortcut script for enabling VMs"
echo "Usage: $(basename $1) [OPTIONS] VM..."
echo
echo "-h, --help print help and exit"
echo " --work-dir=WORK_DIR Where to find build file. Must exist. [default: ./..]"
echo "-a Run all VMs in WORK_DIR"
echo "-x set -x for script debug"
exit 0
}
run_all=false
while getopts 'xah-:' optchar; do
case "$optchar" in
-)
case "$OPTARG" in
help) usage $0 ;;
work-dir=*) TEST_DIR="${OPTARG#*=}" ;;
*) usage $0 "Invalid argument '$OPTARG'" ;;
esac
;;
h) usage $0 ;;
a) run_all=true ;;
x) set -x ;;
*) usage $0 "Invalid argument '$OPTARG'"
esac
done
. $COMMON_DIR/common.sh
if [[ $EUID -ne 0 ]]; then
echo "Go away user come back as root"
exit 1
fi
if $run_all; then
vm_run -a
else
shift $((OPTIND-1))
echo "INFO: running VMs: $@"
vm_run "$@"
fi