From 3497d554d111353229caedfd648a9e0aab861a8e Mon Sep 17 00:00:00 2001 From: "alexandru.ionescu" Date: Tue, 12 May 2020 12:25:27 +0000 Subject: [PATCH] Bug 1614805 Part 2: modify the re.match expression to cover the empty event r=perftest-reviewers,sparky Differential Revision: https://phabricator.services.mozilla.com/D73608 --- testing/talos/talos/results.py | 14 ++++++-------- testing/talos/talos/xtalos/etlparser.py | 11 +++++++---- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/testing/talos/talos/results.py b/testing/talos/talos/results.py index c5b649e3a78a..df44c12bfc29 100755 --- a/testing/talos/talos/results.py +++ b/testing/talos/talos/results.py @@ -434,16 +434,15 @@ class BrowserLogResults(object): self.mainthread_io(counter_results) - if not set(counters).union(set(mainthread_counters))\ + if not set(counters).union(set(mainthread_counters)) \ .intersection(counter_results.keys()): # no xperf counters to accumulate return filename = 'etl_output_thread_stats.csv' if not os.path.exists(filename): - print("Warning: we are looking for xperf results file %s, and" - " didn't find it" % filename) - return + raise utils.TalosError("Error: we are looking for xperf results file %s," + " and didn't find it" % filename) contents = open(filename).read() lines = contents.splitlines() @@ -473,9 +472,8 @@ class BrowserLogResults(object): if (set(mainthread_counters).intersection(counter_results.keys())): filename = 'etl_output.csv' if not os.path.exists(filename): - print("Warning: we are looking for xperf results file" - " %s, and didn't find it" % filename) - return + raise utils.TalosError("Error: we are looking for xperf results file" + " %s, and didn't find it" % filename) contents = open(filename).read() lines = contents.splitlines() @@ -491,7 +489,7 @@ class BrowserLogResults(object): values = dict(zip(header, row)) for i, mainthread_counter in enumerate(mainthread_counters): if int(values[mainthread_counter_keys[i]]) > 0: - counter_results.setdefault(mainthread_counter, [])\ + counter_results.setdefault(mainthread_counter, []) \ .append([int(values[mainthread_counter_keys[i]]), values['filename']]) diff --git a/testing/talos/talos/xtalos/etlparser.py b/testing/talos/talos/xtalos/etlparser.py index 522a6c5e2e1c..ea7ab8776eda 100644 --- a/testing/talos/talos/xtalos/etlparser.py +++ b/testing/talos/talos/xtalos/etlparser.py @@ -258,10 +258,13 @@ def trackThreadNetIO(row, io, stage): gConnectionIDs[connID] = tid origThread = gConnectionIDs[connID] if origThread in gThreads: - try: - netEvt = re.match("[\w-]+\/([\w-]+)", event).group(1) - except AttributeError as e: - print("Error matching event {}: {}".format(event, str(e))) + match = re.match("[\w-]+\/([\w-]+)?", event) + if not match: + raise xtalos.XTalosError( + "Could not find a regular expression match for event: {}" + .format(event) + ) + netEvt = match.group(1) if netEvt in net_events: opType = net_events[netEvt]