2016-06-07 15:49:44 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
testdir=$(readlink -f $(dirname $0))
|
2016-07-06 16:56:03 +00:00
|
|
|
rootdir=$(readlink -f $testdir/../../..)
|
2018-02-27 22:14:08 +00:00
|
|
|
source $rootdir/test/common/autotest_common.sh
|
2016-06-08 01:47:02 +00:00
|
|
|
source $rootdir/test/nvmf/common.sh
|
2016-06-07 15:49:44 +00:00
|
|
|
|
2016-10-17 09:38:26 +00:00
|
|
|
MALLOC_BDEV_SIZE=64
|
|
|
|
MALLOC_BLOCK_SIZE=512
|
|
|
|
|
2018-09-11 13:26:14 +00:00
|
|
|
rpc_py="$rootdir/scripts/rpc.py"
|
2016-09-27 00:38:36 +00:00
|
|
|
|
2019-05-16 19:38:53 +00:00
|
|
|
nvmftestinit
|
2018-08-14 18:05:15 +00:00
|
|
|
|
2019-12-05 00:23:48 +00:00
|
|
|
function nvmf_filesystem_create {
|
|
|
|
fstype=$1
|
|
|
|
|
|
|
|
if [ $fstype = ext4 ]; then
|
|
|
|
force=-F
|
|
|
|
else
|
|
|
|
force=-f
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkfs.${fstype} $force /dev/nvme0n1p1
|
|
|
|
|
|
|
|
mount /dev/nvme0n1p1 /mnt/device
|
|
|
|
touch /mnt/device/aaa
|
|
|
|
sync
|
|
|
|
rm /mnt/device/aaa
|
|
|
|
sync
|
|
|
|
umount /mnt/device
|
|
|
|
}
|
|
|
|
|
|
|
|
function nvmf_filesystem_part {
|
|
|
|
incapsule=$1
|
|
|
|
|
2019-05-13 19:11:00 +00:00
|
|
|
nvmfappstart "-m 0xF"
|
2016-06-07 15:49:44 +00:00
|
|
|
|
2019-07-15 04:42:41 +00:00
|
|
|
$rpc_py nvmf_create_transport $NVMF_TRANSPORT_OPTS -u 8192 -c $incapsule
|
2019-08-09 11:15:35 +00:00
|
|
|
$rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b Malloc1
|
2019-09-20 10:22:44 +00:00
|
|
|
$rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a -s SPDK00000000000001
|
2019-05-15 23:10:30 +00:00
|
|
|
$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 Malloc1
|
2019-06-03 16:34:31 +00:00
|
|
|
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
|
2016-06-07 15:49:44 +00:00
|
|
|
|
2019-06-03 16:34:31 +00:00
|
|
|
nvme connect -t $TEST_TRANSPORT -n "nqn.2016-06.io.spdk:cnode1" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT"
|
2018-04-16 20:28:16 +00:00
|
|
|
|
2019-12-05 21:05:18 +00:00
|
|
|
# TODO: fix this to wait for the proper NVMe device.
|
|
|
|
# if we are hosting the local filesystem on an NVMe drive, this test will fail
|
|
|
|
# because it relies on the no other NVMe drives being present in the system.
|
2018-07-09 18:11:00 +00:00
|
|
|
waitforblk "nvme0n1"
|
2016-07-08 22:43:07 +00:00
|
|
|
|
2018-07-09 18:11:00 +00:00
|
|
|
mkdir -p /mnt/device
|
2016-07-08 22:43:07 +00:00
|
|
|
|
2019-12-05 21:05:18 +00:00
|
|
|
parted -s /dev/nvme0n1 mklabel msdos mkpart primary '0%' '100%'
|
|
|
|
partprobe
|
|
|
|
sleep 1
|
|
|
|
|
2019-12-05 00:23:48 +00:00
|
|
|
if [ $incapsule -eq 0 ]; then
|
|
|
|
run_test "case" "filesystem_ext4" nvmf_filesystem_create "ext4"
|
|
|
|
run_test "case" "filesystem_btrfs" nvmf_filesystem_create "btrfs"
|
|
|
|
run_test "case" "filesystem_xfs" nvmf_filesystem_create "xfs"
|
|
|
|
else
|
|
|
|
run_test "case" "filesystem_incapsule_ext4" nvmf_filesystem_create "ext4"
|
|
|
|
run_test "case" "filesystem_incapsule_btrfs" nvmf_filesystem_create "btrfs"
|
|
|
|
run_test "case" "filesystem_incapsule_xfs" nvmf_filesystem_create "xfs"
|
|
|
|
fi
|
2016-07-21 22:54:23 +00:00
|
|
|
|
2019-12-05 21:05:18 +00:00
|
|
|
parted -s /dev/nvme0n1 rm 1
|
|
|
|
|
2018-07-09 18:11:00 +00:00
|
|
|
sync
|
|
|
|
nvme disconnect -n "nqn.2016-06.io.spdk:cnode1" || true
|
2016-06-07 15:49:44 +00:00
|
|
|
|
2019-09-23 10:17:30 +00:00
|
|
|
$rpc_py nvmf_delete_subsystem nqn.2016-06.io.spdk:cnode1
|
2016-07-25 15:20:11 +00:00
|
|
|
|
2018-07-09 18:11:00 +00:00
|
|
|
trap - SIGINT SIGTERM EXIT
|
|
|
|
|
|
|
|
killprocess $nvmfpid
|
2019-11-29 21:18:36 +00:00
|
|
|
nvmfpid=
|
2019-12-05 00:23:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
run_test "suite" "nvmf_filesystem_no_incapsule" nvmf_filesystem_part 0
|
|
|
|
run_test "suite" "nvmf_filesystem_incapsule" nvmf_filesystem_part 4096
|
2016-09-27 00:38:36 +00:00
|
|
|
|
2019-05-16 19:38:53 +00:00
|
|
|
nvmftestfini
|