Commit 003a5326 authored by Robert Ma's avatar Robert Ma Committed by Commit Bot

Add missing fields to WD_SERVER_CONFIG in WebDriver tests

Namely, `doc_root` and `domains` (the latter was added in
https://github.com/web-platform-tests/wpt/pull/17141)

Also a drive-by fix to improve test discovery (only run .py files).

Bug: 974877
Change-Id: Idb917ee0dcab9691709e3d99e3f29ceec82edeb2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1664042Reviewed-by: default avatarJohn Chen <johnchen@chromium.org>
Commit-Queue: Robert Ma <robertma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#670227}
parent 02dcd97c
...@@ -33,9 +33,10 @@ BLINK_TOOLS_ABS_PATH = os.path.join(SRC_DIR, BLINK_TOOLS_PATH) ...@@ -33,9 +33,10 @@ BLINK_TOOLS_ABS_PATH = os.path.join(SRC_DIR, BLINK_TOOLS_PATH)
sys.path.insert(0, BLINK_TOOLS_ABS_PATH) sys.path.insert(0, BLINK_TOOLS_ABS_PATH)
from blinkpy.common import exit_codes from blinkpy.common import exit_codes
from blinkpy.common.host import Host from blinkpy.common.host import Host
from blinkpy.common.path_finder import PathFinder
from blinkpy.common.system.log_utils import configure_logging from blinkpy.common.system.log_utils import configure_logging
from blinkpy.w3c.common import CHROMIUM_WPT_DIR
from blinkpy.web_tests.models import test_expectations from blinkpy.web_tests.models import test_expectations
from blinkpy.common.path_finder import PathFinder
WD_CLIENT_PATH = 'blinkpy/third_party/wpt/wpt/tools/webdriver' WD_CLIENT_PATH = 'blinkpy/third_party/wpt/wpt/tools/webdriver'
WEBDRIVER_CLIENT_ABS_PATH = os.path.join(BLINK_TOOLS_ABS_PATH, WD_CLIENT_PATH) WEBDRIVER_CLIENT_ABS_PATH = os.path.join(BLINK_TOOLS_ABS_PATH, WD_CLIENT_PATH)
...@@ -127,7 +128,7 @@ class SubtestResultRecorder(object): ...@@ -127,7 +128,7 @@ class SubtestResultRecorder(object):
self.result.append(WebDriverTestResult( self.result.append(WebDriverTestResult(
output_name, status, message)) output_name, status, message))
def set_up_config(chromedriver_server): def set_up_config(path_finder, chromedriver_server):
# These envs are used to create a WebDriver session in the fixture.py file. # These envs are used to create a WebDriver session in the fixture.py file.
os.environ["WD_HOST"] = chromedriver_server.GetHost() os.environ["WD_HOST"] = chromedriver_server.GetHost()
os.environ["WD_PORT"] = str(chromedriver_server.GetPort()) os.environ["WD_PORT"] = str(chromedriver_server.GetPort())
...@@ -155,7 +156,13 @@ def set_up_config(chromedriver_server): ...@@ -155,7 +156,13 @@ def set_up_config(chromedriver_server):
# /blinkpy/web_tests/servers/wptserve.py?l=23&rcl=375b34c6ba64 # /blinkpy/web_tests/servers/wptserve.py?l=23&rcl=375b34c6ba64
# 5d00c1413e4c6106c7bb74581c85 # 5d00c1413e4c6106c7bb74581c85
os.environ["WD_SERVER_CONFIG"] = json.dumps({ os.environ["WD_SERVER_CONFIG"] = json.dumps({
"doc_root": path_finder.path_from_chromium_base(CHROMIUM_WPT_DIR),
"browser_host": "web-platform.test", "browser_host": "web-platform.test",
"domains": {"": {"": "web-platform.test",
"www": "www.web-platform.test",
"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]}})
def run_test(path, path_finder, port, skipped_tests=[]): def run_test(path, path_finder, port, skipped_tests=[]):
...@@ -193,6 +200,7 @@ if __name__ == '__main__': ...@@ -193,6 +200,7 @@ if __name__ == '__main__':
help='JSON perf output file used by swarming, ignored') help='JSON perf output file used by swarming, ignored')
parser.add_argument( parser.add_argument(
'--test-path', '--test-path',
required=True,
help='Path to the WPT WebDriver tests') help='Path to the WPT WebDriver tests')
parser.add_argument( parser.add_argument(
'-v', '--verbose', action='store_true', '-v', '--verbose', action='store_true',
...@@ -252,7 +260,7 @@ if __name__ == '__main__': ...@@ -252,7 +260,7 @@ if __name__ == '__main__':
_log.error('ChromeDriver is not running.') _log.error('ChromeDriver is not running.')
sys.exit(1) sys.exit(1)
set_up_config(chromedriver_server) set_up_config(path_finder, chromedriver_server)
test_path = options.test_path test_path = options.test_path
start_time = time.time() start_time = time.time()
...@@ -264,7 +272,7 @@ if __name__ == '__main__': ...@@ -264,7 +272,7 @@ if __name__ == '__main__':
elif os.path.isdir(test_path): elif os.path.isdir(test_path):
for root, dirnames, filenames in os.walk(test_path): for root, dirnames, filenames in os.walk(test_path):
for filename in filenames: for filename in filenames:
if '__init__' in filename: if '__init__' in filename or not filename.endswith('.py'):
continue continue
test_file = os.path.join(root, filename) test_file = os.path.join(root, filename)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment