Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wpt_config_json should read from original config.json #11255

Merged
merged 1 commit into from
Mar 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,16 @@ def doc_root(port_obj):


def wpt_config_json(port_obj):
config_wk_filepath = port_obj._filesystem.join(port_obj.layout_tests_dir(), doc_root(port_obj), "config.json")
if not port_obj.host.filesystem.isfile(config_wk_filepath):
fs = port_obj.host.filesystem
config_wk_filepath = fs.join(port_obj.layout_tests_dir(), "imported", "w3c", "resources", "config.json")
if not fs.isfile(config_wk_filepath):
return
json_data = port_obj._filesystem.read_text_file(config_wk_filepath)
return json.loads(json_data)
config = json.loads(fs.read_text_file(config_wk_filepath))
if port_obj.supports_localhost_aliases and not self._port_obj.get_option('disable_wpt_hostname_aliases'):
config['browser_host'] = 'web-platform.test'
config['alternate_hosts'] = {'alt': 'not-web-platform.test'}
config['ssl']['openssl']['base_path'] = fs.join(port_obj.results_directory(), "_wpt_certs")
return config


def base_http_url(port_obj, localhost_only=False):
Expand Down Expand Up @@ -166,15 +171,8 @@ def _prepare_config(self):
self._wsout = self._filesystem.open_text_file_for_writing(self._output_log_path)

_log.debug('Copying WebKit web platform server config.json')
config_wk_filename = self._filesystem.join(self._layout_root, "imported", "w3c", "resources", "config.json")
if self._filesystem.isfile(config_wk_filename):
config = json.loads(self._filesystem.read_text_file(config_wk_filename))
if self._port_obj.supports_localhost_aliases and not self._port_obj.get_option('disable_wpt_hostname_aliases'):
_log.debug('Using aliases to web-platform.test')
config['browser_host'] = 'web-platform.test'
config['alternate_hosts'] = {'alt': 'not-web-platform.test'}

config['ssl']['openssl']['base_path'] = self._filesystem.join(self._output_dir, "_wpt_certs")
config = wpt_config_json(self._port_obj)
if config:
self._filesystem.write_text_file(self._config_filename, json.dumps(config))

def _spawn_process(self):
Expand Down