[test-suite] r266778 - litsupport: Make hash module more robust

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 19 10:49:06 PDT 2016


Author: matze
Date: Tue Apr 19 12:49:06 2016
New Revision: 266778

URL: http://llvm.org/viewvc/llvm-project?rev=266778&view=rev
Log:
litsupport: Make hash module more robust

Modified:
    test-suite/trunk/litsupport/hash.py

Modified: test-suite/trunk/litsupport/hash.py
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/litsupport/hash.py?rev=266778&r1=266777&r2=266778&view=diff
==============================================================================
--- test-suite/trunk/litsupport/hash.py (original)
+++ test-suite/trunk/litsupport/hash.py Tue Apr 19 12:49:06 2016
@@ -8,6 +8,8 @@ import platform
 
 
 def compute(context):
+    if hasattr(context, 'executable_hash'):
+        return
     executable = context.executable
     try:
         # Darwin's "strip" doesn't support these arguments.
@@ -25,7 +27,7 @@ def compute(context):
         context.executable_hash = h.hexdigest()
     except:
         logging.info('Could not calculate hash for %s' % executable)
-        context.executable_hash = None
+        context.executable_hash = ''
 
 
 def same_as_previous(context):
@@ -46,9 +48,9 @@ def same_as_previous(context):
 
 
 def _getHash(context):
+    compute(context)
     return {'hash': lit.Test.toMetricValue(context.executable_hash)}
 
 
 def mutatePlan(context, plan):
-    if context.executable_hash is not None:
-        plan.metric_collectors.append(_getHash)
+    plan.metric_collectors.append(_getHash)




More information about the llvm-commits mailing list