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

View file

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