test/nvme/hw_hotplug.sh: respect return code of subprocess

Currently we only check return code of the pipe process and
not its subprocesses. This leads to unexpected passes during testing.

Change-Id: Ia14507a282796ad28f067c086b9112ae6463b654
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9711
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Krzysztof Karas 2021-10-01 07:25:03 +00:00 committed by Tomasz Zawadzki
parent 126bec5f7b
commit 1e6449d80a

View File

@ -45,9 +45,13 @@ timing_exit hotplug_hw_cfg
timing_enter hotplug_hw_test
$SPDK_EXAMPLE_DIR/hotplug -i 0 -t 100 -n 2 -r 2 2>&1 | tee -a log.txt &
example_pid=$!
trap 'killprocess $example_pid; exit 1' SIGINT SIGTERM EXIT
exec {log}> >(tee -a "$testdir/log.txt")
exec >&$log 2>&1
$SPDK_EXAMPLE_DIR/hotplug -i 0 -t 100 -n 2 -r 2 &
hotplug_pid=$!
trap 'killprocess $hotplug_pid; exit 1' SIGINT SIGTERM EXIT
i=0
while ! grep "Starting I/O" log.txt; do
@ -71,7 +75,12 @@ insert_device
sleep $io_time
timing_enter wait_for_example
wait $example_pid
if ! wait $hotplug_pid; then
echo "Hotplug example returned error!"
return 1
fi
timing_exit wait_for_example
trap - SIGINT SIGTERM EXIT