Beispiel #1
0
    def _upload_json_files(self):
        if not self._options.test_results_server:
            return

        if not self._options.master_name:
            _log.error("--test-results-server was set, but --master-name was not.  Not uploading JSON files.")
            return

        _log.debug("Uploading JSON files for builder: %s", self._options.builder_name)
        attrs = [("builder", self._options.builder_name),
                 ("testtype", self._options.step_name),
                 ("master", self._options.master_name)]

        files = [(file, self._filesystem.join(self._results_directory, file))
                 for file in ["failing_results.json", "full_results.json", "times_ms.json"]]

        url = "http://%s/testfile/upload" % self._options.test_results_server
        # Set uploading timeout in case appengine server is having problems.
        # 120 seconds are more than enough to upload test results.
        uploader = FileUploader(url, 120)
        try:
            response = uploader.upload_as_multipart_form_data(self._filesystem, files, attrs)
            if response:
                if response.code == 200:
                    _log.debug("JSON uploaded.")
                else:
                    _log.debug("JSON upload failed, %d: '%s'", response.code, response.read())
            else:
                _log.error("JSON upload failed; no response returned")
        except Exception as err:
            _log.error("Upload failed: %s", err)
    def upload_json_files(self, json_files):
        """Uploads the given json_files to the test_results_server (if the
        test_results_server is given)."""
        if not self._test_results_server:
            return

        if not self._master_name:
            _log.error("--test-results-server was set, but --master-name was not.  Not uploading JSON files.")
            return

        _log.info("Uploading JSON files for builder: %s", self._builder_name)
        attrs = [("builder", self._builder_name),
                 ("testtype", self._test_type),
                 ("master", self._master_name)]

        files = [(file, self._filesystem.join(self._results_directory, file))
            for file in json_files]

        url = "http://%s/testfile/upload" % self._test_results_server
        # Set uploading timeout in case appengine server is having problems.
        # 120 seconds are more than enough to upload test results.
        uploader = FileUploader(url, 120)
        try:
            response = uploader.upload_as_multipart_form_data(self._filesystem, files, attrs)
            if response:
                if response.code == 200:
                    _log.info("JSON uploaded.")
                else:
                    _log.debug("JSON upload failed, %d: '%s'" % (response.code, response.read()))
            else:
                _log.error("JSON upload failed; no response returned")
        except Exception, err:
            _log.error("Upload failed: %s" % err)
            return
Beispiel #3
0
    def upload_json_files(self, json_files):
        """Uploads the given json_files to the test_results_server (if the
        test_results_server is given)."""
        if not self._test_results_server:
            return

        if not self._master_name:
            _log.error("--test-results-server was set, but --master-name was not.  Not uploading JSON files.")
            return

        _log.info("Uploading JSON files for builder: %s", self._builder_name)
        attrs = [("builder", self._builder_name),
                 ("testtype", self._test_type),
                 ("master", self._master_name)]

        files = [(file, self._filesystem.join(self._results_directory, file))
            for file in json_files]

        url = "http://%s/testfile/upload" % self._test_results_server
        uploader = FileUploader(url)
        try:
            # Set uploading timeout in case appengine server is having problem.
            # 120 seconds are more than enough to upload test results.
            uploader.upload(attrs, files, 120)
        except Exception, err:
            _log.error("Upload failed: %s" % err)
            return
Beispiel #4
0
    def upload_results(self, results_json_path, start_time, end_time):
        hostname = self._options.results_server_host
        if not hostname:
            return
        master_name = self._options.master_name
        builder_name = self._options.builder_name
        build_number = self._options.build_number
        build_slave = self._options.build_slave
        if not master_name or not builder_name or not build_number or not build_slave:
            _log.error("--results-server-host was set, but --master-name, --builder-name, --build-number, or --build-slave was not. Not uploading JSON files.")
            return

        revisions = {}
        # FIXME: This code is duplicated in PerfTestRunner._generate_results_dict
        for (name, path) in self._port.repository_paths():
            scm = SCMDetector(self._port.host.filesystem, self._port.host.executive).detect_scm_system(path) or self._port.host.scm()
            revision = scm.svn_revision(path)
            revisions[name] = {'revision': revision, 'timestamp': scm.timestamp_of_revision(path, revision)}

        _log.info("Uploading JSON files for master: %s builder: %s build: %s slave: %s to %s", master_name, builder_name, build_number, build_slave, hostname)

        attrs = [
            ('master', 'build.webkit.org' if master_name == 'webkit.org' else master_name),  # FIXME: Pass in build.webkit.org.
            ('builder_name', builder_name),
            ('build_number', build_number),
            ('build_slave', build_slave),
            ('revisions', json.dumps(revisions)),
            ('start_time', str(start_time)),
            ('end_time', str(end_time)),
        ]

        uploader = FileUploader("http://%s/api/report" % hostname, 360)
        try:
            response = uploader.upload_as_multipart_form_data(self._filesystem, [('results.json', results_json_path)], attrs)
            if not response:
                _log.error("JSON upload failed; no response returned")
                return

            if response.code != 200:
                _log.error("JSON upload failed, %d: '%s'" % (response.code, response.read()))
                return

            response_text = response.read()
            try:
                response_json = json.loads(response_text)
            except ValueError, error:
                _log.error("JSON upload failed; failed to parse the response: %s", response_text)
                return

            if response_json['status'] != 'OK':
                _log.error("JSON upload failed, %s: %s", response_json['status'], response_text)
                return

            _log.info("JSON uploaded.")
Beispiel #5
0
    def upload_results(self, results_json_path, start_time, end_time):
        host = self._options.results_server_host
        if not host:
            return
        master_name = self._options.master_name
        builder_name = self._options.builder_name
        build_number = self._options.build_number
        build_slave = self._options.build_slave
        got_revision = self._options.got_revision
        if not master_name or not builder_name or not build_number or not build_slave or not got_revision:
            _log.error("--results-dashboard-host was set, but --master-name, --builder-name, --build-number, --build-slave, or --got-revision was not. Not uploading JSON files.")
            return

        _log.info("Uploading JSON files for master: %s builder: %s build: %s slave: %s to %s", master_name, builder_name, build_number, build_slave, host)

        attrs = [
            ('master', master_name),
            ('builder_name', builder_name),
            ('build_number', build_number),
            ('build_slave', build_slave),
            ('revision', got_revision),
            ('start_time', str(start_time)),
            ('end_time', str(end_time)),
        ]

        uploader = FileUploader("http://%s/api/report" % host, 360)
        try:
            response = uploader.upload_as_multipart_form_data(self._filesystem, [('results.json', results_json_path)], attrs)
            if not response:
                _log.error("JSON upload failed; no response returned")
                return

            if response.code != 200:
                _log.error("JSON upload failed, %d: '%s'" % (response.code, response.read()))
                return

            response_text = response.read()
            try:
                response_json = json.loads(response_text)
            except ValueError, error:
                _log.error("JSON upload failed; failed to parse the response: %s", response_text)
                return

            if response_json['status'] != 'OK':
                _log.error("JSON upload failed, %s: %s", response_json['status'], response_text)
                return

            _log.info("JSON uploaded.")
Beispiel #6
0
    def _upload_json_files(self):
        if not self._options.test_results_server:
            return

        if not self._options.master_name:
            _log.error(
                '--test-results-server was set, but --master-name was not.  Not uploading JSON files.'
            )
            return

        _log.debug('Uploading JSON files for builder: %s',
                   self._options.builder_name)
        attrs = [('builder', self._options.builder_name),
                 ('testtype', self._options.step_name),
                 ('master', self._options.master_name)]

        files = [
            (name, self._filesystem.join(self._results_directory, name))
            for name in
            ['failing_results.json', 'full_results.json', 'times_ms.json']
        ]

        url = 'https://%s/testfile/upload' % self._options.test_results_server
        # Set uploading timeout in case appengine server is having problems.
        # 120 seconds are more than enough to upload test results.
        uploader = FileUploader(url, 120)
        try:
            response = uploader.upload_as_multipart_form_data(
                self._filesystem, files, attrs)
            if response:
                if response.code == 200:
                    _log.debug('JSON uploaded.')
                else:
                    _log.debug('JSON upload failed, %d: "%s"', response.code,
                               response.read())
            else:
                _log.error('JSON upload failed; no response returned')
        except IOError as err:
            _log.error('Upload failed: %s', err)
Beispiel #7
0
    def _upload_json_files(self):
        if not self._options.test_results_server:
            return

        if not self._options.master_name:
            _log.error(
                "--test-results-server was set, but --master-name was not.  Not uploading JSON files."
            )
            return

        _log.debug("Uploading JSON files for builder: %s",
                   self._options.builder_name)
        attrs = [("builder", self._options.builder_name),
                 ("testtype", self._options.step_name),
                 ("master", self._options.master_name)]

        files = [
            (file, self._filesystem.join(self._results_directory, file))
            for file in
            ["failing_results.json", "full_results.json", "times_ms.json"]
        ]

        url = "https://%s/testfile/upload" % self._options.test_results_server
        # Set uploading timeout in case appengine server is having problems.
        # 120 seconds are more than enough to upload test results.
        uploader = FileUploader(url, 120)
        try:
            response = uploader.upload_as_multipart_form_data(
                self._filesystem, files, attrs)
            if response:
                if response.code == 200:
                    _log.debug("JSON uploaded.")
                else:
                    _log.debug("JSON upload failed, %d: '%s'", response.code,
                               response.read())
            else:
                _log.error("JSON upload failed; no response returned")
        except Exception as err:
            _log.error("Upload failed: %s", err)
Beispiel #8
0
    def upload_json_files(self, json_files):
        """Uploads the given json_files to the test_results_server (if the
        test_results_server is given)."""
        if not self._test_results_servers:
            return

        if not self._master_name:
            _log.error(
                "--test-results-server was set, but --master-name was not.  Not uploading JSON files."
            )
            return

        _log.info("Uploading JSON files for builder: %s", self._builder_name)
        attrs = [("builder", self._builder_name),
                 ("testtype", self._test_type), ("master", self._master_name)]

        files = [(file, self._filesystem.join(self._results_directory, file))
                 for file in json_files]

        for test_results_server in self._test_results_servers:
            url = "http://%s/testfile/upload" % test_results_server
            # Set uploading timeout in case appengine server is having problems.
            # 120 seconds are more than enough to upload test results.
            uploader = FileUploader(url, 120)
            try:
                response = uploader.upload_as_multipart_form_data(
                    self._filesystem, files, attrs)
                if response:
                    if response.code == 200:
                        _log.info("JSON uploaded.")
                    else:
                        _log.debug("JSON upload failed, %d: '%s'" %
                                   (response.code, response.read()))
                else:
                    _log.error("JSON upload failed; no response returned")
            except Exception as err:
                _log.error("Upload failed: %s" % err)
                continue
Beispiel #9
0
    def upload_results(self, results_json_path, start_time, end_time):
        hostname = self._options.results_server_host
        if not hostname:
            return
        master_name = self._options.master_name
        builder_name = self._options.builder_name
        build_number = self._options.build_number
        build_slave = self._options.build_slave
        if not master_name or not builder_name or not build_number or not build_slave:
            _log.error(
                "--results-server-host was set, but --master-name, --builder-name, --build-number, or --build-slave was not. Not uploading JSON files."
            )
            return

        revisions = {}
        # FIXME: This code is duplicated in PerfTestRunner._generate_results_dict
        for (name, path) in self._port.repository_paths():
            scm = SCMDetector(self._port.host.filesystem,
                              self._port.host.executive).detect_scm_system(
                                  path) or self._port.host.scm()
            revision = scm.svn_revision(path)
            revisions[name] = {
                'revision': revision,
                'timestamp': scm.timestamp_of_revision(path, revision)
            }

        _log.info(
            "Uploading JSON files for master: %s builder: %s build: %s slave: %s to %s",
            master_name, builder_name, build_number, build_slave, hostname)

        attrs = [
            ('master', 'build.webkit.org' if master_name == 'webkit.org' else
             master_name),  # FIXME: Pass in build.webkit.org.
            ('builder_name', builder_name),
            ('build_number', build_number),
            ('build_slave', build_slave),
            ('revisions', json.dumps(revisions)),
            ('start_time', str(start_time)),
            ('end_time', str(end_time)),
        ]

        uploader = FileUploader("http://%s/api/report" % hostname, 360)
        try:
            response = uploader.upload_as_multipart_form_data(
                self._filesystem, [('results.json', results_json_path)], attrs)
            if not response:
                _log.error("JSON upload failed; no response returned")
                return

            if response.code != 200:
                _log.error("JSON upload failed, %d: '%s'" %
                           (response.code, response.read()))
                return

            response_text = response.read()
            try:
                response_json = json.loads(response_text)
            except ValueError, error:
                _log.error(
                    "JSON upload failed; failed to parse the response: %s",
                    response_text)
                return

            if response_json['status'] != 'OK':
                _log.error("JSON upload failed, %s: %s",
                           response_json['status'], response_text)
                return

            _log.info("JSON uploaded.")