Various easy nits

This commit is contained in:
Shing Lyu 2016-11-16 17:06:14 +08:00
parent 6110017569
commit d8b862e4d7
7 changed files with 21 additions and 45 deletions

View file

@ -64,7 +64,7 @@ If you want to test the data submission code in `submit_to_perfherder.py` withou
## For Gecko
* Install Firefox Nightly in your PATH
* Download [geckodrive](https://github.com/mozilla/geckodriver/releases) and add it to the `PATH`
* Download [geckodriver](https://github.com/mozilla/geckodriver/releases) and add it to the `PATH`
* `pip install selenium`
* Run `python gecko_driver.py` to test

View file

@ -1,2 +0,0 @@
#Servo Performance Comparison
Monitor website rendering performance

View file

@ -1 +0,0 @@
../../../user-agent-js/01.perf-timing.js

View file

@ -1,8 +0,0 @@
var self = require("sdk/self");
var pageMod = require("sdk/page-mod");
pageMod.PageMod({
include: "*",
contentScriptFile: self.data.url('perf.js'),
attachTo: ["top", "existing"]
});

View file

@ -1,16 +0,0 @@
{
"title": "Servo Performance Comparison",
"name": "addon",
"version": "0.0.1",
"description": "Monitor website rendering performance",
"main": "index.js",
"author": "The Servo team",
"engines": {
"firefox": ">=38.0a1",
"fennec": ">=38.0a1"
},
"license": "MPL",
"keywords": [
"jetpack"
]
}

View file

@ -8,7 +8,7 @@ from selenium import webdriver
from selenium.common.exceptions import TimeoutException
def execute_gecko_test(testcase, timeout):
def run_gecko_test(testcase, timeout):
firefox_binary = "./firefox/firefox/firefox"
driver = webdriver.Firefox(firefox_binary=firefox_binary)
driver.set_page_load_timeout(timeout)
@ -55,16 +55,16 @@ def execute_gecko_test(testcase, timeout):
# So we need to get the timing fields one by one
for name in timing_names:
if failed:
if name == "navigationStart":
timings[name] = 0
else:
timings[name] = -1
# We need to still include the failed tests, otherwise Treeherder will
# consider the result to be a new test series, and thus a new graph. So we
# use a placeholder with values = -1 to make Treeherder happy, and still be
# able to identify failed tests (successful tests have time >=0).
timings[name] = 0 if name == "navigationStart" else -1
else:
timings[name] = driver.execute_script(
"return performance.timing.{0}".format(name)
)
timings['testcase'] = testcase
# driver.quit() gives an "'NoneType' object has no attribute 'path'" error.
# Fixed in
# https://github.com/SeleniumHQ/selenium/commit/9157c7071f9900c2608f5ca40ae4f518ed373b96

View file

@ -27,8 +27,9 @@ def parse_manifest(text):
def execute_test(url, command, timeout):
try:
return subprocess.check_output(command, stderr=subprocess.STDOUT,
timeout=timeout)
return subprocess.check_output(
command, stderr=subprocess.STDOUT, timeout=timeout
)
except subprocess.CalledProcessError as e:
print("Unexpected Fail:")
print(e)
@ -42,15 +43,17 @@ def execute_test(url, command, timeout):
def get_servo_command(url):
def run_servo_test(url, timeout):
ua_script_path = "{}/user-agent-js".format(os.getcwd())
command = ["../../../target/release/servo", url,
"--userscripts", ua_script_path,
"--headless",
"-x", "-o", "output.png"]
command = [
"../../../target/release/servo", url,
"--userscripts", ua_script_path,
"--headless",
"-x", "-o", "output.png"
]
log = ""
try:
log = subprocess.check_output(command,
stderr=subprocess.STDOUT,
timeout=timeout)
log = subprocess.check_output(
command, stderr=subprocess.STDOUT, timeout=timeout
)
except subprocess.CalledProcessError as e:
print("Unexpected Fail:")
print(e)
@ -63,7 +66,7 @@ def get_servo_command(url):
def get_gecko_command(url):
return gecko_driver.execute_gecko_test
return gecko_driver.run_gecko_test
def parse_log(log, testcase):
@ -265,7 +268,7 @@ def main():
print("Running test {}/{} on {}".format(run + 1,
args.runs,
testcase))
# results will be a mixure of timeings dict and testcase strings
# results will be a mixure of timings dict and testcase strings
# testcase string indicates a failed test
results += run_test(testcase, args.timeout)
print("Finished")