xref: /spdk/test/interrupt/interrupt_common.sh (revision ccad22cf92d8292ec2e5226b1146591529606d02)
1#  SPDX-License-Identifier: BSD-3-Clause
2#  Copyright (C) 2021 Intel Corporation.
3#  All rights reserved.
4
5testdir=$(readlink -f $(dirname $0))
6rootdir=$(readlink -f $testdir/../..)
7source $rootdir/test/common/autotest_common.sh
8source $rootdir/test/interrupt/common.sh
9
10rpc_py="$rootdir/scripts/rpc.py"
11
12r0_mask=0x1
13r1_mask=0x2
14r2_mask=0x4
15
16cpu_server_mask=0x07
17rpc_server_addr="/var/tmp/spdk.sock"
18
19function start_intr_tgt() {
20	local rpc_addr="${1:-$rpc_server_addr}"
21	local cpu_mask="${2:-$cpu_server_mask}"
22
23	"$SPDK_EXAMPLE_DIR/interrupt_tgt" -m $cpu_mask -r $rpc_addr -E -g &
24	intr_tgt_pid=$!
25	trap 'killprocess "$intr_tgt_pid"; cleanup; exit 1' SIGINT SIGTERM EXIT
26	waitforlisten "$intr_tgt_pid" $rpc_addr
27}
28