File indexing completed on 2024-04-06 12:18:19
0001
0002
0003 function die { echo $1: status $2 ; exit $2; }
0004
0005 check_file_existence() {
0006 local file_path="$1"
0007
0008 if [ -e "$file_path" ]; then
0009
0010 :
0011 else
0012
0013 echo -e "\e[91mError: File '$file_path' does not exist.\e[0m"
0014 exit 1
0015 fi
0016 }
0017
0018 function compare_files() {
0019 local file1_path="$1"
0020 local file2_path="$2"
0021
0022
0023 check_file_existence "$file1_path"
0024 check_file_existence "$file2_path"
0025
0026 local exclude_set=("HLTAnalyzerEndpath" "RatesMonitoring" "DQMHistograms")
0027
0028 local lines_file1=()
0029 local lines_file2=()
0030 local not_in_file2=()
0031
0032
0033 while IFS= read -r line; do
0034 if [[ ! $line =~ ^
0035
0036 first_word=$(echo "$line" | awk '{print $1}')
0037 lines_file1+=("$first_word")
0038 fi
0039 done < "$file1_path"
0040
0041
0042 while IFS= read -r line; do
0043 if [[ ! $line =~ ^
0044
0045 first_word=$(echo "$line" | awk '{print $1}')
0046 lines_file2+=("$first_word")
0047 fi
0048 done < "$file2_path"
0049
0050
0051 for line in "${lines_file1[@]}"; do
0052 if [[ ! "${lines_file2[@]}" =~ "$line" ]]; then
0053 not_in_file2+=("$line")
0054 fi
0055 done
0056
0057
0058 for pattern in "${exclude_set[@]}"; do
0059 not_in_file2=("${not_in_file2[@]//*$pattern*}")
0060 done
0061
0062
0063 not_in_file2=("${not_in_file2[@]//''}")
0064
0065
0066 local cleaned_not_in_file2=()
0067 for element in "${not_in_file2[@]}"; do
0068 if [[ -n "$element" ]]; then
0069 cleaned_not_in_file2+=("$element")
0070 fi
0071 done
0072
0073 file1_name=$(basename "$file1_path")
0074 file2_name=$(basename "$file2_path")
0075
0076 if [ ${
0077 echo -e "\033[92mAll lines from $file1_name are included in $file2_name.\033[0m"
0078 return 0
0079 else
0080 echo "Lines present in $file1_name but not in $file2_name (excluding the exclusion set):"
0081 printf '%s\n' "${not_in_file2[@]}"
0082 return 1
0083 fi
0084 }
0085
0086 TABLES_AREA="$CMSSW_BASE/src/HLTrigger/Configuration/tables"
0087
0088 compare_files $TABLES_AREA/online_pion.txt $TABLES_AREA/PIon.txt || die "Failure comparing online_pion and PIon" $?
0089 compare_files $TABLES_AREA/online_hion.txt $TABLES_AREA/HIon.txt || die "Failure comparing online_hion and HIon" $?
0090 compare_files $TABLES_AREA/online_pref.txt $TABLES_AREA/PRef.txt || die "Failure comparing online_pref and PRef" $?
0091 compare_files $TABLES_AREA/online_Circulating.txt $TABLES_AREA/Special.txt || die "Failure comparing online_Circulating and Special" $?
0092 compare_files $TABLES_AREA/online_PPS.txt $TABLES_AREA/Special.txt || die "Failure comparing online_PPS and Special" $?
0093 compare_files $TABLES_AREA/online_LumiScan.txt $TABLES_AREA/Special.txt || die "Failure comparing online_LumiScan and Special" $?
0094 compare_files $TABLES_AREA/online_FirstCollisions.txt $TABLES_AREA/Special.txt || die "Failure comparing online_FirstCollisions and Special" $?
0095 compare_files $TABLES_AREA/online_ECALTiming.txt $TABLES_AREA/Special.txt || die "Failure comparing online_ECALTiming and Special" $?
0096 compare_files $TABLES_AREA/online_Cosmics.txt $TABLES_AREA/Special.txt || die "Failure comparing online_Cosmics and Special" $?
0097 compare_files $TABLES_AREA/online_TrackerVR.txt $TABLES_AREA/Special.txt || die "Failure comparing online_TrackerVR and Special" $?
0098 compare_files $TABLES_AREA/online_Splashes.txt $TABLES_AREA/Special.txt || die "Failure comparing online_Splashes and Special" $?
0099 compare_files $TABLES_AREA/online_Special.txt $TABLES_AREA/Special.txt || die "Failure comparing online_Special and Special" $?
0100 compare_files $TABLES_AREA/online_grun.txt $TABLES_AREA/GRun.txt || die "Failure comparing online_grun and GRun" $?