diff --git a/test/common/autotest_common.sh b/test/common/autotest_common.sh index f72cb7219..6c08479c7 100755 --- a/test/common/autotest_common.sh +++ b/test/common/autotest_common.sh @@ -264,6 +264,30 @@ function process_core() { return $ret } +function process_shm() { + type=$1 + id=$2 + if [ "$type" = "--pid" ]; then + id="pid${id}" + elif [ "$type" = "--id" ]; then + id="${id}" + else + echo "Please specify to search for pid or shared memory id." + return 1 + fi + + shm_files=$(find /dev/shm -name "*.${id}" -printf "%f\n") + + if [[ -z $shm_files ]]; then + echo "SHM File for specified PID or shared memory id: ${id} not found!" + return 1 + fi + for n in $shm_files; do + tar -C /dev/shm/ -cvzf $output_dir/${n}_shm.tar.gz ${n} + done + return 0 +} + function waitforlisten() { # $1 = process pid if [ -z "$1" ]; then @@ -652,6 +676,7 @@ function get_bdev_size() function autotest_cleanup() { $rootdir/scripts/setup.sh reset + $rootdir/scripts/setup.sh cleanup } function freebsd_update_contigmem_mod() diff --git a/test/nvmf/bdev_io_wait/bdev_io_wait.sh b/test/nvmf/bdev_io_wait/bdev_io_wait.sh index 8336d4c2f..6a853f714 100755 --- a/test/nvmf/bdev_io_wait/bdev_io_wait.sh +++ b/test/nvmf/bdev_io_wait/bdev_io_wait.sh @@ -29,7 +29,7 @@ timing_enter start_nvmf_tgt $NVMF_APP -m 0xF --wait-for-rpc & nvmfpid=$! -trap "killprocess $nvmfpid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT +trap "process_shm --id $NVMF_APP_SHM_ID; killprocess $nvmfpid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT waitforlisten $nvmfpid $rpc_py set_nvmf_target_options -u 8192 -p 4 diff --git a/test/nvmf/discovery/discovery.sh b/test/nvmf/discovery/discovery.sh index a3b164fb7..6dc094031 100755 --- a/test/nvmf/discovery/discovery.sh +++ b/test/nvmf/discovery/discovery.sh @@ -34,7 +34,7 @@ timing_enter start_nvmf_tgt $NVMF_APP -m 0xF --wait-for-rpc & nvmfpid=$! -trap "killprocess $nvmfpid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT +trap "process_shm --id $NVMF_APP_SHM_ID; killprocess $nvmfpid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT waitforlisten $nvmfpid $rpc_py set_nvmf_target_options -u 8192 -p 4 diff --git a/test/nvmf/filesystem/filesystem.sh b/test/nvmf/filesystem/filesystem.sh index 4967c02f7..268781d65 100755 --- a/test/nvmf/filesystem/filesystem.sh +++ b/test/nvmf/filesystem/filesystem.sh @@ -30,7 +30,7 @@ for incapsule in 0 4096; do $NVMF_APP -m 0xF --wait-for-rpc & nvmfpid=$! - trap "killprocess $nvmfpid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT + trap "process_shm --id $NVMF_APP_SHM_ID; killprocess $nvmfpid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT waitforlisten $nvmfpid $rpc_py set_nvmf_target_options -u 8192 -p 4 -c $incapsule diff --git a/test/nvmf/fio/fio.sh b/test/nvmf/fio/fio.sh index 5a8e2ee47..4f6869b00 100755 --- a/test/nvmf/fio/fio.sh +++ b/test/nvmf/fio/fio.sh @@ -29,7 +29,7 @@ timing_enter start_nvmf_tgt $NVMF_APP -m 0xF --wait-for-rpc & nvmfpid=$! -trap "killprocess $nvmfpid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT +trap "process_shm --id $NVMF_APP_SHM_ID; killprocess $nvmfpid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT waitforlisten $nvmfpid $rpc_py set_nvmf_target_options -u 8192 -p 4 diff --git a/test/nvmf/host/aer.sh b/test/nvmf/host/aer.sh index 8798dfa27..56b8955b2 100755 --- a/test/nvmf/host/aer.sh +++ b/test/nvmf/host/aer.sh @@ -22,7 +22,7 @@ timing_enter start_nvmf_tgt $NVMF_APP -m 0xF --wait-for-rpc & nvmfpid=$! -trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT +trap "process_shm --id $NVMF_APP_SHM_ID; killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT waitforlisten $nvmfpid $rpc_py set_nvmf_target_options -u 8192 -p 4 diff --git a/test/nvmf/host/bdevperf.sh b/test/nvmf/host/bdevperf.sh index 6bb9f454c..5c8bf88e5 100755 --- a/test/nvmf/host/bdevperf.sh +++ b/test/nvmf/host/bdevperf.sh @@ -25,7 +25,7 @@ timing_enter start_nvmf_tgt $NVMF_APP -m 0xF --wait-for-rpc & nvmfpid=$! -trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT +trap "process_shm --id $NVMF_APP_SHM_ID; killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT waitforlisten $nvmfpid $rpc_py set_nvmf_target_options -u 8192 -p 4 diff --git a/test/nvmf/host/fio.sh b/test/nvmf/host/fio.sh index 491767445..b3784eea5 100755 --- a/test/nvmf/host/fio.sh +++ b/test/nvmf/host/fio.sh @@ -28,7 +28,7 @@ timing_enter start_nvmf_tgt $NVMF_APP -m 0xF --wait-for-rpc & nvmfpid=$! -trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT +trap "process_shm --id $NVMF_APP_SHM_ID; killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT waitforlisten $nvmfpid $rpc_py set_nvmf_target_options -u 8192 -p 4 diff --git a/test/nvmf/host/identify.sh b/test/nvmf/host/identify.sh index d552f8687..469bc0a1b 100755 --- a/test/nvmf/host/identify.sh +++ b/test/nvmf/host/identify.sh @@ -24,7 +24,7 @@ timing_enter start_nvmf_tgt $NVMF_APP -m 0xF --wait-for-rpc & nvmfpid=$! -trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT +trap "process_shm --id $NVMF_APP_SHM_ID; killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT waitforlisten $nvmfpid $rpc_py set_nvmf_target_options -u 8192 -p 4 diff --git a/test/nvmf/host/perf.sh b/test/nvmf/host/perf.sh index c8883dadc..7bb528ab0 100755 --- a/test/nvmf/host/perf.sh +++ b/test/nvmf/host/perf.sh @@ -25,7 +25,7 @@ timing_enter start_nvmf_tgt $NVMF_APP -m 0xF --wait-for-rpc -i 0 & nvmfpid=$! -trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT +trap "process_shm --id $NVMF_APP_SHM_ID; killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT waitforlisten $nvmfpid $rpc_py set_nvmf_target_options -u 8192 -p 4 diff --git a/test/nvmf/lvol/nvmf_lvol.sh b/test/nvmf/lvol/nvmf_lvol.sh index 5fff55464..17006236d 100755 --- a/test/nvmf/lvol/nvmf_lvol.sh +++ b/test/nvmf/lvol/nvmf_lvol.sh @@ -47,7 +47,7 @@ timing_enter start_nvmf_tgt $NVMF_APP -m 0xF --wait-for-rpc & pid=$! -trap "disconnect_nvmf; killprocess $pid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT +trap "process_shm --id $NVMF_APP_SHM_ID; disconnect_nvmf; killprocess $pid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT waitforlisten $pid $rpc_py set_nvmf_target_options -u 8192 -p 4 diff --git a/test/nvmf/multiconnection/multiconnection.sh b/test/nvmf/multiconnection/multiconnection.sh index 6df766e2e..dbe4b4a49 100755 --- a/test/nvmf/multiconnection/multiconnection.sh +++ b/test/nvmf/multiconnection/multiconnection.sh @@ -38,7 +38,7 @@ timing_enter start_nvmf_tgt $NVMF_APP -m 0xF --wait-for-rpc & pid=$! -trap "killprocess $pid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT +trap "process_shm --id $NVMF_APP_SHM_ID; killprocess $pid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT waitforlisten $pid $rpc_py set_nvmf_target_options -u 8192 -p 4 diff --git a/test/nvmf/nvme_cli/nvme_cli.sh b/test/nvmf/nvme_cli/nvme_cli.sh index 140fcf15a..30a7ee95d 100755 --- a/test/nvmf/nvme_cli/nvme_cli.sh +++ b/test/nvmf/nvme_cli/nvme_cli.sh @@ -35,7 +35,7 @@ timing_enter start_nvmf_tgt $NVMF_APP -m 0xF --wait-for-rpc & nvmfpid=$! -trap "killprocess $nvmfpid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT +trap "process_shm --id $NVMF_APP_SHM_ID; killprocess $nvmfpid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT waitforlisten $nvmfpid $rpc_py set_nvmf_target_options -u 8192 -p 4 diff --git a/test/nvmf/nvmf.sh b/test/nvmf/nvmf.sh index b76baa83c..859569d05 100755 --- a/test/nvmf/nvmf.sh +++ b/test/nvmf/nvmf.sh @@ -21,7 +21,8 @@ timing_enter nvmf_tgt start_stub "-s 2048 -i 0 -m $NVMF_TEST_CORE_MASK" trap "kill_stub; exit 1" SIGINT SIGTERM EXIT -export NVMF_APP="./app/nvmf_tgt/nvmf_tgt -i 0" +export NVMF_APP_SHM_ID="0" +export NVMF_APP="./app/nvmf_tgt/nvmf_tgt -i $NVMF_APP_SHM_ID -e 0xFFFF" run_test suite test/nvmf/filesystem/filesystem.sh run_test suite test/nvmf/discovery/discovery.sh diff --git a/test/nvmf/rpc/rpc.sh b/test/nvmf/rpc/rpc.sh index 8431f6b79..eaf79a018 100755 --- a/test/nvmf/rpc/rpc.sh +++ b/test/nvmf/rpc/rpc.sh @@ -26,7 +26,7 @@ timing_enter start_nvmf_tgt $NVMF_APP -m 0xF --wait-for-rpc & pid=$! -trap "killprocess $pid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT +trap "process_shm --id $NVMF_APP_SHM_ID; killprocess $pid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT waitforlisten $pid $rpc_py set_nvmf_target_options -u 8192 -p 4 diff --git a/test/nvmf/shutdown/shutdown.sh b/test/nvmf/shutdown/shutdown.sh index 91735fdb2..05abe8062 100755 --- a/test/nvmf/shutdown/shutdown.sh +++ b/test/nvmf/shutdown/shutdown.sh @@ -29,7 +29,7 @@ timing_enter start_nvmf_tgt $NVMF_APP -m 0xF --wait-for-rpc & pid=$! -trap "killprocess $pid; nvmfcleanup; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT +trap "process_shm --id $NVMF_APP_SHM_ID; killprocess $pid; nvmfcleanup; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT waitforlisten $pid $rpc_py set_nvmf_target_options -u 8192 -p 4