From 1f1ca91d06821cb5dd2fe057d4efa4fc572ee158 Mon Sep 17 00:00:00 2001 From: kyle Ju Date: Wed, 12 May 2021 18:45:32 +0000 Subject: [PATCH] Pass server config via a file. This change unblocks importer, where webdriver tests are failing due to changes in https://github.com/web-platform-tests/wpt/pull/28834 Change-Id: Ia07ed877aa808da41a49260900a390c87e9c5521 No-Export: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2890259 Reviewed-by: Jason Chase Reviewed-by: John Chen Commit-Queue: Kyle Ju Cr-Commit-Position: refs/heads/master@{#882198} --- chrome/test/chromedriver/test/run_webdriver_tests.py | 9 +++++++-- .../external/wpt/webdriver/tests/support/fixtures.py | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/chrome/test/chromedriver/test/run_webdriver_tests.py b/chrome/test/chromedriver/test/run_webdriver_tests.py index d09feabdae2284..01223326aed3e6 100644 --- a/chrome/test/chromedriver/test/run_webdriver_tests.py +++ b/chrome/test/chromedriver/test/run_webdriver_tests.py @@ -194,11 +194,13 @@ def set_up_config(path_finder, chromedriver_server): } }) + config_path = os.path.join(tempfile.mkdtemp(), "wd_server_config.json") + os.environ["WD_SERVER_CONFIG_FILE"] = config_path # Port numbers are defined at # https://cs.chromium.org/chromium/src/third_party/blink/tools # /blinkpy/web_tests/servers/wptserve.py?l=23&rcl=375b34c6ba64 # 5d00c1413e4c6106c7bb74581c85 - os.environ["WD_SERVER_CONFIG"] = json.dumps({ + config_dict = { "doc_root": path_finder.path_from_chromium_base(CHROMIUM_WPT_DIR), "browser_host": "web-platform.test", "domains": {"": {"": "web-platform.test", @@ -206,7 +208,10 @@ def set_up_config(path_finder, chromedriver_server): "www.www": "www.www.web-platform.test", "www1": "www1.web-platform.test", "www2": "www2.web-platform.test"}}, - "ports": {"ws": [9001], "wss": [9444], "http": [8001], "https": [8444]}}) + "ports": {"ws": [9001], "wss": [9444], "http": [8001], "https": [8444]}} + with open(config_path, "w") as f: + json.dump(config_dict, f) + def run_test(path, path_finder, port, skipped_tests=[]): abs_path = os.path.abspath(path) diff --git a/third_party/blink/web_tests/external/wpt/webdriver/tests/support/fixtures.py b/third_party/blink/web_tests/external/wpt/webdriver/tests/support/fixtures.py index 7ad619ac96393b..5440dd5adbde04 100644 --- a/third_party/blink/web_tests/external/wpt/webdriver/tests/support/fixtures.py +++ b/third_party/blink/web_tests/external/wpt/webdriver/tests/support/fixtures.py @@ -105,8 +105,8 @@ def http(configuration): @pytest.fixture def server_config(): - return json.loads(os.environ.get("WD_SERVER_CONFIG")) - + with open(os.environ.get("WD_SERVER_CONFIG_FILE"), "r") as f: + return json.load(f) @pytest.fixture(scope="session") def configuration():