diff --git a/testing/awsy/awsy/awsy_test_case.py b/testing/awsy/awsy/awsy_test_case.py index b0de7a7c6bc9..73a317f7793c 100644 --- a/testing/awsy/awsy/awsy_test_case.py +++ b/testing/awsy/awsy/awsy_test_case.py @@ -80,26 +80,31 @@ class AwsyTestCase(MarionetteTestCase): def tearDown(self): MarionetteTestCase.tearDown(self) - self.logger.info("processing data in %s!" % self._resultsDir) - perf_blob = process_perf_data.create_perf_data( - self._resultsDir, self.perf_suites(), - self.perf_checkpoints()) - self.logger.info("PERFHERDER_DATA: %s" % json.dumps(perf_blob)) + try: + self.logger.info("processing data in %s!" % self._resultsDir) + perf_blob = process_perf_data.create_perf_data( + self._resultsDir, self.perf_suites(), + self.perf_checkpoints()) + self.logger.info("PERFHERDER_DATA: %s" % json.dumps(perf_blob)) - perf_file = os.path.join(self._resultsDir, "perfherder_data.json") - with open(perf_file, 'w') as fp: - json.dump(perf_blob, fp, indent=2) - self.logger.info("Perfherder data written to %s" % perf_file) + perf_file = os.path.join(self._resultsDir, "perfherder_data.json") + with open(perf_file, 'w') as fp: + json.dump(perf_blob, fp, indent=2) + self.logger.info("Perfherder data written to %s" % perf_file) + except: + raise + finally: + # Make sure we cleanup and upload any existing files even if there + # were errors processing the perf data. + if self._dmd: + self.cleanup_dmd() - if self._dmd: - self.cleanup_dmd() - - # copy it to moz upload dir if set - if 'MOZ_UPLOAD_DIR' in os.environ: - for file in os.listdir(self._resultsDir): - file = os.path.join(self._resultsDir, file) - if os.path.isfile(file): - shutil.copy2(file, os.environ["MOZ_UPLOAD_DIR"]) + # copy it to moz upload dir if set + if 'MOZ_UPLOAD_DIR' in os.environ: + for file in os.listdir(self._resultsDir): + file = os.path.join(self._resultsDir, file) + if os.path.isfile(file): + shutil.copy2(file, os.environ["MOZ_UPLOAD_DIR"]) def cleanup_dmd(self): """