From 88c605ba952de35f2615aa442eeecc83c1037c34 Mon Sep 17 00:00:00 2001 From: mmusich Date: Fri, 15 Mar 2024 13:28:56 +0100 Subject: [PATCH] introduce a python compilation unit test for the DQM online configurations --- DQM/Integration/test/BuildFile.xml | 8 +++++ DQM/Integration/test/runCompilationTest.sh | 37 ++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100755 DQM/Integration/test/runCompilationTest.sh diff --git a/DQM/Integration/test/BuildFile.xml b/DQM/Integration/test/BuildFile.xml index 4b07db5b5bcdc..fd7f63fbb208c 100644 --- a/DQM/Integration/test/BuildFile.xml +++ b/DQM/Integration/test/BuildFile.xml @@ -34,3 +34,11 @@ + + + + + + + + diff --git a/DQM/Integration/test/runCompilationTest.sh b/DQM/Integration/test/runCompilationTest.sh new file mode 100755 index 0000000000000..7fb9d3f9f2423 --- /dev/null +++ b/DQM/Integration/test/runCompilationTest.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Check if the key argument is provided +if [ $# -eq 0 ]; then + echo "Usage: $0 " + exit 1 +fi + +# Extract the key from the command line argument +key="$1" + +# Define a function to run the python command +run_python_command() { + function die { echo $1: status $2 ; exit $2; } + + entry="$1" + key="$2" + + # Check conditions to skip certain combinations + if [[ "$entry" == *visualization-live_cfg.py* && ( "$key" == "pp_run_stage1" || "$key" == "cosmic_run_stage1" || "$key" == "hpu_run" ) ]]; then + echo "===== Skipping Test \"python3 $entry runkey=$key\" ====" + return + fi + + # Otherwise, proceed with the test + echo "===== Test \"python3 $entry runkey=$key\" ====" + (python3 "$entry" runkey="$key" > /dev/null) 2>&1 || die "Failure using python3 $entry" $? +} + +# Run the tests for the specified key +echo "Running tests for key: $key" +for entry in "${CMSSW_BASE}/src/DQM/Integration/python/clients/"*"-live_cfg.py"; do + run_python_command "$entry" "$key" +done + +# All tests passed +echo "All tests passed!"