]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #!/usr/bin/env bash |
2 | ||
3 | testdir=$(readlink -f $(dirname $0)) | |
4 | rootdir=$(readlink -f $testdir/../../..) | |
11fdf7f2 TL |
5 | source $rootdir/test/common/autotest_common.sh |
6 | source $rootdir/test/iscsi_tgt/common.sh | |
7c673cae FG |
7 | |
8 | if [ ! -z $1 ]; then | |
9 | DPDK_DIR=$(readlink -f $1) | |
10 | fi | |
11 | ||
7c673cae FG |
12 | timing_enter ext4test |
13 | ||
11fdf7f2 | 14 | rpc_py="$rootdir/scripts/rpc.py" |
7c673cae | 15 | |
11fdf7f2 | 16 | timing_enter start_iscsi_tgt |
7c673cae | 17 | |
11fdf7f2 | 18 | $ISCSI_APP --wait-for-rpc & |
7c673cae FG |
19 | pid=$! |
20 | echo "Process pid: $pid" | |
21 | ||
11fdf7f2 | 22 | trap "$rpc_py destruct_split_vbdev Name0n1 || true; killprocess $pid; rm -f $testdir/iscsi.conf; exit 1" SIGINT SIGTERM EXIT |
7c673cae | 23 | |
11fdf7f2 TL |
24 | waitforlisten $pid |
25 | $rpc_py set_iscsi_options -o 30 -a 4 -b "iqn.2013-06.com.intel.ch.spdk" | |
26 | $rpc_py start_subsystem_init | |
27 | $rootdir/scripts/gen_nvme.sh --json | $rpc_py load_subsystem_config | |
28 | $rpc_py construct_malloc_bdev 512 4096 --name Malloc0 | |
7c673cae FG |
29 | echo "iscsi_tgt is listening. Running tests..." |
30 | ||
11fdf7f2 TL |
31 | timing_exit start_iscsi_tgt |
32 | ||
33 | $rpc_py add_portal_group $PORTAL_TAG $TARGET_IP:$ISCSI_PORT | |
7c673cae | 34 | $rpc_py add_initiator_group $INITIATOR_TAG $INITIATOR_NAME $NETMASK |
11fdf7f2 | 35 | $rpc_py construct_error_bdev 'Malloc0' |
7c673cae FG |
36 | # "1:2" ==> map PortalGroup1 to InitiatorGroup2 |
37 | # "64" ==> iSCSI queue depth 64 | |
11fdf7f2 TL |
38 | # "-d" ==> disable CHAP authentication |
39 | $rpc_py construct_target_node Target0 Target0_alias EE_Malloc0:0 1:2 64 -d | |
7c673cae FG |
40 | sleep 1 |
41 | ||
11fdf7f2 TL |
42 | iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$ISCSI_PORT |
43 | iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT | |
7c673cae FG |
44 | |
45 | trap 'for new_dir in `dir -d /mnt/*dir`; do umount $new_dir; rm -rf $new_dir; done; \ | |
11fdf7f2 | 46 | iscsicleanup; killprocess $pid; rm -f $testdir/iscsi.conf; exit 1' SIGINT SIGTERM EXIT |
7c673cae FG |
47 | |
48 | sleep 1 | |
49 | ||
11fdf7f2 TL |
50 | echo "Test error injection" |
51 | $rpc_py bdev_inject_error EE_Malloc0 'all' 'failure' -n 1000 | |
52 | ||
53 | dev=$(iscsiadm -m session -P 3 | grep "Attached scsi disk" | awk '{print $4}') | |
54 | ||
55 | set +e | |
56 | mkfs.ext4 -F /dev/$dev | |
57 | if [ $? -eq 0 ]; then | |
58 | echo "mkfs successful - expected failure" | |
59 | iscsicleanup | |
60 | killprocess $pid | |
61 | exit 1 | |
62 | else | |
63 | echo "mkfs failed as expected" | |
64 | fi | |
65 | set -e | |
66 | ||
67 | $rpc_py bdev_inject_error EE_Malloc0 'clear' 'failure' | |
68 | echo "Error injection test done" | |
69 | ||
70 | iscsicleanup | |
71 | ||
72 | if [ -z "$NO_NVME" ]; then | |
73 | $rpc_py construct_split_vbdev Nvme0n1 2 -s 10000 | |
74 | $rpc_py construct_target_node Target1 Target1_alias Nvme0n1p0:0 1:2 64 -d | |
75 | fi | |
76 | ||
77 | iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$ISCSI_PORT | |
78 | iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT | |
7c673cae FG |
79 | |
80 | devs=$(iscsiadm -m session -P 3 | grep "Attached scsi disk" | awk '{print $4}') | |
81 | ||
82 | for dev in $devs; do | |
83 | mkfs.ext4 -F /dev/$dev | |
84 | mkdir -p /mnt/${dev}dir | |
85 | mount -o sync /dev/$dev /mnt/${dev}dir | |
86 | ||
11fdf7f2 | 87 | rsync -qav --exclude=".git" --exclude="*.o" $rootdir/ /mnt/${dev}dir/spdk |
7c673cae | 88 | |
11fdf7f2 TL |
89 | make -C /mnt/${dev}dir/spdk clean |
90 | (cd /mnt/${dev}dir/spdk && ./configure $config_params) | |
91 | make -C /mnt/${dev}dir/spdk -j16 | |
7c673cae FG |
92 | |
93 | # Print out space consumed on target device to help decide | |
94 | # if/when we need to increase the size of the malloc LUN | |
95 | df -h /dev/$dev | |
96 | ||
97 | rm -rf /mnt/${dev}dir/spdk | |
98 | done | |
99 | ||
100 | for dev in $devs; do | |
101 | umount /mnt/${dev}dir | |
102 | rm -rf /mnt/${dev}dir | |
103 | ||
11fdf7f2 | 104 | stats=($(cat /sys/block/$dev/stat)) |
7c673cae FG |
105 | echo "" |
106 | echo "$dev stats" | |
107 | printf "READ IO cnt: % 8u merges: % 8u sectors: % 8u ticks: % 8u\n" \ | |
11fdf7f2 | 108 | ${stats[0]} ${stats[1]} ${stats[2]} ${stats[3]} |
7c673cae | 109 | printf "WRITE IO cnt: % 8u merges: % 8u sectors: % 8u ticks: % 8u\n" \ |
11fdf7f2 | 110 | ${stats[4]} ${stats[5]} ${stats[6]} ${stats[7]} |
7c673cae | 111 | printf "in flight: % 8u io ticks: % 8u time in queue: % 8u\n" \ |
11fdf7f2 | 112 | ${stats[8]} ${stats[9]} ${stats[10]} |
7c673cae FG |
113 | echo "" |
114 | done | |
115 | ||
116 | trap - SIGINT SIGTERM EXIT | |
117 | ||
7c673cae | 118 | iscsicleanup |
11fdf7f2 TL |
119 | $rpc_py destruct_split_vbdev Nvme0n1 |
120 | $rpc_py delete_error_bdev EE_Malloc0 | |
121 | ||
122 | if [ -z "$NO_NVME" ]; then | |
123 | $rpc_py delete_nvme_controller Nvme0 | |
124 | fi | |
125 | ||
7c673cae | 126 | killprocess $pid |
11fdf7f2 | 127 | report_test_completion "nightly_iscsi_ext4test" |
7c673cae | 128 | timing_exit ext4test |