From 1c955d717f9f77696c7bc70375ada3b58862a5d8 Mon Sep 17 00:00:00 2001 From: mmusich Date: Mon, 5 Feb 2024 10:56:15 +0100 Subject: [PATCH 1/2] fix mistake in integration of CMSHLT-3019 --- HLTrigger/Configuration/tables/online_grun.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/HLTrigger/Configuration/tables/online_grun.txt b/HLTrigger/Configuration/tables/online_grun.txt index 631d6883f82e4..acc3063d41e45 100644 --- a/HLTrigger/Configuration/tables/online_grun.txt +++ b/HLTrigger/Configuration/tables/online_grun.txt @@ -427,7 +427,6 @@ HLT_IsoMu24_TwoProngs35_v* # CMSHLT-1885 HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_PFDiJet30_v* # CMSHLT-1796 HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_CaloDiJet30_v* # CMSHLT-1796 HLT_VBF_DoubleMediumDeepTauPFTauHPS20_eta2p1_v* # CMSHLT-2289 -HLT_IsoMu27_MediumDeepTauPFTauHPS20_eta2p1_SingleL1_v* # CMSHLT-2349 HLT_ZeroBias_Alignment_v* # CMSHLT-1892 HLT_CDC_L2cosmic_5p5_er1p0_v* # CMSHLT-1896 HLT_Ele30_WPTight_Gsf_v* # CMSHLT-1921 From 5a55dd7f2a7b651e97525b2559b70af6f92d7764 Mon Sep 17 00:00:00 2001 From: mmusich Date: Mon, 5 Feb 2024 10:57:19 +0100 Subject: [PATCH 2/2] add script to check consistency of online tables with respect to development tables and implement unit test --- HLTrigger/Configuration/test/BuildFile.xml | 3 + .../test/test_OnlineVsDevTablesConsistency.sh | 75 +++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100755 HLTrigger/Configuration/test/test_OnlineVsDevTablesConsistency.sh diff --git a/HLTrigger/Configuration/test/BuildFile.xml b/HLTrigger/Configuration/test/BuildFile.xml index e106df22c9b7d..776f01c7ef6de 100644 --- a/HLTrigger/Configuration/test/BuildFile.xml +++ b/HLTrigger/Configuration/test/BuildFile.xml @@ -14,3 +14,6 @@ + + + diff --git a/HLTrigger/Configuration/test/test_OnlineVsDevTablesConsistency.sh b/HLTrigger/Configuration/test/test_OnlineVsDevTablesConsistency.sh new file mode 100755 index 0000000000000..ec10cbfdf10db --- /dev/null +++ b/HLTrigger/Configuration/test/test_OnlineVsDevTablesConsistency.sh @@ -0,0 +1,75 @@ +#!/bin/bash + +function die { echo $1: status $2 ; exit $2; } + +function compare_files() { + local file1_path="$1" + local file2_path="$2" + local exclude_set=("HLTAnalyzerEndpath" "RatesMonitoring" "DQMHistograms") + + local lines_file1=() + local lines_file2=() + local not_in_file2=() + + # extract the list of paths to match from the first file + while IFS= read -r line; do + if [[ ! $line =~ ^# ]]; then + # Extract the first word before a space + first_word=$(echo "$line" | awk '{print $1}') + lines_file1+=("$first_word") + fi + done < "$file1_path" + + # extract the list of paths to match from the second file + while IFS= read -r line; do + if [[ ! $line =~ ^# ]]; then + # Extract the first word before a space + first_word=$(echo "$line" | awk '{print $1}') + lines_file2+=("$first_word") + fi + done < "$file2_path" + + # find the set not in common + for line in "${lines_file1[@]}"; do + if [[ ! "${lines_file2[@]}" =~ "$line" ]]; then + not_in_file2+=("$line") + fi + done + + # Remove lines from not_in_file2 that contain any substring in exclude_set + for pattern in "${exclude_set[@]}"; do + not_in_file2=("${not_in_file2[@]//*$pattern*}") + done + + # Remove empty elements and empty lines after substitution + not_in_file2=("${not_in_file2[@]//''}") + + # Remove empty elements from the array + local cleaned_not_in_file2=() + for element in "${not_in_file2[@]}"; do + if [[ -n "$element" ]]; then + cleaned_not_in_file2+=("$element") + fi + done + + file1_name=$(basename "$file1_path") + file2_name=$(basename "$file2_path") + + if [ ${#cleaned_not_in_file2[@]} -eq 0 ]; then + echo "All lines from $file1_name are included in $file2_name." + return 0 + else + echo "Lines present in $file1_name but not in $file2_name (excluding the exclusion set):" + printf '%s\n' "${not_in_file2[@]}" + return 1 + fi +} + +TABLES_AREA="$CMSSW_BASE/src/HLTrigger/Configuration/tables" + +compare_files $TABLES_AREA/online_pion.txt $TABLES_AREA/PIon.txt || die "Failure comparing online_pion and PIon" $? +compare_files $TABLES_AREA/online_hion.txt $TABLES_AREA/HIon.txt || die "Failure comparing online_hion and HIon" $? +compare_files $TABLES_AREA/online_pref.txt $TABLES_AREA/PRef.txt || die "Failure comparing online_pref and PRef" $? +compare_files $TABLES_AREA/online_cosmics.txt $TABLES_AREA/Special.txt || die "Failure comparing online_cosmics and Special" $? +compare_files $TABLES_AREA/online_special.txt $TABLES_AREA/Special.txt || die "Failure comparing online_special and Special" $? +compare_files $TABLES_AREA/online_grun.txt $TABLES_AREA/GRun.txt || die "Failure comparing online_grun and GRun" $?