Skip to content
Snippets Groups Projects
Commit 8f3cbe1b authored by Giovanna Lazzari Miotto's avatar Giovanna Lazzari Miotto :mushroom:
Browse files

test: check for output files in multi-stream case

parent 8a565dd1
No related branches found
No related tags found
1 merge request!95refactor: config: Use single JSON5 file to configure multiple parallel streams
Pipeline #7040884 passed
...@@ -77,6 +77,7 @@ function run_filedma_test() { ...@@ -77,6 +77,7 @@ function run_filedma_test() {
local config_file=$3 local config_file=$3
local expects_output=${EXPECTS_OUTPUT} local expects_output=${EXPECTS_OUTPUT}
local validates_contents=${VALIDATE_CONTENT}
declare -i bytes_to_hash=${MAX_HASHABLE_BYTES} declare -i bytes_to_hash=${MAX_HASHABLE_BYTES}
local ref_hash_file=${HASH_DIR}/${test_id}_${bytes_to_hash}_${REF_COMMIT_TAG} local ref_hash_file=${HASH_DIR}/${test_id}_${bytes_to_hash}_${REF_COMMIT_TAG}
...@@ -100,7 +101,7 @@ function run_filedma_test() { ...@@ -100,7 +101,7 @@ function run_filedma_test() {
if [[ "${ret_status}" -ne 124 ]]; then if [[ "${ret_status}" -ne 124 ]]; then
echo "${FUNCNAME}: SCDAQ test for ${test_id} FAILED with exit code ${ret_status}!" echo "${FUNCNAME}: SCDAQ test for ${test_id} FAILED with exit code ${ret_status}!"
# Check if output file was correctly generated # Check if output file was correctly generated
elif [[ ${expects_output} = true ]]; then elif [[ ${expects_output} = true || ${validates_contents} = true ]]; then
# Find file matching name pattern under the output directory, and excluding input data files # 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 # In case of multiple files, sorts alphanumerically so the lower-numbered one comes first
local pattern=".*${output_prefix}.*${output_suffix}[_0-9]*" local pattern=".*${output_prefix}.*${output_suffix}[_0-9]*"
...@@ -121,13 +122,17 @@ function run_filedma_test() { ...@@ -121,13 +122,17 @@ function run_filedma_test() {
# Single matched file # Single matched file
output_file="${output_files}" output_file="${output_files}"
fi fi
echo "${FUNCNAME}: taking file for comparison: ${output_file}." if [[ ${validates_contents} = false ]]; then
# Hash-verify contents
if check_hashes ${bytes_to_hash} ${output_file} ${ref_hash_file} ; then
echo "${FUNCNAME}: SCDAQ test PASSED for ${test_id}"
test_failed=0 test_failed=0
else else
echo "${FUNCNAME}: SCDAQ test for ${test_id} FAILED" echo "${FUNCNAME}: taking file for comparison: ${output_file}."
# Hash-verify contents
if check_hashes ${bytes_to_hash} ${output_file} ${ref_hash_file} ; then
echo "${FUNCNAME}: SCDAQ test PASSED for ${test_id}"
test_failed=0
else
echo "${FUNCNAME}: SCDAQ test for ${test_id} FAILED"
fi
fi fi
fi fi
else else
...@@ -149,8 +154,9 @@ function echo_bool () { ...@@ -149,8 +154,9 @@ function echo_bool () {
function run_all_tests () { function run_all_tests () {
local test_description=$1 local test_description=$1
local expects_output=${EXPECTS_OUTPUT} local expects_output=${EXPECTS_OUTPUT}
local validates_contents=${VALIDATE_CONTENT}
declare -i timeout_secs=${MAX_RUNTIME_SECS} declare -i timeout_secs=${MAX_RUNTIME_SECS}
readonly test_description timeout_secs expects_output readonly test_description timeout_secs expects_output validates_contents
local gmt_failed=1 calo_failed=1 local gmt_failed=1 calo_failed=1
local passthrough_failed=1 multistream_failed=1 local passthrough_failed=1 multistream_failed=1
...@@ -165,10 +171,10 @@ function run_all_tests () { ...@@ -165,10 +171,10 @@ function run_all_tests () {
run_filedma_test "PASS_CALO" ${timeout_secs} "${CONFIG_DIR}/filedma-passthrough.json5" run_filedma_test "PASS_CALO" ${timeout_secs} "${CONFIG_DIR}/filedma-passthrough.json5"
passthrough_failed=$? passthrough_failed=$?
if [[ ${expects_output} = false ]]; then if [[ ${validates_contents} = true ]]; then
failure_statuses+=(multistream_failed) failure_statuses+=(multistream_failed)
# We evaluate multi-stream operation with four parallel pipelines # We evaluate multi-stream operation with four parallel pipelines, but don't check hashes at this time
run_filedma_test "MULTI_PASS" ${timeout_secs} "${CONFIG_DIR}/n-filedma.json5" VALIDATE_CONTENT=false run_filedma_test "MULTI_PASS" ${timeout_secs} "${CONFIG_DIR}/n-filedma.json5"
multistream_failed=$? multistream_failed=$?
fi fi
...@@ -188,8 +194,8 @@ function run_all_tests () { ...@@ -188,8 +194,8 @@ function run_all_tests () {
echo "-- GMT : $(echo_bool ${gmt_failed} )" echo "-- GMT : $(echo_bool ${gmt_failed} )"
echo "-- Calo : $(echo_bool ${calo_failed})" echo "-- Calo : $(echo_bool ${calo_failed})"
echo "-- Passthrough : $(echo_bool ${passthrough_failed})" echo "-- Passthrough : $(echo_bool ${passthrough_failed})"
if [[ ${expects_output} = false ]]; then if [[ ${validates_contents} = true ]]; then
echo "-- Multi-stream: $(echo_bool ${multistream_failed})" echo "-- Multi-stream: $(echo_bool ${multistream_failed}) (=> files exist)"
fi fi
if (( $some_failed == 0 )); then if (( $some_failed == 0 )); then
...@@ -210,11 +216,11 @@ function main { ...@@ -210,11 +216,11 @@ function main {
build_scdaq build_scdaq
# Test 1: time-bound operation, checks for crashes # Test 1: time-bound operation, checks for crashes
MODIFY_CONFIG=false EXPECTS_OUTPUT=false run_all_tests "Test 1 (operation) - ${MAX_RUNTIME_SECS}-second runs, no output files" MODIFY_CONFIG=false EXPECTS_OUTPUT=false VALIDATE_CONTENT=false run_all_tests "Test 1 (operation) - ${MAX_RUNTIME_SECS}-second runs, no output files"
exit_on_failure $? exit_on_failure $?
# Test 2: validates file output for basic runs # Test 2: validates file output for basic runs
MODIFY_CONFIG=true EXPECTS_OUTPUT=true run_all_tests "Test 2 (regression) - ${MAX_RUNTIME_SECS}-second runs, check output files" MODIFY_CONFIG=true EXPECTS_OUTPUT=true VALIDATE_CONTENT=true run_all_tests "Test 2 (regression) - ${MAX_RUNTIME_SECS}-second runs, check output files"
exit_on_failure $? exit_on_failure $?
echo "${FUNCNAME}: all tests finished" echo "${FUNCNAME}: all tests finished"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment