From e9c99dfaf4175ad8e5aa4da9a3db77bab900ae55 Mon Sep 17 00:00:00 2001 From: Rob Wood Date: Fri, 8 Feb 2019 21:33:35 +0000 Subject: [PATCH] Bug 1520592 - Enable screen captures on pageload timeouts; r=davehunt Differential Revision: https://phabricator.services.mozilla.com/D18878 --HG-- extra : moz-landing-system : lando --- testing/raptor/raptor/output.py | 20 ++++++++++++-------- testing/raptor/webext/raptor/runner.js | 6 +++++- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/testing/raptor/raptor/output.py b/testing/raptor/raptor/output.py index c3ce389afbdd..09f9e4f1ed82 100644 --- a/testing/raptor/raptor/output.py +++ b/testing/raptor/raptor/output.py @@ -606,11 +606,6 @@ class Output(object): def output(self, test_names): """output to file and perfherder data json """ - if self.summarized_results == {}: - LOG.error("error: no summarized raptor results found for %s" % - ', '.join(test_names)) - return False - if os.environ['MOZ_UPLOAD_DIR']: # i.e. testing/mozharness/build/raptor.json locally; in production it will # be at /tasks/task_*/build/ (where it will be picked up by mozharness later @@ -623,9 +618,13 @@ class Output(object): results_path = os.path.join(os.getcwd(), 'raptor.json') screenshot_path = os.path.join(os.getcwd(), 'screenshots.html') - with open(results_path, 'w') as f: - for result in self.summarized_results: - f.write("%s\n" % result) + if self.summarized_results == {}: + LOG.error("error: no summarized raptor results found for %s" % + ', '.join(test_names)) + else: + with open(results_path, 'w') as f: + for result in self.summarized_results: + f.write("%s\n" % result) if len(self.summarized_screenshots) > 0: with open(screenshot_path, 'w') as f: @@ -633,6 +632,11 @@ class Output(object): f.write("%s\n" % result) LOG.info("screen captures can be found locally at: %s" % screenshot_path) + # now that we've checked for screen captures too, if there were no actual + # test results we can bail out here + if self.summarized_results == {}: + return False + # when gecko_profiling, we don't want results ingested by Perfherder extra_opts = self.summarized_results['suites'][0].get('extraOptions', []) if 'gecko_profile' not in extra_opts: diff --git a/testing/raptor/webext/raptor/runner.js b/testing/raptor/webext/raptor/runner.js index e6cf83f6c86c..ef82014561ff 100644 --- a/testing/raptor/webext/raptor/runner.js +++ b/testing/raptor/webext/raptor/runner.js @@ -396,9 +396,13 @@ async function nextCycle() { } } -function timeoutAlarmListener() { +async function timeoutAlarmListener() { console.error("raptor-page-timeout on %s" % testURL); postToControlServer("raptor-page-timeout", [testName, testURL]); + // take a screen capture + if (screenCapture) { + await getScreenCapture(); + } // call clean-up to shutdown gracefully cleanUp(); }