Bug 1220327 - properly handle invalid json error r?jmaher; try: -b o -p win32 -u none -t xperf-e10s
MozReview-Commit-ID: Ho0dcBhbnLM
--- 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()