From 1e6449d80ac2a28c78cb93a092e51838eb19f0f2 Mon Sep 17 00:00:00 2001 From: Krzysztof Karas Date: Fri, 1 Oct 2021 07:25:03 +0000 Subject: [PATCH] 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 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9711 Community-CI: Broadcom CI Tested-by: SPDK CI Jenkins Reviewed-by: Maciej Szwed Reviewed-by: Michal Berger Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- test/nvme/hw_hotplug.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/test/nvme/hw_hotplug.sh b/test/nvme/hw_hotplug.sh index ba9c59463..b8e264b38 100755 --- a/test/nvme/hw_hotplug.sh +++ b/test/nvme/hw_hotplug.sh @@ -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