script/run_package.sh: kill dangling models in cleanup
Internal CI suffers from instability due to dangling processes that are
missed during FVP run cleanup. Give models time to print user statistics
before terminating the process and killing their children. As the
infrastracture is in the process of being sunsetted, this need not be
sophisticated and can be removed once migration to OpenCI is complete.
Change-Id: I507bbe6bcdf85b15af40f58d002fac62a5e12bac
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
diff --git a/script/run_package.sh b/script/run_package.sh
index 346c4d3..5db1ef1 100755
--- a/script/run_package.sh
+++ b/script/run_package.sh
@@ -62,7 +62,7 @@
echo "signal received: $sig"
# Avoid the model termination gracefully when the parameter 'exit_on_model_param'
- # is set and test if exited successfully.
+ # is set and test if exited successfully.
if [ "$exit_on_model_param" -eq 0 ] || [ "$sig" != "EXIT" ]; then
# Kill all background processes so far and wait for them
while read pid; do
@@ -76,11 +76,13 @@
model_cid=$(pgrep -P "$model_pid" | xargs)
# ignore errors
kill -SIGINT "$model_cid" &>/dev/null || true
- # Allow some time to print data
- sleep 2
- else
- kill_and_reap "$pid"
+ # Allow some time to print data, we can't use wait since the process is
+ # a child of the daemonized launch process.
+ sleep 5
fi
+
+ kill_and_reap "$pid"
+
done < <(find -name '*.pid')
fi