Skip to content

Commit

Permalink
Various easy nits
Browse files Browse the repository at this point in the history
  • Loading branch information
shinglyu committed Nov 16, 2016
1 parent 6110017 commit d8b862e
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 45 deletions.
2 changes: 1 addition & 1 deletion etc/ci/performance/README.md
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions etc/ci/performance/firefox/addon/README.md

This file was deleted.

1 change: 0 additions & 1 deletion etc/ci/performance/firefox/addon/data/perf.js

This file was deleted.

8 changes: 0 additions & 8 deletions etc/ci/performance/firefox/addon/index.js

This file was deleted.

16 changes: 0 additions & 16 deletions etc/ci/performance/firefox/addon/package.json

This file was deleted.

12 changes: 6 additions & 6 deletions etc/ci/performance/gecko_driver.py
Expand Up @@ -8,7 +8,7 @@
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)
Expand Down Expand Up @@ -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
Expand Down
25 changes: 14 additions & 11 deletions etc/ci/performance/runner.py
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -63,7 +66,7 @@ def run_servo_test(url, timeout):


def get_gecko_command(url):
return gecko_driver.execute_gecko_test
return gecko_driver.run_gecko_test


def parse_log(log, testcase):
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit d8b862e

Please sign in to comment.