From 28f2eebac0e30734f4f91e19af02a8591b7586c7 Mon Sep 17 00:00:00 2001
From: Dan Guest <dguest@cern.ch>
Date: Fri, 6 Dec 2019 11:01:55 +0100
Subject: [PATCH] make --nan-equal an argument for acmd diff-root, use it for
 frozen derivation tests

---
 .../scripts/frozen_derivation_test.py                      | 3 ++-
 Tools/PyUtils/python/scripts/diff_root_files.py            | 7 ++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/scripts/frozen_derivation_test.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/scripts/frozen_derivation_test.py
index f3ae6d70299..b0510b033fe 100755
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/scripts/frozen_derivation_test.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/scripts/frozen_derivation_test.py
@@ -110,7 +110,8 @@ def compare_files(cleanHeadDir,uniqId,pwd,isPatchedOnly):
 
     comparison_command = ( 'acmd.py diff-root ' + cleanDir + '/DAOD_PHYSVAL.pool.root '
                            'patched_derivation_test/DAOD_PHYSVAL.pool.root ' 
-                           '--error-mode resilient ' 
+                           '--error-mode resilient '
+                           '--nan-equal '
                            '--entries 20 > patched_derivation_test/diff-root.DAOD.log 2>&1' )
     output,error = subprocess.Popen(['/bin/bash', '-c', comparison_command], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
 
diff --git a/Tools/PyUtils/python/scripts/diff_root_files.py b/Tools/PyUtils/python/scripts/diff_root_files.py
index 8566e84e532..e079ee6fc5e 100644
--- a/Tools/PyUtils/python/scripts/diff_root_files.py
+++ b/Tools/PyUtils/python/scripts/diff_root_files.py
@@ -91,6 +91,11 @@ default='%(default)s'.
 allowed: %(choices)s
 """
                   )
+@acmdlib.argument('--nan-equal',
+                  action='store_true',
+                  default=False,
+                  help="""Compare nan as equal to nan""")
+
 def main(args):
     """check that 2 ROOT files have same content (containers and sizes)
     """
@@ -293,7 +298,7 @@ def main(args):
                 tree_name, jentry, name, inew = d_new
 
             # for regression testing we should have NAN == NAN
-            if isnan(iold) and isnan(inew):
+            if isnan(iold) and isnan(inew) and args.nan_equal:
                 n_good += 1
                 continue
 
-- 
GitLab