Bug 1220327 - properly handle invalid json error r?jmaher; try: -b o -p win32 -u none -t xperf-e10s draft handle_err_properly
authorIonut Goldan <ionut.goldan@softvision.ro>
Mon, 19 Jun 2017 16:46:13 +0300
changeset 597294 81746436ecd1993417335ece9e2a95bb62383329
parent 596633 e9683155991f5c099075da2413c360e95681fc6b
child 634200 180bbca3ec5d2904f6a9dbbf34159e9d019a6875
push id64898
push userbmo:ionut.goldan@softvision.ro
push dateTue, 20 Jun 2017 11:06:10 +0000
reviewersjmaher, try
bugs1220327
milestone56.0a1
Bug 1220327 - properly handle invalid json error r?jmaher; try: -b o -p win32 -u none -t xperf-e10s MozReview-Commit-ID: Ho0dcBhbnLM
testing/talos/talos/xtalos/etlparser.py
--- a/testing/talos/talos/xtalos/etlparser.py
+++ b/testing/talos/talos/xtalos/etlparser.py
@@ -370,18 +370,27 @@ def etlparser(xperf_path, etl_filename, 
         filename = os.path.join(dirname, 'xperf_whitelist.json')
     elif os.path.exists(os.path.join(dirname, 'xtalos')) and \
             os.path.exists(os.path.join(dirname, 'xtalos',
                                         'xperf_whitelist.json')):
         filename = os.path.join(dirname, 'xtalos', 'xperf_whitelist.json')
 
     wl_temp = {}
     if filename:
-        with open(filename, 'r') as fHandle:
-            wl_temp = json.load(fHandle)
+        try:
+            with open(filename, 'r') as fHandle:
+                wl_temp = json.load(fHandle)
+        except ValueError:
+            # upload erroneous file for investigation
+            mud = os.environ.get('MOZ_UPLOAD_DIR', None)
+            if mud:
+                invalid_mud_file = os.path.join(mud, filename)
+                shutil.copyfile(filename, invalid_mud_file)
+
+            raise xtalos.XTalosError('Invalid JSON syntax on xperf whitelist')
 
     # Approot is the full path where the application is located at
     # We depend on it for dependentlibs.list to ignore files required for
     # normal startup.
     if approot:
         if os.path.exists('%s\\dependentlibs.list' % approot):
             with open('%s\\dependentlibs.list' % approot, 'r') as fhandle:
                 libs = fhandle.readlines()