From 671e3c922d4845a74d39a12a0b0c635193845982 Mon Sep 17 00:00:00 2001
From: Tadej Novak <tadej.novak@cern.ch>
Date: Fri, 17 May 2024 14:26:55 +0200
Subject: [PATCH] CI: Check for duplicated components

---
 AtlasTest/CITest/AthGeneration.cmake              |  3 +++
 AtlasTest/CITest/AthSimulation.cmake              |  3 +++
 AtlasTest/CITest/Athena.cmake                     |  3 +++
 AtlasTest/CITest/test/DuplicateComponentsCheck.py | 10 ++++++++++
 4 files changed, 19 insertions(+)
 create mode 100755 AtlasTest/CITest/test/DuplicateComponentsCheck.py

diff --git a/AtlasTest/CITest/AthGeneration.cmake b/AtlasTest/CITest/AthGeneration.cmake
index 492283b0a14d..7f759c1b8ca1 100644
--- a/AtlasTest/CITest/AthGeneration.cmake
+++ b/AtlasTest/CITest/AthGeneration.cmake
@@ -8,6 +8,9 @@ atlas_add_citest( DuplicateClass
    SCRIPT python -c 'import ROOT'
    PROPERTIES FAIL_REGULAR_EXPRESSION "class .* is already in" )
 
+atlas_add_citest( DuplicateComponent
+   SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/DuplicateComponentsCheck.py )
+
 atlas_add_citest( Generation_PhPy8_13p6TeV
    SCRIPT RunWorkflowTests_Run3.py --CI -g --dsid 421356 )
 
diff --git a/AtlasTest/CITest/AthSimulation.cmake b/AtlasTest/CITest/AthSimulation.cmake
index ff77fba36dc9..2b84ba7d90c5 100644
--- a/AtlasTest/CITest/AthSimulation.cmake
+++ b/AtlasTest/CITest/AthSimulation.cmake
@@ -8,6 +8,9 @@ atlas_add_citest( DuplicateClass
    SCRIPT python -c 'import ROOT'
    PROPERTIES FAIL_REGULAR_EXPRESSION "class .* is already in" )
 
+atlas_add_citest( DuplicateComponent
+   SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/DuplicateComponentsCheck.py )
+
 atlas_add_citest( SimulationRun2FullSim
    SCRIPT RunWorkflowTests_Run2.py --CI -s -w FullSim --threads 4 -e '--maxEvents 10' --run-only
    LOG_IGNORE_PATTERN "WARNING FPE"  # ignore FPEs from Geant4
diff --git a/AtlasTest/CITest/Athena.cmake b/AtlasTest/CITest/Athena.cmake
index ed07d143bf8b..a9e029640b42 100644
--- a/AtlasTest/CITest/Athena.cmake
+++ b/AtlasTest/CITest/Athena.cmake
@@ -11,6 +11,9 @@ atlas_add_citest( DuplicateClass
    SCRIPT python -c 'import ROOT'
    PROPERTIES FAIL_REGULAR_EXPRESSION "class .* is already in" )
 
+atlas_add_citest( DuplicateComponent
+   SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/DuplicateComponentsCheck.py )
+
 #################################################################################
 # Digitization/Simulation
 #################################################################################
diff --git a/AtlasTest/CITest/test/DuplicateComponentsCheck.py b/AtlasTest/CITest/test/DuplicateComponentsCheck.py
new file mode 100755
index 000000000000..16164970962c
--- /dev/null
+++ b/AtlasTest/CITest/test/DuplicateComponentsCheck.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
+
+import sys
+from AthenaCommon.ConfigurableDb import cfgDb, getConfigurable
+
+getConfigurable('xAODMaker::EventInfoCnvAlg')
+
+if cfgDb.duplicates():
+    sys.exit(1)
-- 
GitLab