Skip to content

Commit

Permalink
introduce a python compilation unit test for the DQM online configura…
Browse files Browse the repository at this point in the history
…tions
  • Loading branch information
mmusich committed Mar 19, 2024
1 parent 9f64ade commit 88c605b
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
8 changes: 8 additions & 0 deletions DQM/Integration/test/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,11 @@
<!-- <test name="TestDQMOnlineClient-hcalcalib_dqm_sourceclient" command="runtest.sh hcalcalib_dqm_sourceclient-live_cfg.py" /> -->
<test name="TestDQMOnlineClient-visualization" command="runtest.sh visualization-live_cfg.py" />
<test name="TestDQMOnlineClient-visualization_secondInstance" command="runtest.sh visualization-live-secondInstance_cfg.py" />
<!--tests that the configuration is compilable for the full matrix of combinations -->
<test name="TestDQMOnlineClients-compilation_pp_run" command="runCompilationTest.sh pp_run"/>
<test name="TestDQMOnlineClients-compilation_pp_run_stage1" command="runCompilationTest.sh pp_run_stage1"/>
<test name="TestDQMOnlineClients-compilation_cosmic_run" command="runCompilationTest.sh cosmic_run"/>
<test name="TestDQMOnlineClients-compilation_cosmic_run_stage1" command="runCompilationTest.sh cosmic_run_stage1"/>
<test name="TestDQMOnlineClients-compilation_hi_run" command="runCompilationTest.sh hi_run"/>
<test name="TestDQMOnlineClients-compilation_hpu_run" command="runCompilationTest.sh hpu_run"/>
<test name="TestDQMOnlineClients-compilation_commissioning_run" command="runCompilationTest.sh commissioning_run"/>
37 changes: 37 additions & 0 deletions DQM/Integration/test/runCompilationTest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

# Check if the key argument is provided
if [ $# -eq 0 ]; then
echo "Usage: $0 <key>"
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!"

0 comments on commit 88c605b

Please sign in to comment.