Bug 1468634 - Allow running a single APZ mochitest subtest at a time. r=kats
authorBotond Ballo <botond@mozilla.com>
Sat, 16 Jun 2018 21:28:05 -0400
changeset 479539 628bd444ead118e3c634f5ec135313e76023f384
parent 479538 b42241e5b19824f1be0fd99034578c5cecfc417c
child 479541 f804cc575bba9c6dcb4e3770f7dafe4d8934e73c
child 479543 4a23e67e1d2a863f1465c6eb94d0f7c52a6eebbc
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1468634
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1468634 - Allow running a single APZ mochitest subtest at a time. r=kats This is done by passing "--setpref apz.subtest=<subtest-name>" on the mochitest command line, where <subtest-name> is the name of the subtest file (including the extension). MozReview-Commit-ID: EscFekIeOxr
gfx/layers/apz/test/mochitest/apz_test_utils.js
--- a/gfx/layers/apz/test/mochitest/apz_test_utils.js
+++ b/gfx/layers/apz/test/mochitest/apz_test_utils.js
@@ -189,16 +189,20 @@ function waitForApzFlushedRepaints(aCall
 // functions provided by SimpleTest are also mapped into the subtest's window.
 // For other things from the parent, the subtest can use window.opener.<whatever>
 // to access objects.
 function runSubtestsSeriallyInFreshWindows(aSubtests) {
   return new Promise(function(resolve, reject) {
     var testIndex = -1;
     var w = null;
 
+    // If the "apz.subtest" pref has been set, only a single subtest whose name matches
+    // the pref's value (if any) will be run.
+    var onlyOneSubtest = SpecialPowers.getCharPref("apz.subtest", /* default = */ "");
+
     function advanceSubtestExecution() {
       var test = aSubtests[testIndex];
       if (w) {
         // Run any cleanup functions registered in the subtest
         if (w.ApzCleanup) { // guard against the subtest not loading apz_test_utils.js
           w.ApzCleanup.execute();
         }
         if (typeof test.dp_suppression != 'undefined') {
@@ -221,16 +225,23 @@ function runSubtestsSeriallyInFreshWindo
 
       testIndex++;
       if (testIndex >= aSubtests.length) {
         resolve();
         return;
       }
 
       test = aSubtests[testIndex];
+
+      if (onlyOneSubtest && onlyOneSubtest != test.file) {
+        SimpleTest.ok(true, "Skipping " + test.file + " because only " + onlyOneSubtest + " is being run");
+        setTimeout(function() { advanceSubtestExecution(); }, 0);
+        return;
+      }
+
       if (typeof test.dp_suppression != 'undefined') {
         // Normally during a test, the displayport will get suppressed during page
         // load, and unsuppressed at a non-deterministic time during the test. The
         // unsuppression can trigger a repaint which interferes with the test, so
         // to avoid that we can force the displayport to be unsuppressed for the
         // entire test which is more deterministic.
         SpecialPowers.getDOMWindowUtils(window).respectDisplayPortSuppression(test.dp_suppression);
       }