From d8b862e4d7e643954173984e465edb083a0f9930 Mon Sep 17 00:00:00 2001 From: Shing Lyu Date: Wed, 16 Nov 2016 17:06:14 +0800 Subject: [PATCH] Various easy nits --- etc/ci/performance/README.md | 2 +- etc/ci/performance/firefox/addon/README.md | 2 -- etc/ci/performance/firefox/addon/data/perf.js | 1 - etc/ci/performance/firefox/addon/index.js | 8 ------ etc/ci/performance/firefox/addon/package.json | 16 ------------ etc/ci/performance/gecko_driver.py | 12 ++++----- etc/ci/performance/runner.py | 25 +++++++++++-------- 7 files changed, 21 insertions(+), 45 deletions(-) delete mode 100644 etc/ci/performance/firefox/addon/README.md delete mode 120000 etc/ci/performance/firefox/addon/data/perf.js delete mode 100644 etc/ci/performance/firefox/addon/index.js delete mode 100644 etc/ci/performance/firefox/addon/package.json diff --git a/etc/ci/performance/README.md b/etc/ci/performance/README.md index 8c1966fd19c4..b7baeb08453a 100644 --- a/etc/ci/performance/README.md +++ b/etc/ci/performance/README.md @@ -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 diff --git a/etc/ci/performance/firefox/addon/README.md b/etc/ci/performance/firefox/addon/README.md deleted file mode 100644 index e6967bf55b45..000000000000 --- a/etc/ci/performance/firefox/addon/README.md +++ /dev/null @@ -1,2 +0,0 @@ -#Servo Performance Comparison -Monitor website rendering performance \ No newline at end of file diff --git a/etc/ci/performance/firefox/addon/data/perf.js b/etc/ci/performance/firefox/addon/data/perf.js deleted file mode 120000 index 9b8adc62230d..000000000000 --- a/etc/ci/performance/firefox/addon/data/perf.js +++ /dev/null @@ -1 +0,0 @@ -../../../user-agent-js/01.perf-timing.js \ No newline at end of file diff --git a/etc/ci/performance/firefox/addon/index.js b/etc/ci/performance/firefox/addon/index.js deleted file mode 100644 index e4835feb58eb..000000000000 --- a/etc/ci/performance/firefox/addon/index.js +++ /dev/null @@ -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"] -}); diff --git a/etc/ci/performance/firefox/addon/package.json b/etc/ci/performance/firefox/addon/package.json deleted file mode 100644 index 93fd45aea285..000000000000 --- a/etc/ci/performance/firefox/addon/package.json +++ /dev/null @@ -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" - ] -} diff --git a/etc/ci/performance/gecko_driver.py b/etc/ci/performance/gecko_driver.py index f19b7e683add..de7a48f26791 100644 --- a/etc/ci/performance/gecko_driver.py +++ b/etc/ci/performance/gecko_driver.py @@ -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) @@ -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 diff --git a/etc/ci/performance/runner.py b/etc/ci/performance/runner.py index b36fa575ddee..ed2b7cd78c4a 100644 --- a/etc/ci/performance/runner.py +++ b/etc/ci/performance/runner.py @@ -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 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): @@ -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")