Skip to content
Permalink
Browse files

Test CL investigating chromedriver timeouts

  • Loading branch information
stephenmcgruer committed Oct 9, 2019
1 parent 9bd6901 commit 3c45fd5b6315eb4ee376d0e0bf2ed714d5eaf2d6
@@ -242,10 +242,7 @@ tasks:
script: >-
export TOXENV=py27;
export HYPOTHESIS_PROFILE=ci;
export PY_COLORS=0;
./tools/ci/run_tc.py \
tools_unittest \
tools/ci/ci_tools_unittest.sh
export PY_COLORS=0
conditions:
push
pull-request
@@ -257,10 +254,7 @@ tasks:
export HYPOTHESIS_PROFILE=ci;
export PY_COLORS=0;
sudo apt update -qqy;
sudo apt install -qqy python3-pip;
./tools/ci/run_tc.py \
tools_unittest \
tools/ci/ci_tools_unittest.sh
sudo apt install -qqy python3-pip
conditions:
push
pull-request
@@ -16,16 +16,17 @@ test_infrastructure() {
else
ARGS=$1
fi
./wpt run --log-tbpl - --yes --manifest ~/meta/MANIFEST.json --metadata infrastructure/metadata/ --install-fonts $ARGS $PRODUCT infrastructure/
./wpt run --no-pause-after-test --log-tbpl - --log-tbpl-level debug --yes --manifest ~/meta/MANIFEST.json --metadata infrastructure/metadata/ --install-fonts --binary-arg=--enable-logging --binary-arg=--log-level=0 --binary-arg=--log-file=/tmp/chrome_log.txt $ARGS $PRODUCT infrastructure/assumptions/ahem.html; echo "Dumping chrome log"; cat /tmp/chrome_log.txt
}

main() {
PRODUCTS=( "firefox" "chrome" )
# PRODUCTS=( "firefox" "chrome" )
PRODUCTS=( "chrome" )
./wpt manifest --rebuild -p ~/meta/MANIFEST.json
for PRODUCT in "${PRODUCTS[@]}"; do
if [[ "$PRODUCT" == "chrome" ]]; then
add_wpt_hosts
test_infrastructure "--binary=$(which google-chrome-unstable) --channel dev"
test_infrastructure "--binary=/tmp/chrome-linux/chrome --channel dev"
else
test_infrastructure
fi
@@ -124,26 +124,33 @@ def checkout_revision(rev):


def install_chrome(channel):
deb_prefix = "https://dl.google.com/linux/direct/"
if channel in ("experimental", "dev", "nightly"):
# Pinned to 78 as 79 consistently fails reftests. TODO(foolip).
# See https://github.com/web-platform-tests/wpt/issues/19297.
deb_archive = "google-chrome-unstable_78.0.3904.17-1_amd64.deb"
deb_prefix = "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-unstable/"
elif channel == "beta":
deb_archive = "google-chrome-beta_current_amd64.deb"
elif channel == "stable":
deb_archive = "google-chrome-stable_current_amd64.deb"
else:
raise ValueError("Unrecognized release channel: %s" % channel)

dest = os.path.join("/tmp", deb_archive)
resp = urlopen(deb_prefix + deb_archive)
with open(dest, "w") as f:
f.write(resp.read())

run(["sudo", "apt-get", "-qqy", "update"])
run(["sudo", "gdebi", "-qn", "/tmp/%s" % deb_archive])
# Bisecting
url = "http://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/697266/chrome-linux.zip"
dest = "/tmp/google-chrome-unstable.zip"
resp = urlopen(url)
with open(dest, 'w') as f:
f.write(resp.read())
run(["unzip", "/tmp/google-chrome-unstable.zip", "-d", "/tmp/"])
run(["sudo", "apt-get", "install", "libxss1"])
#deb_prefix = "https://dl.google.com/linux/direct/"
#if channel in ("experimental", "dev", "nightly"):
# # Bisecting
# deb_prefix = "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-unstable/"
# deb_archive = "google-chrome-unstable_78.0.3904.17-1_amd64.deb"
#elif channel == "beta":
# deb_archive = "google-chrome-beta_current_amd64.deb"
#elif channel == "stable":
# deb_archive = "google-chrome-stable_current_amd64.deb"
#else:
# raise ValueError("Unrecognized release channel: %s" % channel)

#dest = os.path.join("/tmp", deb_archive)
#resp = urlopen(deb_prefix + deb_archive)
#with open(dest, "w") as f:
# f.write(resp.read())

#run(["sudo", "apt-get", "-qqy", "update"])
#run(["sudo", "gdebi", "-qn", "/tmp/%s" % deb_archive])

def install_webkitgtk_from_apt_repository(channel):
# Configure webkitgtk.org/debian repository for $channel and pin it with maximum priority
@@ -42,7 +42,8 @@ RUN apt-get -qqy install \
libappindicator3-1 \
libdbusmenu-gtk3-4 \
libindicator3-7 \
libindicator7
libindicator7 \
libxss1

RUN apt-get -y autoremove

@@ -576,6 +576,8 @@ def install_webdriver_by_version(self, version, dest=None):
if dest is None:
dest = os.pwd
url = self._latest_chromedriver_url(version)
self.logger.info("Overriding ChromeDriver for testing")
url = "https://chromedriver.storage.googleapis.com/78.0.3904.11/chromedriver_linux64.zip"
self.logger.info("Downloading ChromeDriver from %s" % url)
unzip(get(url).raw, dest)
chromedriver_dir = os.path.join(
@@ -347,6 +347,7 @@ def setup_kwargs(self, kwargs):
kwargs["binary_args"].append("--enable-experimental-web-platform-features")
# HACK(Hexcles): work around https://github.com/web-platform-tests/wpt/issues/16448
kwargs["webdriver_args"].append("--disable-build-check")
kwargs["webdriver_args"].append("--verbose")


class ChromeAndroid(BrowserSetup):
@@ -339,6 +339,7 @@ def run_test(self, test):
# Depth-first search of reference tree, with the goal
# of reachings a leaf node with only pass results

self.logger.info('RefTestImplementation: run_test. test.references: ' + str(test.references))
stack = list(((test, item[0]), item[1]) for item in reversed(test.references))
while stack:
hashes = [None, None]
@@ -7,6 +7,7 @@
import traceback
import urlparse
import uuid
from datetime import datetime

from .base import (CallbackHandler,
RefTestExecutor,
@@ -438,6 +439,7 @@ def is_alive(self):
return self.protocol.is_alive()

def do_test(self, test):
self.logger.info('do_test for WebDriverRefTestExecutor');
width_offset, height_offset = self.protocol.webdriver.execute_script(
"""return [window.outerWidth - window.innerWidth,
window.outerHeight - window.innerHeight];"""
@@ -458,6 +460,7 @@ def screenshot(self, test, viewport_size, dpi):
assert viewport_size is None
assert dpi is None

self.logger.info('screenshot: url=' + str(self.test_url(test)) + ', timeout: ' + str(test.timeout))
return WebDriverRun(self._screenshot,
self.protocol,
self.test_url(test),
@@ -467,9 +470,17 @@ def _screenshot(self, protocol, url, timeout):
webdriver = protocol.webdriver
webdriver.url = url

self.logger.info('_screenshot, trying execute_script()')
res = webdriver.execute_script("return document.readyState;")
self.logger.info('res: ' + str(res))

now = datetime.now()
self.logger.info(str(now) + ': _screenshot, executing self.wait_script')
webdriver.execute_async_script(self.wait_script)

self.logger.info('_screenshot, executing webdriver.screenshot()')
screenshot = webdriver.screenshot()
self.logger.info('_screenshot, screenshot is not None? ' + str(screenshot is not None))

# strip off the data:img/png, part of the url
if screenshot.startswith("data:image/png;base64,"):
@@ -1,21 +1,31 @@
var callback = arguments[arguments.length - 1];

function root_wait() {
console.log('root.classList.contains("reftest-wait"): ' + root.classList.contains("reftest-wait"));
if (!root.classList.contains("reftest-wait")) {
observer.disconnect();

console.log('disconnected observer');

console.log('Document.prototype.hasOwnProperty("fonts"): ' + Document.prototype.hasOwnProperty("fonts"));
if (Document.prototype.hasOwnProperty("fonts")) {
document.fonts.ready.then(ready_for_screenshot);
console.log('waiting on document.fonts.ready');
document.fonts.ready.then(() => {
console.log('document.fonts.ready fired, calling ready_for_screenshot');
ready_for_screenshot();
});
} else {
// This might take the screenshot too early, depending on whether the
// load event is blocked on fonts being loaded. See:
// https://github.com/w3c/csswg-drafts/issues/1088
console.log('calling ready_for_screenshot');
ready_for_screenshot();
}
}
}

function ready_for_screenshot() {
console.log('in ready_for_screenshot()');
// As of 2017-04-05, the Chromium web browser exhibits a rendering bug
// (https://bugs.chromium.org/p/chromium/issues/detail?id=708757) that
// produces instability during screen capture. The following use of
@@ -26,7 +36,9 @@ function ready_for_screenshot() {
// https://github.com/jugglinmike/chrome-screenshot-race/issues/1

requestAnimationFrame(function() {
console.log('rAF 1 complete');
requestAnimationFrame(function() {
console.log('rAF 2 complete, calling callback()');
callback();
});
});
@@ -35,10 +47,14 @@ function ready_for_screenshot() {
var root = document.documentElement;
var observer = new MutationObserver(root_wait);

console.log('observer.observe(document.documentElement, {attributes: true});');
observer.observe(root, {attributes: true});

console.log('document.readyState: ' + document.readyState);
if (document.readyState != "complete") {
addEventListener('load', root_wait);
console.log('addEventListener(\'load\', root_wait);');
addEventListener('load', () => { console.log('load event listener fired'); root_wait(); });
} else {
console.log('call root_wait()');
root_wait();
}
@@ -849,6 +849,11 @@ def stop(self):
as possible"""
self.stop_flag.set()
self.logger.debug("Stop flag set in ManagerGroup")
# Hackz
self.logger.info('DUMPING CHROME LOG')
with open('/tmp/chrome_log.txt', 'r') as f:
self.logger.info(f.read())
self.logger.info('DONE')

def test_count(self):
return sum(manager.test_count for manager in self.pool)

0 comments on commit 3c45fd5

Please sign in to comment.
You can’t perform that action at this time.