Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-02-07 23:29:33

0001 #!/bin/bash
0002 
0003 # Pass in name and status
0004 function die {
0005   printf "\n%s: status %s\n" "$1" "$2"
0006   if [ $# -gt 2 ]; then
0007     printf "%s\n" "=== Log File =========="
0008     cat $3
0009     printf "%s\n" "=== End of Log File ==="
0010   fi
0011   exit $2
0012 }
0013 
0014 # Directory for the generated files
0015 PYTHON_FILE="Phase2_dump_cfg.py"
0016 DUMP_FILE="Phase2_dump.py"
0017 GROUPS_FILE="hltFindDuplicates_output/groups.txt"
0018 
0019 # Step 1: Generate the Python file
0020 cat << EOF > "$PYTHON_FILE"
0021 import FWCore.ParameterSet.Config as cms
0022 process = cms.Process("HLT")
0023 process.load("HLTrigger.Configuration.HLT_75e33_cff")
0024 EOF
0025 
0026 # Step 2: Run edmConfigDump on the generated Python file
0027 echo "Running edmConfigDump..."
0028 edmConfigDump "$PYTHON_FILE" > "$DUMP_FILE"
0029 if [[ $? -ne 0 ]]; then
0030   echo "Error: edmConfigDump failed."
0031   exit 1
0032 fi
0033 
0034 # Step 3: Check the dumped configuration for syntax errors
0035 echo "Running compilation check..."
0036 python3 -m py_compile "$DUMP_FILE" 2> "syntax_errors.txt"
0037 if [[ $? -ne 0 ]]; then
0038   echo "Error: The dumped configuration has syntax errors."
0039   cat "syntax_errors.txt"
0040   exit 1
0041 fi
0042 
0043 # Step 3: Run hltFindDuplicates on the dumped configuration
0044 echo "Running hltFindDuplicates..."
0045 hltFindDuplicates $DUMP_FILE -v 2 \
0046   -o hltFindDuplicates_output &> test_hltFindDuplicates_log \
0047   || die 'Failure running hltFindDuplicates' $? test_hltFindDuplicates_log
0048 if [[ $? -ne 0 ]]; then
0049   echo "Error: hltFindDuplicates failed."
0050   exit 1
0051 fi
0052 
0053 # Step 4: Check if groups.txt is empty
0054 echo "Checking group file..."
0055 if [[ ! -f "$GROUPS_FILE" ]]; then
0056   echo "Error: $GROUPS_FILE not found."
0057   exit 1
0058 fi
0059 
0060 if [[ -s "$GROUPS_FILE" ]]; then
0061   echo "Duplicates found. Contents of $GROUPS_FILE:"
0062   cat "$GROUPS_FILE"
0063   exit 1
0064 else
0065   echo "No duplicates found. Exiting successfully."
0066   exit 0
0067 fi