From 8bb5298a300b97b33ab88a1e9976225e2123dfe0 Mon Sep 17 00:00:00 2001 From: Rafal Bielski <rafal.bielski@cern.ch> Date: Thu, 9 Apr 2020 22:59:13 +0200 Subject: [PATCH] TrigValSteering: Remove RegTest from default check steps Adapt tests which required RegTest to add it manually. All other tests will no longer run RegTest. --- .../test_trigAna_RDOtoRDOTrig_mt1_build.py | 12 ++++++---- .../test/test_trigP1_BeamSpot_build.py | 11 +++++---- .../python/TrigValSteering/CheckSteps.py | 23 ++++++++++++------- .../test/test_unit_trigvalsteering.py | 8 +++++-- .../test/test_trig_data_newJO_build.py | 4 ---- .../test/test_trig_data_v1Dev_MT_build.py | 11 +++++---- .../test/test_trig_data_v1Dev_build.py | 12 +++++----- 7 files changed, 46 insertions(+), 35 deletions(-) diff --git a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoRDOTrig_mt1_build.py b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoRDOTrig_mt1_build.py index f9fe0a611ba..d757889b79a 100755 --- a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoRDOTrig_mt1_build.py +++ b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoRDOTrig_mt1_build.py @@ -20,11 +20,13 @@ test.art_type = 'build' test.exec_steps = [ex] test.check_steps = CheckSteps.default_check_steps(test) -# Overwrite default RegTest settings -regtest = test.get_step('RegTest') -regtest.regex = 'TrigSignatureMoniMT.*HLT_.*|TrigSignatureMoniMT.*-- #[0-9]+ (Events|Features).*' -regtest.reference = 'TrigAnalysisTest/ref_RDOtoRDOTrig_mt1_build.ref' -regtest.required = True # Final exit code depends on this step +# Add a step comparing counts in the log against reference +refcomp = CheckSteps.RegTestStep("CountRefComp") +refcomp.input_base_name = 'athena.merged' +refcomp.regex = 'TrigSignatureMoniMT.*HLT_.*|TrigSignatureMoniMT.*-- #[0-9]+ (Events|Features).*' +refcomp.reference = 'TrigAnalysisTest/ref_RDOtoRDOTrig_mt1_build.ref' +refcomp.required = True # Final exit code depends on this step +CheckSteps.add_step_after_type(test.check_steps, CheckSteps.LogMergeStep, refcomp) import sys sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_BeamSpot_build.py b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_BeamSpot_build.py index e78dffd2bd4..c284f534bde 100755 --- a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_BeamSpot_build.py +++ b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_BeamSpot_build.py @@ -38,11 +38,12 @@ test.exec_steps = [ex_rm, ex_bs, ex] test.check_steps = [chk for chk in CheckSteps.default_check_steps(test) if type(chk) in (CheckSteps.LogMergeStep, CheckSteps.CheckLogStep, CheckSteps.RegTestStep)] -# Overwrite default RegTest settings -regtest = test.get_step('RegTest') -regtest.regex = 'InDet::InDetBeamSpotReader.*|BeamSpotCondAlg.*' -regtest.reference = 'TrigP1Test/BeamSpot.ref' -regtest.required = True # Final exit code depends on this step +# Add a reference comparison step +refcomp = CheckSteps.RegTestStep('RefComp') +refcomp.regex = 'InDet::InDetBeamSpotReader.*|BeamSpotCondAlg.*' +refcomp.reference = 'TrigP1Test/BeamSpot.ref' +refcomp.required = True # Final exit code depends on this step +CheckSteps.add_step_after_type(test.check_steps, CheckSteps.LogMergeStep, refcomp) import sys sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TrigValTools/python/TrigValSteering/CheckSteps.py b/Trigger/TrigValidation/TrigValTools/python/TrigValSteering/CheckSteps.py index ed979ceae7c..50145813001 100644 --- a/Trigger/TrigValidation/TrigValTools/python/TrigValSteering/CheckSteps.py +++ b/Trigger/TrigValidation/TrigValTools/python/TrigValSteering/CheckSteps.py @@ -727,14 +727,6 @@ def default_check_steps(test): msgcount = MessageCountStep('MessageCount') check_steps.append(msgcount) - # RegTest - regtest = RegTestStep() - if log_to_check is not None: - regtest.input_base_name = os.path.splitext(log_to_check)[0] - if 'athenaHLT' in step_types: - regtest.regex = r'(?:HltEventLoopMgr(?!.*athenaHLT-)(?!.*DF_Pid)|REGTEST)' - check_steps.append(regtest) - # Tail (probably not so useful these days) tail = TailStep() if log_to_check is not None: @@ -767,3 +759,18 @@ def default_check_steps(test): # return the steps return check_steps + + +def add_step_after_type(step_list, ref_type, step_to_add): + ''' + Insert step_to_add into step_list after the last step of type ref_type. + If the list has no steps of type ref_type, append step_to_add at the end of the list. + ''' + index_to_add = -1 + for index, step in enumerate(step_list): + if isinstance(step, ref_type): + index_to_add = index+1 + if index_to_add > 0: + step_list.insert(index_to_add, step_to_add) + else: + step_list.append(step_to_add) diff --git a/Trigger/TrigValidation/TrigValTools/test/test_unit_trigvalsteering.py b/Trigger/TrigValidation/TrigValTools/test/test_unit_trigvalsteering.py index 2a23da8f56a..8d8958e2b9c 100755 --- a/Trigger/TrigValidation/TrigValTools/test/test_unit_trigvalsteering.py +++ b/Trigger/TrigValidation/TrigValTools/test/test_unit_trigvalsteering.py @@ -34,8 +34,12 @@ regtest_ref_text = [ with open('regtest.ref','w') as f: f.write('\n'.join(regtest_ref_text)) -test.get_step("RegTest").regex = '###' -test.get_step("RegTest").reference = 'regtest.ref' +refcomp = CheckSteps.RegTestStep('RefComp') +refcomp.input_base_name = 'athena.merged' +refcomp.regex = '###' +refcomp.reference = 'regtest.ref' +refcomp.required = True +CheckSteps.add_step_after_type(test.check_steps, CheckSteps.LogMergeStep, refcomp) import sys sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_newJO_build.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_newJO_build.py index 6f7839c41f7..1d62c1fb18a 100755 --- a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_newJO_build.py +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_newJO_build.py @@ -39,9 +39,5 @@ test.art_type = 'build' test.exec_steps = [copy_jo, pickle, run_athena] test.check_steps = CheckSteps.default_check_steps(test) -# Change RegTest pattern -regtest = test.get_step('RegTest') -regtest.regex = 'TrigSignatureMoniMT.*HLT_.*|TrigSignatureMoniMT.*-- #[0-9]+ (Events|Features).*' - import sys sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_MT_build.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_MT_build.py index 23d604c7023..0feb6229726 100755 --- a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_MT_build.py +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_MT_build.py @@ -28,11 +28,12 @@ test.art_type = 'build' test.exec_steps = [ex] test.check_steps = CheckSteps.default_check_steps(test) -# Overwrite default RegTest settings -regtest = test.get_step('RegTest') -regtest.regex = 'TrigSignatureMoniMT.*HLT_.*|TrigSignatureMoniMT.*-- #[0-9]+ (Events|Features).*' -regtest.reference = 'TriggerTest/ref_data_v1Dev_build.ref' -regtest.required = True # Final exit code depends on this step +# Add a step comparing counts in the log against reference +refcomp = CheckSteps.RegTestStep("CountRefComp") +refcomp.regex = 'TrigSignatureMoniMT.*HLT_.*|TrigSignatureMoniMT.*-- #[0-9]+ (Events|Features).*' +refcomp.reference = 'TriggerTest/ref_data_v1Dev_build.ref' +refcomp.required = True # Final exit code depends on this step +CheckSteps.add_step_after_type(test.check_steps, CheckSteps.LogMergeStep, refcomp) import sys sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_build.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_build.py index 8e55dc677ef..e216367b5da 100755 --- a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_build.py +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_build.py @@ -33,12 +33,12 @@ msgcount.info_threshold = 1200 msgcount.other_threshold = 100 msgcount.required = True # make the test exit code depend on this step - -# Overwrite default RegTest settings -regtest = test.get_step('RegTest') -regtest.regex = 'TrigSignatureMoniMT.*HLT_.*|TrigSignatureMoniMT.*-- #[0-9]+ (Events|Features).*' -regtest.reference = 'TriggerTest/ref_data_v1Dev_build.ref' -regtest.required = True # Final exit code depends on this step +# Add a step comparing counts in the log against reference +refcomp = CheckSteps.RegTestStep("CountRefComp") +refcomp.regex = 'TrigSignatureMoniMT.*HLT_.*|TrigSignatureMoniMT.*-- #[0-9]+ (Events|Features).*' +refcomp.reference = 'TriggerTest/ref_data_v1Dev_build.ref' +refcomp.required = True # Final exit code depends on this step +CheckSteps.add_step_after_type(test.check_steps, CheckSteps.LogMergeStep, refcomp) import sys sys.exit(test.run()) -- GitLab