vhost: improve app vhost.c test coverage

Change-Id: I5e19d7ff6cc38e08fa4d7aebd5cc2a9c74fd5175
Signed-off-by: Pawel Niedzwiecki <pawelx.niedzwiecki@intel.com>
Reviewed-on: https://review.gerrithub.io/370952
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Pawel Niedzwiecki 2017-07-24 19:08:32 +02:00 committed by Daniel Verkamp
parent 7b3c6fbd40
commit 9fdc10fc56
2 changed files with 26 additions and 4 deletions

View File

@ -11,6 +11,7 @@ TEST_DIR="$(mkdir -p $TEST_DIR && cd $TEST_DIR && echo $PWD)"
SPDK_SRC_DIR=$TEST_DIR/spdk
SPDK_BUILD_DIR=$BASE_DIR/../../../
VHOST_APP=$SPDK_BUILD_DIR/app/vhost/vhost
SPDK_VHOST_SCSI_TEST_DIR=$TEST_DIR/vhost
@ -124,7 +125,6 @@ function spdk_build_and_install()
function spdk_vhost_run()
{
local vhost_app="$SPDK_BUILD_DIR/app/vhost/vhost"
local vhost_log_file="$SPDK_VHOST_SCSI_TEST_DIR/vhost.log"
local vhost_pid_file="$SPDK_VHOST_SCSI_TEST_DIR/vhost.pid"
local vhost_socket="$SPDK_VHOST_SCSI_TEST_DIR/usvhost"
@ -135,8 +135,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
@ -148,7 +148,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

@ -46,4 +46,26 @@ echo
. $BASE_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