Ejemplo n.º 1
0
    def submit(self, report_path, config, ts_name=None):
        """Submit the results file to the server.  If no server
        was specified, use a local mock server.

        report_path is the location of the json report file.  config
        holds options for submission url, and verbosity.

        Returns the report from the server.
        """
        assert os.path.exists(report_path), "Failed report should have" \
            " never gotten here!"
        assert ts_name is not None

        server_report = None
        if config.submit_url is not None:
            self.log("submitting result to %r" % (config.submit_url, ))
            server_report = ServerUtil.submitFile(
                config.submit_url,
                report_path,
                config.verbose,
                select_machine=config.select_machine,
                merge_run=config.merge)
        else:
            server_report = ImportData.no_submit()
        if server_report:
            ImportData.print_report_result(server_report, sys.stdout,
                                           sys.stderr, config.verbose)
        return server_report
Ejemplo n.º 2
0
def action_submit(name, args):
    """submit a test report to the server"""

    parser = OptionParser("%s [options] <url> <file>+" % name)
    parser.add_option("",
                      "--commit",
                      dest="commit",
                      type=int,
                      help=("whether the result should be committed "
                            "[%default]"),
                      default=True)
    parser.add_option("-v",
                      "--verbose",
                      dest="verbose",
                      help="show verbose test results",
                      action="store_true",
                      default=False)

    (opts, args) = parser.parse_args(args)
    if len(args) < 2:
        parser.error("incorrect number of argments")

    if not opts.commit:
        warning("submit called with --commit=0, your results will not be saved"
                " at the server.")

    from lnt.util import ServerUtil
    files = ServerUtil.submitFiles(args[0], args[1:], opts.commit,
                                   opts.verbose)
    if opts.verbose:
        for f in files:
            lnt.util.ImportData.print_report_result(f, sys.stdout, sys.stderr,
                                                    True)
Ejemplo n.º 3
0
    def submit(self, report_path, config, ts_name=None):
        """Submit the results file to the server.  If no server
        was specified, use a local mock server.

        report_path is the location of the json report file.  config
        holds options for submission url, and verbosity.

        Returns the report from the server.
        """
        assert os.path.exists(report_path), "Failed report should have" \
            " never gotten here!"
        assert ts_name is not None

        server_report = None
        if config.submit_url is not None:
            self.log("submitting result to %r" % (config.submit_url,))
            server_report = ServerUtil.submitFile(
                config.submit_url, report_path, config.verbose,
                select_machine=config.select_machine, merge_run=config.merge)
        else:
            server_report = ImportData.no_submit()
        if server_report:
            ImportData.print_report_result(server_report, sys.stdout,
                                           sys.stderr, config.verbose)
        return server_report
Ejemplo n.º 4
0
    def submit_helper(self, parsed_args):
        """Submit the report to the server.  If no server
        was specified, use a local mock server.
        """

        result = None
        if parsed_args.submit_url:
            from lnt.util import ServerUtil
            for server in parsed_args.submit_url:
                self.log("submitting result to %r" % (server,))
                try:
                    result = ServerUtil.submitFile(
                        server, parsed_args.report_path, parsed_args.commit,
                        parsed_args.verbose)
                except (urllib2.HTTPError, urllib2.URLError) as e:
                    warning("submitting to {} failed with {}".format(server,
                                                                     e))
        else:
            # Simulate a submission to retrieve the results report.
            # Construct a temporary database and import the result.
            self.log("submitting result to dummy instance")

            import lnt.server.db.v4db
            import lnt.server.config
            db = lnt.server.db.v4db.V4DB("sqlite:///:memory:",
                                         lnt.server.config.Config.dummyInstance())
            result = lnt.util.ImportData.import_and_report(
                None, None, db, parsed_args.report_path, 'json', True)

        if result is None:
            fatal("results were not obtained from submission.")

        return result
Ejemplo n.º 5
0
Archivo: main.py Proyecto: efcs/lnt
def action_submit(name, args):
    """submit a test report to the server"""

    parser = OptionParser("%s [options] <url> <file>+" % name)
    parser.add_option("", "--commit", dest="commit", type=int,
                      help=("whether the result should be committed "
                            "[%default]"),
                      default=True)
    parser.add_option("-v", "--verbose", dest="verbose",
                      help="show verbose test results",
                      action="store_true", default=False)

    (opts, args) = parser.parse_args(args)
    if len(args) < 2:
        parser.error("incorrect number of argments")

    if not opts.commit:
        warning("submit called with --commit=0, your results will not be saved"
                " at the server.")

    from lnt.util import ServerUtil
    files = ServerUtil.submitFiles(args[0], args[1:],
                                   opts.commit, opts.verbose)
    if opts.verbose:
        for f in files:
            lnt.util.ImportData.print_report_result(f, sys.stdout,
                                                    sys.stderr, True)
Ejemplo n.º 6
0
    def submit_helper(self, parsed_args):
        """Submit the report to the server.  If no server
        was specified, use a local mock server.
        """

        result = None
        if parsed_args.submit_url:
            from lnt.util import ServerUtil
            for server in parsed_args.submit_url:
                self.log("submitting result to %r" % (server, ))
                try:
                    result = ServerUtil.submitFile(server,
                                                   parsed_args.report_path,
                                                   parsed_args.commit,
                                                   parsed_args.verbose)
                except (urllib2.HTTPError, urllib2.URLError) as e:
                    warning("submitting to {} failed with {}".format(
                        server, e))
        else:
            # Simulate a submission to retrieve the results report.
            # Construct a temporary database and import the result.
            self.log("submitting result to dummy instance")

            import lnt.server.db.v4db
            import lnt.server.config
            db = lnt.server.db.v4db.V4DB(
                "sqlite:///:memory:", lnt.server.config.Config.dummyInstance())
            result = lnt.util.ImportData.import_and_report(
                None, None, db, parsed_args.report_path, 'json', True)

        if result is None:
            fatal("results were not obtained from submission.")

        return result
Ejemplo n.º 7
0
def action_submit(url, files, select_machine, merge, verbose):
    """submit a test report to the server"""
    from lnt.util import ServerUtil
    import lnt.util.ImportData

    results = ServerUtil.submitFiles(url, files, verbose,
                                     select_machine=select_machine,
                                     merge_run=merge)
    for submitted_file in results:
        if verbose:
            lnt.util.ImportData.print_report_result(
                submitted_file, sys.stdout, sys.stderr, True)
        _print_result_url(submitted_file, verbose)
    if len(files) != len(results):
        sys.exit(1)
Ejemplo n.º 8
0
def action_submit(url, files, select_machine, merge, verbose):
    """submit a test report to the server"""
    from lnt.util import ServerUtil
    import lnt.util.ImportData

    results = ServerUtil.submitFiles(url,
                                     files,
                                     verbose,
                                     select_machine=select_machine,
                                     merge_run=merge)
    for submitted_file in results:
        if verbose:
            lnt.util.ImportData.print_report_result(submitted_file, sys.stdout,
                                                    sys.stderr, True)
        _print_result_url(submitted_file, verbose)
    if len(files) != len(results):
        sys.exit(1)
Ejemplo n.º 9
0
    def submit(self, report_path, config, commit=True):
        """Submit the results file to the server.  If no server
        was specified, use a local mock server.

        report_path is the location of the json report file.  config
        holds options for submission url, and verbosity.  When commit
        is true, results will be saved in the server, otherwise you
        will just get back a report but server state is not altered.

        Returns the report from the server.
        """
        assert os.path.exists(report_path), "Failed report should have" \
            " never gotten here!"

        server_report = None
        if config.submit_url is not None:
            self.log("submitting result to %r" % (config.submit_url,))
            server_report = ServerUtil.submitFile(config.submit_url,
                                                  report_path,
                                                  commit,
                                                  config.verbose)
        else:
            # Simulate a submission to retrieve the results report.

            # Construct a temporary database and import the result.
            self.log("submitting result to dummy instance")

            db = lnt.server.db.v4db.V4DB("sqlite:///:memory:",
                                         server_config.Config.dummyInstance())
            server_report = ImportData.import_and_report(
                None, None, db, report_path, 'json', commit)

        assert server_report is not None, "Results were not submitted."

        ImportData.print_report_result(server_report, sys.stdout, sys.stderr,
                                       config.verbose)
        return server_report
Ejemplo n.º 10
0
    def submit(self, report_path, config, commit=True):
        """Submit the results file to the server.  If no server
        was specified, use a local mock server.

        report_path is the location of the json report file.  config
        holds options for submission url, and verbosity.  When commit
        is true, results will be saved in the server, otherwise you
        will just get back a report but server state is not altered.

        Returns the report from the server.
        """
        assert os.path.exists(report_path), "Failed report should have" \
            " never gotten here!"

        server_report = None
        if config.submit_url is not None:
            self.log("submitting result to %r" % (config.submit_url, ))
            server_report = ServerUtil.submitFile(config.submit_url,
                                                  report_path, commit,
                                                  config.verbose)
        else:
            # Simulate a submission to retrieve the results report.

            # Construct a temporary database and import the result.
            self.log("submitting result to dummy instance")

            db = lnt.server.db.v4db.V4DB("sqlite:///:memory:",
                                         server_config.Config.dummy_instance())
            server_report = ImportData.import_and_report(
                None, None, db, report_path, 'json', commit)

        assert server_report is not None, "Results were not submitted."

        ImportData.print_report_result(server_report, sys.stdout, sys.stderr,
                                       config.verbose)
        return server_report