From 03e5c11370e0e71be0a49aed8680449e3fd9ce2b Mon Sep 17 00:00:00 2001
From: Dinyar Rabady <dinyar@cern.ch>
Date: Tue, 1 Nov 2022 11:36:02 +0100
Subject: [PATCH] Check if SCDAQ actually runs

Belongs to #34.
---
 scripts/runFileTest.sh | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/scripts/runFileTest.sh b/scripts/runFileTest.sh
index c1586176..a745f805 100755
--- a/scripts/runFileTest.sh
+++ b/scripts/runFileTest.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 echo "building scdaq locally"
 cd src
 make all
@@ -10,6 +10,27 @@ tar -xzvf gmt_testfile.tar.gz
 cd ../../
 echo "Starting scdaq test with GMT P5 capture file: check for crash"
 timeout 20s src/scdaq --config test/config/scdaq-gmt.conf | uniq
+if [[ "${PIPESTATUS[0]}" -ne 0 ]]; then
+    echo "SCDAQ test for GMT failed with exit code ${PIPESTATUS[0]}!"
+    GMT_FAILED=true
+elif [[ $(find test/data -name "*scout_GMT*" | wc -l) -eq 0 ]]; then
+    echo "SCDAQ test for GMT failed, no output files found!"
+    GMT_FAILED=true
+fi
+echo
+echo "#############################################################################"
 echo "Starting scdaq test with CALO P5 capture file: check for crash"
 timeout 100s src/scdaq --config test/config/scdaq-calo.conf | uniq
+if [[ "${PIPESTATUS[0]}" -ne 0 ]]; then
+    echo "SCDAQ test for CALO failed with exit code ${PIPESTATUS[0]}!"
+    CALO_FAILED=true
+elif [[ $(find test/data -name "*scout_CALO*" | wc -l) -eq 0 ]]; then
+    echo "SCDAQ test for CALO failed, no output files found!"
+    CALO_FAILED=true
+fi
+
+if [[ $GMT_FAILED = true || $CALO_FAILED = true ]]; then
+    exit 1
+fi
+
 echo "test run finished"
-- 
GitLab