Example #1
0
    def _upload_json_files(self, unexpected_results, result_summary, individual_test_timings):
        """Writes the results of the test run as JSON files into the results
        dir and upload the files to the appengine server.

        There are three different files written into the results dir:
          unexpected_results.json: A short list of any unexpected results.
            This is used by the buildbots to display results.
          expectations.json: This is used by the flakiness dashboard.
          results.json: A full list of the results - used by the flakiness
            dashboard and the aggregate results dashboard.

        Args:
          unexpected_results: dict of unexpected results
          result_summary: full summary object
          individual_test_timings: list of test times (used by the flakiness
            dashboard).
        """
        results_directory = self._options.results_directory
        _log.debug("Writing JSON files in %s." % results_directory)
        unexpected_json_path = self._fs.join(results_directory, "unexpected_results.json")
        with self._fs.open_text_file_for_writing(unexpected_json_path) as file:
            simplejson.dump(unexpected_results, file, sort_keys=True, indent=2)

        # Write a json file of the test_expectations.txt file for the layout
        # tests dashboard.
        expectations_path = self._fs.join(results_directory, "expectations.json")
        expectations_json = self._expectations.get_expectations_json_for_all_platforms()
        self._fs.write_text_file(expectations_path, u"ADD_EXPECTATIONS(%s);" % expectations_json)

        generator = json_layout_results_generator.JSONLayoutResultsGenerator(
            self._port,
            self._options.builder_name,
            self._options.build_name,
            self._options.build_number,
            self._options.results_directory,
            BUILDER_BASE_URL,
            individual_test_timings,
            self._expectations,
            result_summary,
            self._test_files_list,
            not self._options.upload_full_results,
            self._options.test_results_server,
            "layout-tests",
            self._options.master_name,
        )

        _log.debug("Finished writing JSON files.")

        json_files = ["expectations.json"]
        if self._options.upload_full_results:
            json_files.append("results.json")
        else:
            json_files.append("incremental_results.json")

        generator.upload_json_files(json_files)
Example #2
0
 def _serve_json(self, json):
     self.send_response(200)
     self.send_header('Content-type', 'application/json')
     self.end_headers()
     simplejson.dump(json, self.wfile)
Example #3
0
 def _serve_json(self, json):
     self.send_response(200)
     self.send_header('Content-type', 'application/json')
     self.end_headers()
     simplejson.dump(json, self.wfile)