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
This commit is contained in:
CHANG FU CHIAO 2016-08-28 16:16:34 +08:00
parent 0dd005eacc
commit fd204e0365
5 changed files with 43 additions and 5 deletions

View file

@ -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

View file

@ -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"]

View file

@ -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}"

26
etc/ci/performance/test_perf.sh Executable file
View file

@ -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

View file

@ -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')