Skip to content

Commit ab5d1c0

Browse files
authored
Merge pull request #47860 from mmusich/fix_hltInfo
Fix `hltInfo` utility script and add a unit test
2 parents ff4fe6c + 6110b82 commit ab5d1c0

File tree

3 files changed

+52
-3
lines changed

3 files changed

+52
-3
lines changed

HLTrigger/Tools/scripts/hltInfo

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,23 @@ if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
1717
exit 0
1818
fi
1919

20-
edmProvDump "$1" | awk 'BEGIN {keep=0} /Producers with data in file/ {keep=0} // { if (keep) print $1, gensub(/["'\'']/,"", "g", $3), gensub(/[()]/, "", "g", $5) } /^Processing History:/ {keep=1}' | while read P R H; do
21-
echo "process $P (release $R)"
22-
edmProvDump "$1" -i $H | grep 'tableName\|globaltag' | sed -e's/string \(un\)\?tracked = //' -e's/tableName:/HLT menu: /' -e's/globaltag:/global tag:/'
20+
FILE="$1"
21+
22+
edmProvDump "$FILE" | awk '
23+
BEGIN {keep=0}
24+
/Producers with data in file/ {keep=0}
25+
/^Processing History:/ {keep=1; next}
26+
keep && NF >= 4 {
27+
proc = $1;
28+
rel = gensub(/["'\'']/, "", "g", $2);
29+
hash = gensub(/[()]/, "", "g", $4);
30+
print proc, rel, hash;
31+
}
32+
' | while read PROC REL HASH; do
33+
echo "process $PROC (release $REL)"
34+
edmProvDump "$FILE" --dumpPSetID "$HASH" 2>/dev/null | \
35+
grep -E '^\s*tableName:|^\s*globaltag:' | \
36+
sed -E -e 's/.*tableName:[^=]*= */ HLT menu: /' \
37+
-e 's/.*globaltag:[^=]*= */ global tag: /'
2338
echo
2439
done

HLTrigger/Tools/test/BuildFile.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
<!-- tests convertToRaw utility script -->
22
<test name="testConvertToRaw" command="testConvertToRaw.sh"/>
3+
<!-- tests hltInfoutility script -->
4+
<test name="testHltInfo" command="check_hlt_info.sh"/>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
FILE="/store/data/Run2024I/EphemeralHLTPhysics0/RAW/v1/000/386/593/00000/91a08676-199e-404c-9957-f72772ef1354.root"
4+
5+
EXPECTED_OUTPUT=$(cat <<EOF
6+
process LHC (release CMSSW_14_0_15_patch1)
7+
8+
process HLT (release CMSSW_14_0_15_patch1)
9+
HLT menu: '/cdaq/physics/Run2024/2e34/v1.4.9/HLT/V1'
10+
global tag: '140X_dataRun3_HLT_v3'
11+
EOF
12+
)
13+
14+
# Run hltInfo and capture its output
15+
ACTUAL_OUTPUT=$(hltInfo "$FILE")
16+
17+
# Compare using diff
18+
if diff <(echo "$ACTUAL_OUTPUT") <(echo "$EXPECTED_OUTPUT") > /dev/null; then
19+
echo "Output matches expected format."
20+
exit 0
21+
else
22+
echo "Output does NOT match expected format."
23+
echo
24+
echo "---- Expected Output ----"
25+
echo "$EXPECTED_OUTPUT"
26+
echo "-----------------------"
27+
echo
28+
echo "---- Actual Output ----"
29+
echo "$ACTUAL_OUTPUT"
30+
echo "-----------------------"
31+
exit 1
32+
fi

0 commit comments

Comments
 (0)