#!/bin/sh
#
# David Adams
# March 2021
#
# Test high-level fcl for DUNE.

FILS='
 iceberg3_decode_reco.fcl
 iceberg4a_decode_reco.fcl
 iceberg4b_decode_reco.fcl
 iceberg5_decode_reco.fcl
 standard_reco_dune10kt_nu_1x2x6.fcl
'

NERR=0
NTRY=0
LEV=5
for FIL in $FILS; do
  NTRY=$(($NTRY+1))
  if fcldump $FIL $LEV 2>&1 1>/dev/null; then
    echo $FIL is ok
  else
    echo ERROR Unable to process $FIL
    NERR=$(($NERR+1))
  fi
done

if [ $NERR -gt 0 ]; then
  echo Unable to process $NERR/$NTRY fcl files.
else
  echo All $NTRY fcl files processed successfully.
fi

exit $NERR
