Bug 1378139 - Add stylo-only talos test suite for perf-reftest singletons; r=igoldan
MozReview-Commit-ID: 58yFIGLxyKm
--- a/testing/talos/talos.json
+++ b/testing/talos/talos.json
@@ -82,16 +82,19 @@
"tests": ["tsvgx", "tsvgr_opacity", "tart", "tscrollx", "cart", "tsvg_static"]
},
"perf-reftest": {
"tests": ["bloom_basic"]
},
"perf-reftest-e10s": {
"tests": ["bloom_basic"]
},
+ "perf-reftest-singletons-e10s": {
+ "tests": ["bloom_basic_singleton"]
+ },
"tp5o": {
"tests": ["tp5o"],
"pagesets_name": "tp5n.zip",
"talos_options": ["--disable-e10s"]
},
"tp5o-e10s": {
"tests": ["tp5o"],
"pagesets_name": "tp5n.zip"
--- a/testing/talos/talos/test.py
+++ b/testing/talos/talos/test.py
@@ -812,16 +812,32 @@ class bloom_basic(PageloaderTest):
gecko_profile_entries = 2000000
filters = filter.ignore_first.prepare(5) + filter.median.prepare()
unit = 'ms'
lower_is_better = True
alert_threshold = 5.0
@register_test()
+class bloom_basic_singleton(PageloaderTest):
+ """
+ Stylo bloom_basic: runs bloom_basic and bloom_basic_ref and reports difference
+ """
+ tpmanifest = '${talos}/tests/perf-reftest-singletons/bloom_basic_singleton.manifest'
+ tpcycles = 1
+ tppagecycles = 25
+ gecko_profile_interval = 1
+ gecko_profile_entries = 2000000
+ filters = filter.ignore_first.prepare(5) + filter.median.prepare()
+ unit = 'ms'
+ lower_is_better = True
+ alert_threshold = 5.0
+
+
+@register_test()
class quantum_pageload_google(QuantumPageloadTest):
"""
Quantum Pageload Test - Google
"""
tpmanifest = '${talos}/tests/quantum_pageload/quantum_pageload_google.manifest'
@register_test()
new file mode 100644
--- /dev/null
+++ b/testing/talos/talos/tests/perf-reftest-singletons/bloom-basic.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script>
+ /* globals build_rule build_dom flush_style perf_start perf_finish */
+ /* eslint no-undef: "error" */
+ </script>
+ <script src="util.js"></script>
+ <script>
+window.onload = function() {
+ document.head.appendChild(build_rule("caption div, caption span", 20000, "{ color: blue; } "));
+ let dom = build_dom(5000, "div");
+
+ flush_style();
+ perf_start();
+ document.body.appendChild(dom);
+ flush_style(dom);
+ perf_finish();
+}
+ </script>
+ </head>
+ <body>
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/testing/talos/talos/tests/perf-reftest-singletons/bloom_basic_singleton.manifest
@@ -0,0 +1,1 @@
+% http://localhost/tests/perf-reftest/bloom-basic.html
new file mode 100644
--- /dev/null
+++ b/testing/talos/talos/tests/perf-reftest-singletons/util.js
@@ -0,0 +1,82 @@
+var perf_data = {
+ start: null,
+ end: null,
+}
+
+function build_dom(n, elemName, options) {
+ // By default we use different elements in the DOM to defeat the style sharing
+ // cache, otherwise this sythetic DOM is trivially stylable by engines with that
+ // optimization.
+ options = options || {};
+ var elemNameLeft = options.elemNameLeft || "div";
+ var elemNameRight = options.elemNameRight || "span";
+
+ var ours = document.createElement(elemName);
+ for (var attr in options.attributes) {
+ ours.setAttribute(attr, options.attributes[attr]);
+ }
+
+ if (n != 1) {
+ var leftSize = Math.floor(n / 2);
+ var rightSize = Math.floor((n - 1) / 2);
+ ours.appendChild(build_dom(leftSize, elemNameLeft, options));
+ if (rightSize > 0)
+ ours.appendChild(build_dom(rightSize, elemNameRight, options));
+ }
+ return ours;
+}
+
+function build_rule(selector, selectorRepeat, declaration, ruleRepeat) {
+ ruleRepeat = ruleRepeat || 1;
+ var s = document.createElement("style");
+ var rule = Array(selectorRepeat).fill(selector).join(", ") + declaration;
+ s.textContent = Array(ruleRepeat).fill(rule).join("\n\n");
+ return s;
+}
+
+function flush_style(element) {
+ getComputedStyle(element || document.documentElement).color;
+}
+
+function perf_start() {
+ if (perf_data.start !== null) {
+ throw "already started timing!";
+ }
+
+ perf_data.start = performance.now();
+}
+
+function perf_finish() {
+ var end = performance.now();
+
+ if (perf_data.start === null) {
+ throw "haven't started timing!";
+ }
+
+ if (perf_data.end !== null) {
+ throw "already finished timing!";
+ }
+
+ var start = perf_data.start;
+ perf_data.end = end;
+
+ // when running in talos report results; when running outside talos just alert
+ if (window.tpRecordTime) {
+ // Running in talos.
+ window.tpRecordTime(end - start, start);
+ } else if (window.parent && window.parent.report_perf_reftest_time) {
+ // Running in the perf-reftest runner.
+ window.parent.report_perf_reftest_time({ type: "time", value: end - start });
+ } else {
+ // Running standalone; just alert.
+ console.log(end);
+ console.log(start);
+ alert("Result: " + (end - start).toFixed(2) + " (ms)");
+ }
+}
+
+if (window.parent.report_perf_reftest_time) {
+ window.addEventListener("error", function(e) {
+ window.parent.report_perf_reftest_time({ type: "error", value: e.message });
+ });
+}