test/vhost: don't use global VHOST_APP in spdk_vhost_run

This is inconsisten with local variable deffining the same path. We need
also to move negative vhost app tests from run_vhost.sh since VHOST_APP
will not be available anymore.

Change-Id: I21cee58c545357ca7e7997cb529b15d436cfed57
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/387561
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
This commit is contained in:
Pawel Wodkowski 2017-11-15 14:56:07 +01:00 committed by Jim Harris
parent 4df5329092
commit 45caa6f859
5 changed files with 72 additions and 25 deletions

View File

@ -127,6 +127,9 @@ fi
if [ $SPDK_TEST_VHOST -eq 1 ]; then
timing_enter vhost
timing_enter negative
run_test ./test/vhost/spdk_vhost.sh --negative
timing_exit negative
if [ $RUN_NIGHTLY -eq 1 ]; then
timing_enter integrity_blk

View File

@ -8,7 +8,6 @@ BASE_DIR=$(readlink -f $(dirname $0))
COMMON_DIR="$(cd $BASE_DIR/../common && pwd)"
TEST_DIR="$(mkdir -p $TEST_DIR && cd $TEST_DIR && echo $PWD)"
SPDK_BUILD_DIR=$BASE_DIR/../../../
VHOST_APP=$SPDK_BUILD_DIR/app/vhost/vhost
SPDK_VHOST_SCSI_TEST_DIR=$TEST_DIR/vhost
@ -60,8 +59,8 @@ function spdk_vhost_run()
[[ -d $SPDK_VHOST_SCSI_TEST_DIR ]] && rm -f $SPDK_VHOST_SCSI_TEST_DIR/*
mkdir -p $SPDK_VHOST_SCSI_TEST_DIR
if [[ ! -x $VHOST_APP ]]; then
error "application not found: $VHOST_APP"
if [[ ! -x $vhost_app ]]; then
error "application not found: $vhost_app"
return 1
fi
@ -73,7 +72,7 @@ function spdk_vhost_run()
cp $vhost_conf_template $vhost_conf_file
$BASE_DIR/../../../scripts/gen_nvme.sh >> $vhost_conf_file
local cmd="$VHOST_APP -m $vhost_reactor_mask -p $vhost_master_core -c $vhost_conf_file"
local cmd="$vhost_app -m $vhost_reactor_mask -p $vhost_master_core -c $vhost_conf_file"
echo "INFO: Loging to: $vhost_log_file"
echo "INFO: Config file: $vhost_conf_file"

View File

@ -49,26 +49,5 @@ echo
. $COMMON_DIR/common.sh
echo "INFO: Testing vhost command line arguments"
# Printing help will force vhost to exit without error
$VHOST_APP -c /path/to/non_existing_file/conf -S $BASE_DIR -e 0x0 -s 1024 -d -q -h
# Testing vhost create pid file option. Vhost will exit with error as invalid config path is given
if $VHOST_APP -c /path/to/non_existing_file/conf -f $SPDK_VHOST_SCSI_TEST_DIR/vhost.pid; then
echo "vhost started when specifying invalid config file"
exit 1
fi
# Expecting vhost to fail if an incorrect argument is given
if $VHOST_APP -x -h; then
echo "vhost started with invalid -x command line option"
exit 1
fi
# Passing trace flags if spdk is build without CONFIG_DEBUG=y option make vhost exit with error
if ! $VHOST_APP -t vhost_scsi -h; then
echo "vhost did not started with trace flags enabled but ignoring this as it might not be a debug build"
fi
# Starting vhost with valid options
spdk_vhost_run $CONF_DIR

62
test/vhost/other/negative.sh Executable file
View File

@ -0,0 +1,62 @@
#!/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 running vhost app."
echo "Usage: $(basename $1) [-x] [-h|--help] [--clean-build] [--work-dir=PATH]"
echo "-h, --help print help and exit"
echo "-x Set -x for script debug"
echo " --work-dir=PATH Where to find source/project. [default=$TEST_DIR]"
exit 0
}
run_in_background=false
while getopts 'xh-:' optchar; do
case "$optchar" in
-)
case "$OPTARG" in
help) usage $0 ;;
work-dir=*) TEST_DIR="${OPTARG#*=}" ;;
conf-dir=*) CONF_DIR="${OPTARG#*=}" ;;
*) usage $0 echo "Invalid argument '$OPTARG'" ;;
esac
;;
h) usage $0 ;;
x) set -x ;;
*) usage $0 "Invalid argument '$optchar'" ;;
esac
done
. $COMMON_DIR/common.sh
trap error_exit ERR
VHOST_APP="$SPDK_BUILD_DIR/app/vhost/vhost"
echo "INFO: Testing vhost command line arguments"
# Printing help will force vhost to exit without error
$VHOST_APP -c /path/to/non_existing_file/conf -S $BASE_DIR -e 0x0 -s 1024 -d -q -h
# Testing vhost create pid file option. Vhost will exit with error as invalid config path is given
if $VHOST_APP -c /path/to/non_existing_file/conf -f $SPDK_VHOST_SCSI_TEST_DIR/vhost.pid; then
echo "vhost started when specifying invalid config file"
exit 1
fi
# Expecting vhost to fail if an incorrect argument is given
if $VHOST_APP -x -h; then
echo "vhost started with invalid -x command line option"
exit 1
fi
# Passing trace flags if spdk is build without CONFIG_DEBUG=y option make vhost exit with error
if ! $VHOST_APP -t vhost_scsi -h; then
echo "vhost did not started with trace flags enabled but ignoring this as it might not be a debug build"
fi

View File

@ -50,6 +50,10 @@ WORKDIR=$(dirname $0)
cd $WORKDIR
case $1 in
-n|--negative)
echo 'Negative tests suite...'
./other/negative.sh
;;
-p|--performance)
echo 'Running performance suite...'
./fiotest/autotest.sh --fio-bin=/home/sys_sgsw/fio_ubuntu \