mirror of
https://github.com/servo/servo.git
synced 2025-07-22 14:53:49 +01:00
Add a --date option to test-perf.
This commit is contained in:
parent
6aae59e7e5
commit
ee766b5e16
4 changed files with 29 additions and 14 deletions
|
@ -71,7 +71,7 @@ def generate_placeholder(testcase):
|
||||||
return [timings]
|
return [timings]
|
||||||
|
|
||||||
|
|
||||||
def run_gecko_test(testcase, url, timeout, is_async):
|
def run_gecko_test(testcase, url, date, timeout, is_async):
|
||||||
with create_gecko_session() as driver:
|
with create_gecko_session() as driver:
|
||||||
driver.set_page_load_timeout(timeout)
|
driver.set_page_load_timeout(timeout)
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -17,7 +17,7 @@ from statistics import median, StatisticsError
|
||||||
from urllib.parse import urlsplit, urlunsplit, urljoin
|
from urllib.parse import urlsplit, urlunsplit, urljoin
|
||||||
|
|
||||||
|
|
||||||
DATE = datetime.now().strftime("%Y%m%d")
|
DATE = datetime.now().strftime("%Y-%m-%d")
|
||||||
MACHINE = platform.machine()
|
MACHINE = platform.machine()
|
||||||
SYSTEM = platform.system()
|
SYSTEM = platform.system()
|
||||||
|
|
||||||
|
@ -66,11 +66,11 @@ def execute_test(url, command, timeout):
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
def run_servo_test(testcase, url, timeout, is_async):
|
def run_servo_test(testcase, url, date, timeout, is_async):
|
||||||
if is_async:
|
if is_async:
|
||||||
print("Servo does not support async test!")
|
print("Servo does not support async test!")
|
||||||
# Return a placeholder
|
# Return a placeholder
|
||||||
return parse_log("", testcase, url)
|
return parse_log("", testcase, url, date)
|
||||||
|
|
||||||
ua_script_path = "{}/user-agent-js".format(os.getcwd())
|
ua_script_path = "{}/user-agent-js".format(os.getcwd())
|
||||||
command = [
|
command = [
|
||||||
|
@ -92,10 +92,10 @@ def run_servo_test(testcase, url, timeout, is_async):
|
||||||
))
|
))
|
||||||
except subprocess.TimeoutExpired:
|
except subprocess.TimeoutExpired:
|
||||||
print("Test FAILED due to timeout: {}".format(testcase))
|
print("Test FAILED due to timeout: {}".format(testcase))
|
||||||
return parse_log(log, testcase, url)
|
return parse_log(log, testcase, url, date)
|
||||||
|
|
||||||
|
|
||||||
def parse_log(log, testcase, url):
|
def parse_log(log, testcase, url, date):
|
||||||
blocks = []
|
blocks = []
|
||||||
block = []
|
block = []
|
||||||
copy = False
|
copy = False
|
||||||
|
@ -149,7 +149,7 @@ def parse_log(log, testcase, url):
|
||||||
return {
|
return {
|
||||||
"system": SYSTEM,
|
"system": SYSTEM,
|
||||||
"machine": MACHINE,
|
"machine": MACHINE,
|
||||||
"date": DATE,
|
"date": date,
|
||||||
"testcase": testcase,
|
"testcase": testcase,
|
||||||
"title": "",
|
"title": "",
|
||||||
"navigationStart": 0,
|
"navigationStart": 0,
|
||||||
|
@ -177,15 +177,15 @@ def parse_log(log, testcase, url):
|
||||||
|
|
||||||
# Set the testcase field to contain the original testcase name,
|
# Set the testcase field to contain the original testcase name,
|
||||||
# rather than the url.
|
# rather than the url.
|
||||||
def set_testcase(timing, testcase=None):
|
def set_testcase(timing, testcase=None, date=None):
|
||||||
timing['testcase'] = testcase
|
timing['testcase'] = testcase
|
||||||
timing['system'] = SYSTEM
|
timing['system'] = SYSTEM
|
||||||
timing['machine'] = MACHINE
|
timing['machine'] = MACHINE
|
||||||
timing['date'] = DATE
|
timing['date'] = date
|
||||||
return timing
|
return timing
|
||||||
|
|
||||||
valid_timing_for_case = partial(valid_timing, url=url)
|
valid_timing_for_case = partial(valid_timing, url=url)
|
||||||
set_testcase_for_case = partial(set_testcase, testcase=testcase)
|
set_testcase_for_case = partial(set_testcase, testcase=testcase, date=date)
|
||||||
timings = list(map(set_testcase_for_case, filter(valid_timing_for_case, map(parse_block, blocks))))
|
timings = list(map(set_testcase_for_case, filter(valid_timing_for_case, map(parse_block, blocks))))
|
||||||
|
|
||||||
if len(timings) == 0:
|
if len(timings) == 0:
|
||||||
|
@ -329,6 +329,10 @@ def main():
|
||||||
default=300, # 5 min
|
default=300, # 5 min
|
||||||
help=("kill the test if not finished in time (sec)."
|
help=("kill the test if not finished in time (sec)."
|
||||||
" Default: 5 min"))
|
" Default: 5 min"))
|
||||||
|
parser.add_argument("--date",
|
||||||
|
type=str,
|
||||||
|
default=None, # 5 min
|
||||||
|
help=("the date to use in the CSV file."))
|
||||||
parser.add_argument("--engine",
|
parser.add_argument("--engine",
|
||||||
type=str,
|
type=str,
|
||||||
default='servo',
|
default='servo',
|
||||||
|
@ -340,6 +344,7 @@ def main():
|
||||||
elif args.engine == 'gecko':
|
elif args.engine == 'gecko':
|
||||||
import gecko_driver # Load this only when we need gecko test
|
import gecko_driver # Load this only when we need gecko test
|
||||||
run_test = gecko_driver.run_gecko_test
|
run_test = gecko_driver.run_gecko_test
|
||||||
|
date = args.date or DATE
|
||||||
try:
|
try:
|
||||||
# Assume the server is up and running
|
# Assume the server is up and running
|
||||||
testcases = load_manifest(args.tp5_manifest)
|
testcases = load_manifest(args.tp5_manifest)
|
||||||
|
@ -352,7 +357,7 @@ def main():
|
||||||
url))
|
url))
|
||||||
# results will be a mixure of timings 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, url, args.timeout, is_async)
|
results += run_test(testcase, url, date, args.timeout, is_async)
|
||||||
print("Finished")
|
print("Finished")
|
||||||
# TODO: Record and analyze other performance.timing properties
|
# TODO: Record and analyze other performance.timing properties
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ set -o pipefail
|
||||||
# https://groups.google.com/forum/#!topic/mozilla.dev.servo/JlAZoRgcnpA
|
# https://groups.google.com/forum/#!topic/mozilla.dev.servo/JlAZoRgcnpA
|
||||||
port="8123"
|
port="8123"
|
||||||
base="http://localhost:${port}"
|
base="http://localhost:${port}"
|
||||||
|
date="$(date +%Y-%m-%d)"
|
||||||
|
|
||||||
while (( "${#}" ))
|
while (( "${#}" ))
|
||||||
do
|
do
|
||||||
|
@ -33,6 +34,10 @@ case "${1}" in
|
||||||
base="${2}"
|
base="${2}"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--date)
|
||||||
|
date="${2}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown option ${1}."
|
echo "Unknown option ${1}."
|
||||||
exit
|
exit
|
||||||
|
@ -56,11 +61,12 @@ trap 'kill $(jobs -pr)' SIGINT SIGTERM EXIT
|
||||||
# MANIFEST="page_load_test/tp5n/20160509.manifest"
|
# MANIFEST="page_load_test/tp5n/20160509.manifest"
|
||||||
MANIFEST="page_load_test/test.manifest" # A manifest that excludes
|
MANIFEST="page_load_test/test.manifest" # A manifest that excludes
|
||||||
# timeout test cases
|
# timeout test cases
|
||||||
PERF_KEY="perf-$(uname -s)-$(uname -m)-$(date +%s).csv"
|
PERF_KEY="perf-$(uname -s)-$(uname -m)-${date}.csv"
|
||||||
PERF_FILE="output/${PERF_KEY}"
|
PERF_FILE="output/${PERF_KEY}"
|
||||||
|
|
||||||
echo "Running tests"
|
echo "Running tests"
|
||||||
python3 runner.py ${engine} --runs 4 --timeout "${timeout}" --base "${base}" \
|
python3 runner.py ${engine} --runs 4 --timeout "${timeout}" \
|
||||||
|
--base "${base}" --date "${date}" \
|
||||||
"${MANIFEST}" "${PERF_FILE}"
|
"${MANIFEST}" "${PERF_FILE}"
|
||||||
|
|
||||||
if [[ "${submit:-}" ]];
|
if [[ "${submit:-}" ]];
|
||||||
|
|
|
@ -171,9 +171,11 @@ class MachCommands(CommandBase):
|
||||||
category='testing')
|
category='testing')
|
||||||
@CommandArgument('--base', default=None,
|
@CommandArgument('--base', default=None,
|
||||||
help="the base URL for testcases")
|
help="the base URL for testcases")
|
||||||
|
@CommandArgument('--date', default=None,
|
||||||
|
help="the datestamp for the data")
|
||||||
@CommandArgument('--submit', '-a', default=False, action="store_true",
|
@CommandArgument('--submit', '-a', default=False, action="store_true",
|
||||||
help="submit the data to perfherder")
|
help="submit the data to perfherder")
|
||||||
def test_perf(self, base=None, submit=False):
|
def test_perf(self, base=None, date=None, submit=False):
|
||||||
self.set_software_rendering_env(True)
|
self.set_software_rendering_env(True)
|
||||||
|
|
||||||
self.ensure_bootstrapped()
|
self.ensure_bootstrapped()
|
||||||
|
@ -181,6 +183,8 @@ class MachCommands(CommandBase):
|
||||||
cmd = ["bash", "test_perf.sh"]
|
cmd = ["bash", "test_perf.sh"]
|
||||||
if base:
|
if base:
|
||||||
cmd += ["--base", base]
|
cmd += ["--base", base]
|
||||||
|
if date:
|
||||||
|
cmd += ["--date", date]
|
||||||
if submit:
|
if submit:
|
||||||
cmd += ["--submit"]
|
cmd += ["--submit"]
|
||||||
return call(cmd,
|
return call(cmd,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue