xref: /spdk/test/nvme/cuse/nvme_cuse.sh (revision 7192849ed24874f3e9cc31e8a33a9b32c49b9506)
1#!/usr/bin/env bash
2
3testdir=$(readlink -f $(dirname $0))
4rootdir=$(readlink -f $testdir/../../..)
5source $rootdir/scripts/common.sh
6source $rootdir/test/common/autotest_common.sh
7
8if [[ $(uname) != "Linux" ]]; then
9	echo "NVMe cuse tests only supported on Linux"
10	exit 1
11fi
12
13modprobe cuse
14run_test "nvme_cuse_app" $testdir/cuse
15run_test "nvme_cuse_rpc" $testdir/nvme_cuse_rpc.sh
16run_test "nvme_cli_cuse" $testdir/spdk_nvme_cli_cuse.sh
17run_test "nvme_smartctl_cuse" $testdir/spdk_smartctl_cuse.sh
18
19# Only run Namespace managment test case when such device is present
20bdfs=$(get_nvme_bdfs)
21
22$rootdir/scripts/setup.sh reset
23sleep 1
24
25# Find bdf that supports Namespace managment
26for bdf in $bdfs; do
27	nvme_name=$(get_nvme_ctrlr_from_bdf ${bdf})
28	if [[ -z "$nvme_name" ]]; then
29		continue
30	fi
31
32	# Check Optional Admin Command Support for Namespace Management
33	oacs=$(nvme id-ctrl /dev/${nvme_name} | grep oacs | cut -d: -f2)
34	oacs_ns_manage=$((oacs & 0x8))
35
36	if [[ "$oacs_ns_manage" -ne 0 ]]; then
37		break
38	fi
39done
40
41if [[ "$oacs_ns_manage" -ne 0 ]]; then
42	run_test "nvme_ns_manage_cuse" $testdir/nvme_ns_manage_cuse.sh
43fi
44$rootdir/scripts/setup.sh
45
46rmmod cuse
47