def execute(self, options, args, tool):
        results_directory = args[0]
        filesystem = system.filesystem.FileSystem()

        print 'Parsing unexpected_results.json...'
        results_json_path = filesystem.join(
            results_directory, 'unexpected_results.json')
        with codecs.open(results_json_path, "r") as results_json_file:
            results_json_file = file(results_json_path)
            results_json = simplejson.load(results_json_file)

        port = factory.get()
        layout_tests_directory = port.layout_tests_dir()
        platforms = filesystem.listdir(
            filesystem.join(layout_tests_directory, 'platform'))

        print 'Gathering current baselines...'
        for test_file, test_json in results_json['tests'].items():
            test_json['state'] = STATE_NEEDS_REBASELINE
            test_json['baselines'] = _get_test_baselines(
                test_file, layout_tests_directory, platforms, filesystem)

        print "Starting server at http://localhost:%d/" % options.httpd_port
        print ("Use the 'Exit' link in the UI, http://localhost:%d/"
            "quitquitquit or Ctrl-C to stop") % options.httpd_port

        httpd = RebaselineHTTPServer(
            httpd_port=options.httpd_port,
            results_directory=results_directory,
            results_json=results_json,
            platforms_json={
                'platforms': platforms,
                'defaultPlatform': port.name(),
            })
        httpd.serve_forever()
    def execute(self, options, args, tool):
        results_directory = args[0]
        filesystem = system.filesystem.FileSystem()
        scm = self._tool.scm()

        if options.dry_run:

            def no_op_copyfile(src, dest):
                pass

            def no_op_add(path, return_exit_code=False):
                if return_exit_code:
                    return 0

            filesystem.copyfile = no_op_copyfile
            scm.add = no_op_add

        print 'Parsing unexpected_results.json...'
        results_json_path = filesystem.join(
            results_directory, 'unexpected_results.json')
        with codecs.open(results_json_path, "r") as results_json_file:
            results_json_file = file(results_json_path)
            results_json = simplejson.load(results_json_file)

        port = factory.get()
        layout_tests_directory = port.layout_tests_dir()
        platforms = filesystem.listdir(
            filesystem.join(layout_tests_directory, 'platform'))
        test_config = TestConfig(
            port,
            layout_tests_directory,
            results_directory,
            platforms,
            filesystem,
            scm)

        print 'Gathering current baselines...'
        for test_file, test_json in results_json['tests'].items():
            test_json['state'] = STATE_NEEDS_REBASELINE
            test_path = filesystem.join(layout_tests_directory, test_file)
            test_json['baselines'] = _get_test_baselines(test_file, test_config)

        server_url = "http://localhost:%d/" % options.httpd_port
        print "Starting server at %s" % server_url
        print ("Use the 'Exit' link in the UI, %squitquitquit "
            "or Ctrl-C to stop") % server_url

        threading.Timer(
            .1, lambda: self._tool.user.open_url(server_url)).start()

        httpd = RebaselineHTTPServer(
            httpd_port=options.httpd_port,
            test_config=test_config,
            results_json=results_json,
            platforms_json={
                'platforms': platforms,
                'defaultPlatform': port.name(),
            })
        httpd.serve_forever()
Exemple #3
0
def _gather_unexpected_results(options):
    """Returns the unexpected results from the previous run, if any."""
    last_unexpected_results = []
    if options.print_last_failures or options.retest_last_failures:
        unexpected_results_filename = os.path.join(options.results_directory, "unexpected_results.json")
        with codecs.open(unexpected_results_filename, "r", "utf-8") as file:
            results = simplejson.load(file)
        last_unexpected_results = results["tests"].keys()
    return last_unexpected_results
Exemple #4
0
def main():
    logging.basicConfig(level=logging.INFO, format='%(message)s')

    if len(sys.argv) != 2:
        usage()
        sys.exit(1)
    updates = simplejson.load(open(sys.argv[1]))

    port_obj = get_port()
    path_to_expectations = port_obj.path_to_test_expectations_file()

    old_expectations = open(path_to_expectations).read()
    new_expectations = update_expectations(port_obj, old_expectations, updates)
    open(path_to_expectations, 'w').write(new_expectations)
Exemple #5
0
def main():
    logging.basicConfig(level=logging.INFO,
        format='%(message)s')

    if len(sys.argv) != 2:
        usage()
        sys.exit(1)
    updates = simplejson.load(open(sys.argv[1]))

    port_obj = get_port()
    path_to_expectations = port_obj.path_to_test_expectations_file()

    old_expectations = open(path_to_expectations).read()
    new_expectations = update_expectations(port_obj, old_expectations, updates)
    open(path_to_expectations, 'w').write(new_expectations)