Bug 1553177 [wpt PR 16936] - Add Windows 2019 test jobs for Python unittests, a=testonly

Automatic update from web-platform-tests
Disable EOL conversion for all of WPT

In various tests, we expect files to be byte-for-byte identical to
what git stores, and therefore we cannot apply any conversion that
core.autocrlf or core.eol would apply.

--
Fix test_path_lints.py on Windows

--
Alter manifest test generation on Windows

Specifically, don't generate paths with a mixture of / and \

--
Mark stash tests as xfail on Windows

This is https://github.com/web-platform-tests/wpt/issues/16938

--
Update Windows xfail declarations

--
Fix OpenSSL on Python 3 on Windows

--
Manifest items should always have os.path.sep separators

Previously, when loading from JSON, we'd always use the path
separators in the JSON file (always "/").

--
Use cmd to run pip on Windows

Powershell throws an exception if anything is written to stderr,
for example the Python 2.7 deprecation notice or the cache failing

--
Add Windows 2019 test jobs for Python unittests

--

wp5At-commits: 2aef503a5b83fd08f57b7277533293773176b445, 1c74776c231fe455f366ca6b1511dc40ac4317c5, c2f4e9f574dd2647c5cfbc17226c2f66b05ccbc3, e2e4b9f5e5093e9a7b761cedb5937af9f462f2c9, 08d35775c3550c41e9d834a848dd5de77452068e, eaa285dde18846df518b8081b0d1f86997e06580, 6cee5d181a8424bd88ecaefc1a7e4507471de484, cc2cf1a7ae0c77b8ec825792819a07cde228ee55, 97127be8f797a9a26fb141ae091a2a0957de55d0
wpt-pr: 16936
This commit is contained in:
Sam Sneddon 2019-06-13 12:57:53 +00:00 коммит произвёл James Graham
Родитель f1621b8b7f
Коммит e42df0a8ec
12 изменённых файлов: 110 добавлений и 27 удалений

Просмотреть файл

@ -138,6 +138,74 @@ jobs:
parameters:
directory: tools/wpt/
- job: tools_unittest_win
displayName: 'tools/ unittests (Windows)'
dependsOn: decision
condition: dependencies.decision.outputs['test_jobs.tools_unittest']
pool:
vmImage: 'windows-2019'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '2.7.x'
- template: tools/ci/azure/checkout.yml
- template: tools/ci/azure/tox_pytest.yml
parameters:
directory: tools/
toxenv: py27
- job: tools_unittest_win_py3
displayName: 'tools/ unittests (Windows Python 3)'
dependsOn: decision
condition: dependencies.decision.outputs['test_jobs.tools_unittest']
pool:
vmImage: 'windows-2019'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.6.x'
- template: tools/ci/azure/checkout.yml
- template: tools/ci/azure/tox_pytest.yml
parameters:
directory: tools/
toxenv: py36
- job: wptrunner_unittest_win
displayName: 'tools/wptrunner/ unittests (Windows)'
dependsOn: decision
condition: dependencies.decision.outputs['test_jobs.wptrunner_unittest']
pool:
vmImage: 'windows-2019'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '2.7.x'
- template: tools/ci/azure/checkout.yml
- template: tools/ci/azure/tox_pytest.yml
parameters:
directory: tools/wptrunner/
- job: wpt_integration_win
displayName: 'tools/wpt/ tests (Windows)'
dependsOn: decision
condition: dependencies.decision.outputs['test_jobs.wpt_integration']
pool:
vmImage: 'windows-2019'
steps:
# full checkout required
- task: UsePythonVersion@0
inputs:
versionSpec: '2.7.x'
# currently just using the outdated Chrome/Firefox on the VM rather than
# figuring out how to install Chrome Dev channel on Windows
# - template: tools/ci/azure/install_chrome.yml
# - template: tools/ci/azure/install_firefox.yml
- template: tools/ci/azure/update_hosts.yml
- template: tools/ci/azure/update_manifest.yml
- template: tools/ci/azure/tox_pytest.yml
parameters:
directory: tools/wpt/
- job: infrastructure_win10
displayName: 'infrastructure/ tests (Windows 10)'
# This job is only triggered manually until it has been shown to be robust.

1
testing/web-platform/tests/.gitattributes поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
* -text

Просмотреть файл

@ -3,3 +3,4 @@ steps:
# but the raw URL is used to bypass caching.
- script: HOMEBREW_NO_AUTO_UPDATE=1 brew cask install https://raw.githubusercontent.com/Homebrew/homebrew-cask-versions/master/Casks/google-chrome-dev.rb
displayName: 'Install Chrome Dev'
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))

Просмотреть файл

@ -3,3 +3,4 @@ steps:
# but the raw URL is used to bypass caching.
- script: HOMEBREW_NO_AUTO_UPDATE=1 brew cask install https://raw.githubusercontent.com/Homebrew/homebrew-cask-versions/master/Casks/firefox-nightly.rb
displayName: 'Install Firefox Nightly'
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))

Просмотреть файл

@ -11,9 +11,6 @@ steps:
echo "##vso[task.prependpath]$HOME/Library/Python/2.7/bin"
displayName: 'Install Python packages (macOS)'
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
# TODO(foolip): remove --no-cache-dir when the Windows agents are reset
# between each job. Currently, jobs can otherwise fail with "Cache entry
# deserialization failed, entry ignored".
- powershell: pip --no-cache-dir --disable-pip-version-check install --upgrade ${{ parameters.packages }}
- script: pip --disable-pip-version-check install --upgrade ${{ parameters.packages }}
displayName: 'Install Python packages (Windows)'
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))

Просмотреть файл

@ -1,5 +1,7 @@
from __future__ import unicode_literals
import os
from ..lint import check_path
from .base import check_errors
import pytest
@ -72,6 +74,8 @@ def test_ahem_copy_negative(path):
"elsewhere/resources/webidl2/.gitignore",
"elsewhere/css/tools/apiclient/.gitignore"])
def test_gitignore_file(path):
path = os.path.join(*path.split("/"))
expected_error = ("GITIGNORE",
".gitignore found outside the root",
path,
@ -93,6 +97,8 @@ def test_gitignore_file(path):
"css/tools/apiclient/.gitignore",
"css/tools/apiclient/elsewhere/.gitignore"])
def test_gitignore_negative(path):
path = os.path.join(*path.split("/"))
errors = check_path("/foo/", path)
assert errors == []

Просмотреть файл

@ -3,6 +3,8 @@ from six import iteritems
from six.moves.urllib.parse import urljoin, urlparse
from abc import ABCMeta, abstractproperty
from .utils import to_os_path
MYPY = False
if MYPY:
# MYPY is set to True when run under Mypy.
@ -60,6 +62,7 @@ class ManifestItem(object):
@classmethod
def from_json(cls, manifest, path, obj):
path = to_os_path(path)
return cls(manifest.tests_root, path)
@ -96,6 +99,7 @@ class URLManifestItem(ManifestItem):
@classmethod
def from_json(cls, manifest, path, obj):
path = to_os_path(path)
url, extras = obj
return cls(manifest.tests_root,
path,
@ -190,6 +194,7 @@ class RefTestBase(URLManifestItem):
@classmethod
def from_json(cls, manifest, path, obj):
path = to_os_path(path)
url, references, extras = obj
return cls(manifest.tests_root,
path,

Просмотреть файл

@ -33,12 +33,7 @@ def rel_dir_file_path(draw):
return "a"
else:
remaining = length - 2
if os.path.sep == "/":
alphabet = "a/"
elif os.path.sep == "\\":
alphabet = "a/\\"
else:
assert False, "uhhhh, this platform is weird"
alphabet = "a" + os.path.sep
mid = draw(hs.text(alphabet=alphabet, min_size=remaining, max_size=remaining))
return os.path.normcase("a" + mid + "a")

Просмотреть файл

@ -2,6 +2,7 @@ import sys
from io import BytesIO
import pytest
from six import PY2
from wptserve.request import InputFile
@ -120,7 +121,7 @@ def test_readlines():
assert input_file.readlines() == test_file.readlines()
@pytest.mark.xfail(sys.platform == "win32",
@pytest.mark.xfail(sys.platform == "win32" and PY2,
reason="https://github.com/web-platform-tests/wpt/issues/12949")
def test_readlines_file_bigger_than_buffer():
old_max_buf = InputFile.max_buffer_size
@ -139,7 +140,7 @@ def test_iter():
assert a == b
@pytest.mark.xfail(sys.platform == "win32",
@pytest.mark.xfail(sys.platform == "win32" and PY2,
reason="https://github.com/web-platform-tests/wpt/issues/12949")
def test_iter_file_bigger_than_buffer():
old_max_buf = InputFile.max_buffer_size

Просмотреть файл

@ -2,7 +2,6 @@ import os
import unittest
import time
import json
import sys
from six.moves import urllib
@ -61,8 +60,6 @@ class TestSub(TestUsingServer):
expected = b"localhost localhost %i" % self.server.port
self.assertEqual(resp.read().rstrip(), expected)
@pytest.mark.xfail(sys.platform == "win32",
reason="https://github.com/web-platform-tests/wpt/issues/12949")
def test_sub_file_hash(self):
resp = self.request("/sub_file_hash.sub.txt")
expected = b"""
@ -83,8 +80,6 @@ sha512: r8eLGRTc7ZznZkFjeVLyo6/FyQdra9qmlYCwKKxm3kfQAswRS9+3HsYk3thLUhcFmmWhK4dX
expected = b"PASS"
self.assertEqual(resp.read().rstrip(), expected)
@pytest.mark.xfail(sys.platform == "win32",
reason="https://github.com/web-platform-tests/wpt/issues/12949")
def test_sub_location(self):
resp = self.request("/sub_location.sub.txt?query_string")
expected = """

Просмотреть файл

@ -1,5 +1,6 @@
import threading
import multiprocessing
import sys
import threading
from multiprocessing.managers import BaseManager
import pytest
@ -56,6 +57,8 @@ def run(process_queue, request_lock, response_lock):
process_queue.put(thread_queue.get())
@pytest.mark.xfail(sys.platform == "win32",
reason="https://github.com/web-platform-tests/wpt/issues/16938")
def test_delayed_lock(add_cleanup):
"""Ensure that delays in proxied Lock retrieval do not interfere with
initialization in parallel threads."""
@ -92,6 +95,9 @@ def test_delayed_lock(add_cleanup):
assert [queue.get(), queue.get()] == [False, False], (
"both instances had valid locks")
@pytest.mark.xfail(sys.platform == "win32",
reason="https://github.com/web-platform-tests/wpt/issues/16938")
def test_delayed_dict(add_cleanup):
"""Ensure that delays in proxied `dict` retrieval do not interfere with
initialization in parallel threads."""

Просмотреть файл

@ -6,7 +6,7 @@ import subprocess
import tempfile
from datetime import datetime, timedelta
from six import iteritems
from six import iteritems, PY2
# Amount of time beyond the present to consider certificates "expired." This
# allows certificates to be proactively re-generated in the "buffer" period
@ -14,6 +14,17 @@ from six import iteritems
CERT_EXPIRY_BUFFER = dict(hours=6)
def _ensure_str(s, encoding):
"""makes sure s is an instance of str, converting with encoding if needed"""
if isinstance(s, str):
return s
if PY2:
return s.encode(encoding)
else:
return s.decode(encoding)
class OpenSSL(object):
def __init__(self, logger, binary, base_path, conf_path, hosts, duration,
base_conf_path=None):
@ -65,18 +76,14 @@ class OpenSSL(object):
self.cmd += ["-config", self.conf_path]
self.cmd += list(args)
# Copy the environment, converting to plain strings. Windows
# StartProcess is picky about all the keys/values being plain strings,
# but at least in MSYS shells, the os.environ dictionary can be mixed.
# Copy the environment, converting to plain strings. Win32 StartProcess
# is picky about all the keys/values being str (on both Py2/3).
env = {}
for k, v in iteritems(os.environ):
try:
env[k.encode("utf8")] = v.encode("utf8")
except UnicodeDecodeError:
pass
env[_ensure_str(k, "utf8")] = _ensure_str(v, "utf8")
if self.base_conf_path is not None:
env["OPENSSL_CONF"] = self.base_conf_path.encode("utf8")
env["OPENSSL_CONF"] = _ensure_str(self.base_conf_path, "utf-8")
self.proc = subprocess.Popen(self.cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
env=env)