From fd910ad4c33a4b4c0f9b38e3c15de7d96b5ab6eb Mon Sep 17 00:00:00 2001
From: Giovanna Lazzari Miotto <giovanna.lazzari.miotto@cern.ch>
Date: Fri, 5 Jul 2024 18:09:51 +0200
Subject: [PATCH] test: control: Launch scdaq before control script

---
 scripts/test_filedma.sh | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/scripts/test_filedma.sh b/scripts/test_filedma.sh
index c425f7b7..25b0f120 100755
--- a/scripts/test_filedma.sh
+++ b/scripts/test_filedma.sh
@@ -86,10 +86,13 @@ function run_filedma_test() {
   local test_failed=1
   echo "${FUNCNAME}: starting SCDAQ test with ${test_id} P5 capture file"
   echo "${FUNCNAME}: timeout ${timeout_secs}s ./${SCDAQ_PATH} --config ${config_file}"
-  python3 scripts/start_run.py &
-  timeout ${timeout_secs}s ./"${SCDAQ_PATH}" --config ${config_file} | uniq -uc
-  ret_status="${PIPESTATUS[0]}"
-  wait
+  # Launch SCDAQ instance
+  timeout ${timeout_secs}s ./"${SCDAQ_PATH}" --config ${config_file} & scdaq_thread=$!
+  # Launch dummy function manager asynchronously
+  python3 scripts/start_run.py & fm_thread=$!
+  wait ${scdaq_thread}
+  ret_status=$?
+  wait ${fm_thread}
 
   # We expect a TIMEOUT failure because `scdaq` is not normally supposed to return.
   if [[ "${ret_status}" -ne 124 ]]; then
-- 
GitLab