Skip to content
Snippets Groups Projects

fix: test: Amend config file regex

Merged Giovanna Lazzari Miotto requested to merge fix/test/config-regex into main
1 file
+ 8
7
Compare changes
  • Side-by-side
  • Inline
+ 8
7
#!/bin/bash
##
## File: test_filedma.sh
## Author: glazzari
## Author: @glazzari
## Description: runs file-based regression tests for GMT, Calo and Passthrough processors.
## Style: Google Shell Guide (https://google.github.io/styleguide/shellguide.html).
## Gold standard for regression: scdaq @ 67ddf197 from January 9th, 2024.
##
readonly DATA_DIR=test/data
readonly CONFIG_DIR=test/config
@@ -24,7 +22,7 @@ function build_scdaq() {
}
function cleanup_test() {
cd ${DATA_DIR} && rm -rf *.dat *.journal in_progress run000* && cd - > /dev/null && echo "${FUNCNAME}: SUCCESS"
cd ${DATA_DIR} && rm -rf *.dat *.raw* *.journal in_progress run000* && cd - > /dev/null && echo "${FUNCNAME}: SUCCESS"
}
function setup_test() {
@@ -89,8 +87,9 @@ function run_filedma_test() {
setup_test
output_dir=$(awk -F":" '/^output_filename_base:/{printf $2}' $config_file)
output_prefix=$(awk -F":" '/^output_filename_prefix:/{printf $2}' $config_file)
output_dir=$(awk -F ':' '/^ *output_filename_base:/{printf $2}' ${config_file} | tr -d "\"',[:blank:]")
output_prefix=$(awk -F ':' '/^ *output_filename_prefix:/{printf $2}' ${config_file} | tr -d "\"',[:blank:]")
output_suffix=.dat
local test_failed=1
echo "${FUNCNAME}: starting SCDAQ test with ${test_id} P5 capture file"
@@ -106,7 +105,9 @@ function run_filedma_test() {
elif [[ ${expects_output} = true ]]; then
# Find file matching name pattern under the output directory, and excluding input data files
# In case of multiple files, sorts alphanumerically so the lower-numbered one comes first
local output_files=$(find ${output_dir} -iname "*${output_prefix}*.dat" ! -iname "*testfile.dat" | sort -rV)
local pattern=".*${output_prefix}.*${output_suffix}[_0-9]*"
echo "${FUNCNAME}: searching for filename matching pattern: '${pattern}'"
local output_files=$(find ${output_dir} -type f -iregex "${pattern}" ! -iname "*testfile.dat" | sort -rV)
if [ -z "${output_files}" ]; then
echo "${FUNCNAME}: SCDAQ test for ${test_id} FAILED: output file not found!"
test_failed=1
Loading