1#!/usr/bin/env bash 2# SPDX-License-Identifier: BSD-3-Clause 3# Copyright (C) 2018 Intel Corporation 4# All rights reserved. 5# 6testdir=$(readlink -f $(dirname $0)) 7rootdir=$(readlink -f $testdir/../..) 8source $rootdir/test/common/autotest_common.sh 9source $rootdir/test/bdev/nbd_common.sh 10 11function app_repeat_test() { 12 local rpc_server=/var/tmp/spdk-nbd.sock 13 local nbd_list=("/dev/nbd0" "/dev/nbd1") 14 local bdev_list=("Malloc0" "Malloc1") 15 local repeat_times=4 16 17 modprobe nbd 18 $rootdir/test/event/app_repeat/app_repeat -r $rpc_server -m 0x3 -t $repeat_times & 19 repeat_pid=$! 20 trap 'killprocess $repeat_pid; exit 1' SIGINT SIGTERM EXIT 21 echo "Process app_repeat pid: $repeat_pid" 22 23 for i in {0..2}; do 24 echo "spdk_app_start Round $i" 25 waitforlisten $repeat_pid $rpc_server 26 27 $rootdir/scripts/rpc.py -s $rpc_server bdev_malloc_create 64 4096 28 $rootdir/scripts/rpc.py -s $rpc_server bdev_malloc_create 64 4096 29 30 nbd_rpc_data_verify $rpc_server "${bdev_list[*]}" "${nbd_list[*]}" 31 # This SIGTERM is sent to the app_repeat test app - it doesn't actually 32 # terminate the app, it just causes it go through another 33 # spdk_app_stop/spdk_app_start cycle 34 ./scripts/rpc.py -s $rpc_server spdk_kill_instance SIGTERM 35 done 36 37 waitforlisten $repeat_pid $rpc_server 38 killprocess $repeat_pid 39 trap - SIGINT SIGTERM EXIT 40 41 return 0 42} 43 44run_test "event_perf" $testdir/event_perf/event_perf -m 0xF -t 1 45run_test "event_reactor" $testdir/reactor/reactor -t 1 46run_test "event_reactor_perf" $testdir/reactor_perf/reactor_perf -t 1 47 48if [ $(uname -s) = Linux ]; then 49 run_test "event_scheduler" $testdir/scheduler/scheduler.sh 50 if modprobe -n nbd; then 51 run_test "app_repeat" app_repeat_test 52 fi 53fi 54