diff --git a/scripts/autotest_common.sh b/scripts/autotest_common.sh index adae38490..14eeda642 100755 --- a/scripts/autotest_common.sh +++ b/scripts/autotest_common.sh @@ -227,6 +227,21 @@ function rbd_cleanup() { fi } +function start_stub() { + $rootdir/test/app/stub/stub $1 & + stubpid=$! + echo Waiting for stub to ready for secondary processes... + while ! [ -e /var/run/.spdk0_config ]; do + sleep 0.1s + done + echo done. +} + +function kill_stub() { + kill $stubpid + rm -rf /var/run/.spdk0_config +} + function run_test() { set +x echo "************************************" diff --git a/test/iscsi_tgt/common.sh b/test/iscsi_tgt/common.sh index 3eecff4b1..7cdde82da 100644 --- a/test/iscsi_tgt/common.sh +++ b/test/iscsi_tgt/common.sh @@ -11,3 +11,7 @@ fi if [ -z "$ISCSI_APP" ]; then ISCSI_APP=./app/iscsi_tgt/iscsi_tgt fi + +if [ -z "$ISCSI_TEST_CORE_MASK" ]; then + ISCSI_TEST_CORE_MASK=0xFFFF +fi diff --git a/test/iscsi_tgt/filesystem/filesystem.sh b/test/iscsi_tgt/filesystem/filesystem.sh index fb05e0963..df45f35ae 100755 --- a/test/iscsi_tgt/filesystem/filesystem.sh +++ b/test/iscsi_tgt/filesystem/filesystem.sh @@ -20,7 +20,7 @@ rpc_py="python $rootdir/scripts/rpc.py" timing_enter start_iscsi_tgt -$ISCSI_APP -c $testdir/iscsi.conf -m 0xFFFF & +$ISCSI_APP -c $testdir/iscsi.conf -m $ISCSI_TEST_CORE_MASK & pid=$! echo "Process pid: $pid" diff --git a/test/iscsi_tgt/idle_migration/idle_migration.sh b/test/iscsi_tgt/idle_migration/idle_migration.sh index 7b6fe6640..722a92c93 100755 --- a/test/iscsi_tgt/idle_migration/idle_migration.sh +++ b/test/iscsi_tgt/idle_migration/idle_migration.sh @@ -15,7 +15,7 @@ fio_py="python $rootdir/scripts/fio.py" timing_enter start_iscsi_tgt -$ISCSI_APP -c $testdir/iscsi.conf -m 0xFFFF & +$ISCSI_APP -c $testdir/iscsi.conf -m $ISCSI_TEST_CORE_MASK & pid=$! echo "Process pid: $pid" diff --git a/test/iscsi_tgt/ip_migration/ip_migration.sh b/test/iscsi_tgt/ip_migration/ip_migration.sh index 621c66f57..5ef348be5 100755 --- a/test/iscsi_tgt/ip_migration/ip_migration.sh +++ b/test/iscsi_tgt/ip_migration/ip_migration.sh @@ -45,7 +45,7 @@ do timing_enter start_iscsi_tgt_$i # TODO: run the different iSCSI instances on non-overlapping CPU masks - $ISCSI_APP -c $testdir/iscsi.conf.$i -s 1000 -i $i -m 0xFFFF & + $ISCSI_APP -c $testdir/iscsi.conf.$i -s 1000 -i $i -m $ISCSI_TEST_CORE_MASK & pid=$! echo "Process pid: $pid" diff --git a/test/iscsi_tgt/iscsi_tgt.sh b/test/iscsi_tgt/iscsi_tgt.sh index 2404cd559..5decbc13b 100755 --- a/test/iscsi_tgt/iscsi_tgt.sh +++ b/test/iscsi_tgt/iscsi_tgt.sh @@ -10,7 +10,22 @@ fi export TARGET_IP=127.0.0.1 export INITIATOR_IP=127.0.0.1 +source $rootdir/test/iscsi_tgt/common.sh + timing_enter iscsi_tgt + +# ISCSI_TEST_CORE_MASK is the biggest core mask specified by +# any of the iscsi_tgt tests. Using this mask for the stub +# ensures that if this mask spans CPU sockets, that we will +# allocate memory from both sockets. The stub will *not* +# run anything on the extra cores (and will sleep on master +# core 0) so there is no impact to the iscsi_tgt tests by +# specifying the bigger core mask. +start_stub "-s 2048 -i 0 -m $ISCSI_TEST_CORE_MASK" +trap "kill_stub; exit 1" SIGINT SIGTERM EXIT + +export ISCSI_APP="./app/iscsi_tgt/iscsi_tgt -i 0" + run_test ./test/iscsi_tgt/calsoft/calsoft.sh run_test ./test/iscsi_tgt/filesystem/filesystem.sh run_test ./test/iscsi_tgt/fio/fio.sh @@ -22,5 +37,12 @@ if [ $RUN_NIGHTLY -eq 1 ]; then fi run_test ./test/iscsi_tgt/ext4test/ext4test.sh run_test ./test/iscsi_tgt/rbd/rbd.sh + +trap - SIGINT SIGTERM EXIT +kill_stub + +# TODO: enable remote NVMe controllers with multi-process so that +# we can use the stub for this test run_test ./test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh + timing_exit iscsi_tgt diff --git a/test/iscsi_tgt/rbd/rbd.sh b/test/iscsi_tgt/rbd/rbd.sh index d04a266e6..b6d1eb57c 100755 --- a/test/iscsi_tgt/rbd/rbd.sh +++ b/test/iscsi_tgt/rbd/rbd.sh @@ -29,7 +29,7 @@ fio_py="python $rootdir/scripts/fio.py" timing_enter start_iscsi_tgt -$ISCSI_APP -c $testdir/iscsi.conf -m 0xFFFF & +$ISCSI_APP -c $testdir/iscsi.conf -m $ISCSI_TEST_CORE_MASK & pid=$! trap "killprocess $pid; exit 1" SIGINT SIGTERM EXIT