aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCHANG FU CHIAO <zector1030@gmail.com>2016-08-28 16:16:34 +0800
committerCHANG FU CHIAO <zector1030@gmail.com>2016-09-25 14:49:51 +0800
commitfd204e03651b2642bb78ae0796c348561fc47e1c (patch)
treeb559134ad1e73289b4a9c25739342bffc4d05687
parent0dd005eacc975ed1e7781ce8bdb5175f81a75418 (diff)
downloadservo-fd204e03651b2642bb78ae0796c348561fc47e1c.tar.gz
servo-fd204e03651b2642bb78ae0796c348561fc47e1c.zip
Create ./mach test-perf command
in testing_commands.py, I linked the new command to test_perf.sh in test_perf.sh, it would prepare tp5n.zip and virtual environment then run test_all.sh
-rw-r--r--etc/ci/performance/README.md4
-rw-r--r--etc/ci/performance/runner.py2
-rwxr-xr-xetc/ci/performance/test_all.sh6
-rwxr-xr-xetc/ci/performance/test_perf.sh26
-rw-r--r--python/servo/testing_commands.py10
5 files changed, 43 insertions, 5 deletions
diff --git a/etc/ci/performance/README.md b/etc/ci/performance/README.md
index fe7a7bec809..bd48ab6d72b 100644
--- a/etc/ci/performance/README.md
+++ b/etc/ci/performance/README.md
@@ -24,7 +24,9 @@ Servo Page Load Time Test
## Run
* Activate the virutalenv: `source venv/bin/activate`
* Sync your system clock before running, the Perfherder API SSL check will fail if your system clock is not accurate. (e.g. `sudo nptdate tw.pool.ntp.org`)
-* Run `test_all.sh`
+* Run `test_all.sh [--servo|--gecko] [--submit]`
+ - choose `servo` or `gecko` as the testing engine
+ - enable `submit`, if you want to submit to perfherder
* Test results are submitted to https://treeherder.mozilla.org/#/jobs?repo=servo
# How it works
diff --git a/etc/ci/performance/runner.py b/etc/ci/performance/runner.py
index 7da6711db85..ab5a31c4a6d 100644
--- a/etc/ci/performance/runner.py
+++ b/etc/ci/performance/runner.py
@@ -41,7 +41,7 @@ def execute_test(url, command, timeout):
def get_servo_command(url):
ua_script_path = "{}/user-agent-js".format(os.getcwd())
- return ["./servo/servo", url,
+ return ["../../../target/release/servo", url,
"--userscripts", ua_script_path,
"-x", "-o", "output.png"]
diff --git a/etc/ci/performance/test_all.sh b/etc/ci/performance/test_all.sh
index b5be5a745c0..fe619006ace 100755
--- a/etc/ci/performance/test_all.sh
+++ b/etc/ci/performance/test_all.sh
@@ -12,10 +12,10 @@ while (( "${#}" ))
do
case "${1}" in
--servo)
- engine="--engine servo"
+ engine="--engine=servo"
;;
--gecko)
- engine="--engine gecko"
+ engine="--engine=gecko"
;;
--submit)
submit=1
@@ -40,7 +40,7 @@ python3 -m http.server > /dev/null 2>&1 &
# MANIFEST="page_load_test/test.manifest"
MANIFEST="page_load_test/tp5n/20160509.manifest" # A manifest that excludes
# timeout test cases
-PERF_FILE="output/perf-$(date --iso-8601=seconds).json"
+PERF_FILE="output/perf-$(date +%s).json"
echo "Running tests"
python3 runner.py ${engine} --runs 3 "${MANIFEST}" "${PERF_FILE}"
diff --git a/etc/ci/performance/test_perf.sh b/etc/ci/performance/test_perf.sh
new file mode 100755
index 00000000000..87897ee3ef9
--- /dev/null
+++ b/etc/ci/performance/test_perf.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+set -o errexit
+set -o nounset
+set -o pipefail
+
+TP5N_SOURCE="https://people.mozilla.org/~jmaher/taloszips/zips/tp5n.zip"
+TP5N_PATH="page_load_test/tp5n.zip"
+if [[ ! -f "${TP5N_PATH}" ]]; then
+ wget "${TP5N_SOURCE}" -O "${TP5N_PATH}"
+fi
+unzip -o "${TP5N_PATH}" -d "$(dirname "${TP5N_PATH}")"
+
+virtualenv venv --python="$(which python3)"
+PS1="" source venv/bin/activate
+# `PS1` must be defined before activating virtualenv
+pip install "treeherder-client>=3.0.0"
+
+mkdir -p servo
+mkdir -p output
+./git_log_to_json.sh > servo/revision.json && \
+./test_all.sh --servo
diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py
index 38248f9aae3..96dfd789bed 100644
--- a/python/servo/testing_commands.py
+++ b/python/servo/testing_commands.py
@@ -169,6 +169,16 @@ class MachCommands(CommandBase):
return call(["cargo", "test"], env=env, cwd=path.join("ports", "geckolib"))
+ @Command('test-perf',
+ description='Run the page load performance test',
+ category='testing')
+ def test_perf(self):
+ self.ensure_bootstrapped()
+ env = self.build_env()
+ return call(["bash", "test_perf.sh"],
+ env=env,
+ cwd=path.join("etc", "ci", "performance"))
+
@Command('test-unit',
description='Run unit tests',
category='testing')