2018-08-23 07:19:20 +00:00
|
|
|
#!/usr/bin/env bash
|
2022-11-02 15:49:40 +00:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
# Copyright (C) 2018 Intel Corporation
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
2018-08-23 07:19:20 +00:00
|
|
|
testdir=$(readlink -f $(dirname $0))
|
|
|
|
rootdir=$(readlink -f $testdir/../../..)
|
|
|
|
source $rootdir/test/common/autotest_common.sh
|
|
|
|
source $rootdir/test/iscsi_tgt/common.sh
|
|
|
|
|
2020-08-11 10:36:11 +00:00
|
|
|
iscsitestinit
|
2019-05-06 22:46:30 +00:00
|
|
|
|
2018-08-23 07:19:20 +00:00
|
|
|
MALLOC_BDEV_SIZE=64
|
|
|
|
MALLOC_BLOCK_SIZE=512
|
|
|
|
|
|
|
|
timing_enter start_iscsi_tgt
|
|
|
|
|
2020-02-20 10:24:53 +00:00
|
|
|
"${ISCSI_APP[@]}" -m 0x2 -p 1 -s 512 --wait-for-rpc &
|
2018-08-23 07:19:20 +00:00
|
|
|
pid=$!
|
|
|
|
echo "iSCSI target launched. pid: $pid"
|
2020-08-11 10:36:11 +00:00
|
|
|
trap 'killprocess $pid; iscsitestfini; exit 1' SIGINT SIGTERM EXIT
|
2018-08-23 07:19:20 +00:00
|
|
|
waitforlisten $pid
|
2019-09-11 11:15:34 +00:00
|
|
|
$rpc_py iscsi_set_options -o 30 -a 4
|
2018-08-23 07:19:20 +00:00
|
|
|
# Minimal number of bdev io pool (5) and cache (1)
|
2019-09-20 09:04:58 +00:00
|
|
|
$rpc_py bdev_set_options -p 5 -c 1
|
2019-09-11 13:30:14 +00:00
|
|
|
$rpc_py framework_start_init
|
2018-08-23 07:19:20 +00:00
|
|
|
echo "iscsi_tgt is listening. Running tests..."
|
|
|
|
|
|
|
|
timing_exit start_iscsi_tgt
|
|
|
|
|
2019-09-09 10:35:30 +00:00
|
|
|
$rpc_py iscsi_create_portal_group $PORTAL_TAG $TARGET_IP:$ISCSI_PORT
|
2019-09-03 08:53:37 +00:00
|
|
|
$rpc_py iscsi_create_initiator_group $INITIATOR_TAG $INITIATOR_NAME $NETMASK
|
2019-08-09 11:15:35 +00:00
|
|
|
$rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE
|
2018-08-23 07:19:20 +00:00
|
|
|
# "Malloc0:0" ==> use Malloc0 blockdev for LUN0
|
|
|
|
# "1:2" ==> map PortalGroup1 to InitiatorGroup2
|
|
|
|
# "64" ==> iSCSI queue depth 64
|
|
|
|
# "-d" ==> disable CHAP authentication
|
2019-09-05 10:35:18 +00:00
|
|
|
$rpc_py iscsi_create_target_node disk1 disk1_alias 'Malloc0:0' $PORTAL_TAG:$INITIATOR_TAG 256 -d
|
2018-08-23 07:19:20 +00:00
|
|
|
sleep 1
|
2020-08-11 10:36:11 +00:00
|
|
|
trap 'killprocess $pid; iscsitestfini; exit 1' SIGINT SIGTERM EXIT
|
2020-03-17 14:08:22 +00:00
|
|
|
|
2022-09-06 12:15:46 +00:00
|
|
|
"$rootdir/build/examples/bdevperf" --json <(initiator_json_config) -q 128 -o 4096 -w write -t 1
|
|
|
|
"$rootdir/build/examples/bdevperf" --json <(initiator_json_config) -q 128 -o 4096 -w read -t 1
|
|
|
|
"$rootdir/build/examples/bdevperf" --json <(initiator_json_config) -q 128 -o 4096 -w flush -t 1
|
|
|
|
"$rootdir/build/examples/bdevperf" --json <(initiator_json_config) -q 128 -o 4096 -w unmap -t 1
|
2018-08-23 07:19:20 +00:00
|
|
|
|
|
|
|
trap - SIGINT SIGTERM EXIT
|
|
|
|
|
|
|
|
killprocess $pid
|
|
|
|
|
2020-08-11 10:36:11 +00:00
|
|
|
iscsitestfini
|