3 testdir
=$
(readlink
-f $
(dirname $0))
4 rootdir
=$
(readlink
-f $testdir/..
/..
/..
)
5 source $rootdir/scripts
/common.sh
6 source $rootdir/test
/common
/autotest_common.sh
8 rpc_py
=$rootdir/scripts
/rpc.py
10 bdf
=$
(get_first_nvme_bdf
)
11 ctrlr_base
="/dev/spdk/nvme"
13 $SPDK_BIN_DIR/spdk_tgt
-m 0x3 &
15 trap 'kill -9 ${spdk_tgt_pid}; exit 1' SIGINT SIGTERM EXIT
17 waitforlisten
$spdk_tgt_pid
19 $rpc_py bdev_nvme_attach_controller
-b Nvme0
-t PCIe
-a ${bdf}
20 $rpc_py bdev_nvme_cuse_register
-n Nvme0
24 if [ ! -c "${ctrlr_base}0" ]; then
28 $rpc_py bdev_get_bdevs
29 $rpc_py bdev_nvme_get_controllers
31 $rpc_py bdev_nvme_cuse_unregister
-n Nvme0
33 if [ -c "${ctrlr_base}0" ]; then
37 # Verify removing non-existent cuse device
38 $rpc_py bdev_nvme_cuse_unregister
-n Nvme0
&& false
40 $rpc_py bdev_nvme_cuse_register
-n Nvme0
43 if [ ! -c "${ctrlr_base}0" ]; then
47 # Verify adding same nvme controller twice fails
48 $rpc_py bdev_nvme_cuse_register
-n Nvme0
&& false
51 if [ -c "${ctrlr_base}1" ]; then
55 $rpc_py bdev_nvme_detach_controller Nvme0
57 trap - SIGINT SIGTERM EXIT
58 killprocess
$spdk_tgt_pid