[test-suite] r366999 - Skip test earlier if metric is not found in compare.py

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 25 02:43:06 PDT 2019


Author: fhahn
Date: Thu Jul 25 02:43:06 2019
New Revision: 366999

URL: http://llvm.org/viewvc/llvm-project?rev=366999&view=rev
Log:
Skip test earlier if metric is not found in compare.py

This speeds up processing for inputs with lots of missing metrics, by
avoiding adding them to names.

Reviewed By: paquette

Differential Revision: https://reviews.llvm.org/D64065

Modified:
    test-suite/trunk/utils/compare.py

Modified: test-suite/trunk/utils/compare.py
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/utils/compare.py?rev=366999&r1=366998&r2=366999&view=diff
==============================================================================
--- test-suite/trunk/utils/compare.py (original)
+++ test-suite/trunk/utils/compare.py Thu Jul 25 02:43:06 2019
@@ -32,10 +32,10 @@ def read_lit_json(filename):
         if name in names:
             sys.stderr.write("Error: Multiple tests with name '%s'\n" % name)
             sys.exit(1)
-        names.add(name)
         if "metrics" not in test:
-            print("Warning: '%s' has No metrics!" % test['name'])
+            print("Warning: '%s' has no metrics, skipping!" % test['name'])
             continue
+        names.add(name)
         for name in test["metrics"].keys():
             if name not in columnindexes:
                 columnindexes[name] = len(columns)
@@ -50,15 +50,16 @@ def read_lit_json(filename):
     data = []
     testnames = []
     for test in jsondata['tests']:
+        if "metrics" not in test:
+            continue
         name = test['name']
         if 'shortname' in test:
             name = test['shortname']
         testnames.append(name)
 
         datarow = [nan] * len(columns)
-        if "metrics" in test:
-            for (metricname, value) in test['metrics'].items():
-                datarow[columnindexes[metricname]] = value
+        for (metricname, value) in test['metrics'].items():
+            datarow[columnindexes[metricname]] = value
         for (name, value) in test.items():
             index = columnindexes.get(name)
             if index is not None:




More information about the llvm-commits mailing list