test/lvol: remove legacy BASE_DIR globals
Replace them with `testdir` and `rootdir` that we use in every other test. What was a BASE_DIR before is now a testdir and what was a TEST_DIR is now a rootdir. While here, also move autotest_common.sh include to the top of the file. Change-Id: Ie15b7ec14bfb7536bcc7b3787eed930798d24c78 Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457464 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
This commit is contained in:
parent
fafd4ec9fe
commit
fb4ed96728
@ -1,14 +1,17 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
BASE_DIR=$(readlink -f $(dirname $0))
|
|
||||||
[[ -z "$TEST_DIR" ]] && TEST_DIR="$(cd $BASE_DIR/../../ && pwd)"
|
testdir=$(readlink -f $(dirname $0))
|
||||||
|
rootdir=$(readlink -f $testdir/../..)
|
||||||
|
source $rootdir/test/common/autotest_common.sh
|
||||||
|
|
||||||
total_size=256
|
total_size=256
|
||||||
block_size=512
|
block_size=512
|
||||||
test_cases=all
|
test_cases=all
|
||||||
x=""
|
x=""
|
||||||
|
|
||||||
rpc_py="$TEST_DIR/scripts/rpc.py "
|
rpc_py="$rootdir/scripts/rpc.py "
|
||||||
|
|
||||||
function usage() {
|
function usage() {
|
||||||
[[ ! -z $2 ]] && ( echo "$2"; echo ""; )
|
[[ ! -z $2 ]] && ( echo "$2"; echo ""; )
|
||||||
@ -104,15 +107,13 @@ while getopts 'xh-:' optchar; do
|
|||||||
done
|
done
|
||||||
shift $(( OPTIND - 1 ))
|
shift $(( OPTIND - 1 ))
|
||||||
|
|
||||||
source $TEST_DIR/test/common/autotest_common.sh
|
|
||||||
|
|
||||||
### Function starts vhost app
|
### Function starts vhost app
|
||||||
function vhost_start()
|
function vhost_start()
|
||||||
{
|
{
|
||||||
modprobe nbd
|
modprobe nbd
|
||||||
$TEST_DIR/app/vhost/vhost &
|
$rootdir/app/vhost/vhost &
|
||||||
vhost_pid=$!
|
vhost_pid=$!
|
||||||
echo $vhost_pid > $BASE_DIR/vhost.pid
|
echo $vhost_pid > $testdir/vhost.pid
|
||||||
waitforlisten $vhost_pid
|
waitforlisten $vhost_pid
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,18 +121,18 @@ function vhost_start()
|
|||||||
function vhost_kill()
|
function vhost_kill()
|
||||||
{
|
{
|
||||||
### Kill with SIGKILL param
|
### Kill with SIGKILL param
|
||||||
if pkill -F $BASE_DIR/vhost.pid; then
|
if pkill -F $testdir/vhost.pid; then
|
||||||
sleep 1
|
sleep 1
|
||||||
fi
|
fi
|
||||||
rm $BASE_DIR/vhost.pid || true
|
rm $testdir/vhost.pid || true
|
||||||
}
|
}
|
||||||
|
|
||||||
trap "vhost_kill; rm -f $BASE_DIR/aio_bdev_0 $BASE_DIR/aio_bdev_1; exit 1" SIGINT SIGTERM EXIT
|
trap "vhost_kill; rm -f $testdir/aio_bdev_0 $testdir/aio_bdev_1; exit 1" SIGINT SIGTERM EXIT
|
||||||
|
|
||||||
truncate -s 400M $BASE_DIR/aio_bdev_0 $BASE_DIR/aio_bdev_1
|
truncate -s 400M $testdir/aio_bdev_0 $testdir/aio_bdev_1
|
||||||
vhost_start
|
vhost_start
|
||||||
$BASE_DIR/lvol_test.py $rpc_py $total_size $block_size $BASE_DIR $TEST_DIR/app/vhost "${test_cases[@]}"
|
$testdir/lvol_test.py $rpc_py $total_size $block_size $testdir $rootdir/app/vhost "${test_cases[@]}"
|
||||||
|
|
||||||
vhost_kill
|
vhost_kill
|
||||||
rm -rf $BASE_DIR/aio_bdev_0 $BASE_DIR/aio_bdev_1
|
rm -rf $testdir/aio_bdev_0 $testdir/aio_bdev_1
|
||||||
trap - SIGINT SIGTERM EXIT
|
trap - SIGINT SIGTERM EXIT
|
||||||
|
Loading…
Reference in New Issue
Block a user