Skip to content

Commit a759353

Browse files
committed
add a unit testing script for dumpRecoGeometry
1 parent aa23891 commit a759353

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<test name="test_dumpRecoGeometry" command="test_dumpRecoGeometry.sh"/>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash -x
2+
function die { echo $1: status $2 ; exit $2; }
3+
4+
# Define the base directory where the geometry files are located
5+
GEOMETRY_DIR="${CMSSW_BASE}/src/Configuration/Geometry/python"
6+
if [ ! -e ${GEOMETRY_DIR} ] ; then
7+
GEOMETRY_DIR="${CMSSW_RELEASE_BASE}/src/Configuration/Geometry/python"
8+
fi
9+
10+
# Define the list of tags
11+
TAGS=("Run1" "2015" "2017" "2026") #"2021"
12+
13+
# Function to extract the available versions for 2026
14+
get_2026_versions() {
15+
local files=($(ls ${GEOMETRY_DIR}/GeometryExtended2026D*Reco*))
16+
if [ ${#files[@]} -eq 0 ]; then
17+
echo "No files found for 2026 versions."
18+
exit 1
19+
fi
20+
21+
local versions=()
22+
for file in "${files[@]}"; do
23+
local version=$(basename "$file" | sed -n 's/.*GeometryExtended2026D\([0-9]\{1,3\}\).*/\1/p')
24+
if [[ "$version" =~ ^[0-9]{1,3}$ ]]; then
25+
versions+=("D${version}")
26+
fi
27+
done
28+
29+
# Return the unique sorted list of versions
30+
echo "${versions[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' '
31+
}
32+
33+
# Iterate over each tag
34+
for TAG in "${TAGS[@]}"; do
35+
if [ "$TAG" == "2026" ]; then
36+
# Get all the versions for 2026
37+
VERSIONS=($(get_2026_versions))
38+
for VERSION in "${VERSIONS[@]}"; do
39+
echo "Running for 2026 with version $VERSION"
40+
cmsRun $CMSSW_BASE/src/Fireworks/Geometry/python/dumpRecoGeometry_cfg.py tag=2026 version=$VERSION
41+
# Check the exit status of the command
42+
if [ $? -ne 0 ]; then
43+
echo "Error running cmsRun for tag=2026 and version=$VERSION"
44+
exit 1
45+
fi
46+
done
47+
else
48+
echo "Running for tag $TAG"
49+
cmsRun $CMSSW_BASE/src/Fireworks/Geometry/python/dumpRecoGeometry_cfg.py tag=$TAG
50+
# Check the exit status of the command
51+
if [ $? -ne 0 ]; then
52+
echo "Error running cmsRun for tag=$TAG"
53+
exit 1
54+
fi
55+
fi
56+
done

0 commit comments

Comments
 (0)