Files
sousa-gecko/toolkit/mozapps/update/tests/data/syncManagerTestChild.js
T
André Bargull 778466fecf Bug 1800513: Reduce no-op time in syncManagerTestChild. r=bytesized,application-update-reviewers,cdupuis
This long-standing intermittent issue started to occur more frequently with
the unrelated SpiderMonkey internal patches in bug 2010219.

The test file "updateSyncManager.js" calls `TestUtils.waitForCondition` to wait
for the lock to be released. `TestUtils.waitForCondition` checks for the condition
50 times, waiting 100 ms after every failed attempt. That makes 5 seconds in total.

"syncManagerTestChild.js" also waits 5 seconds until it closes itself. The test
was relying on `TestUtils.waitForCondition` spending slightly more than 5 seconds
due to call overhead in `setTimeout`, but that may not happen in certain test
configurations, like for example when running under TSan.

Lowering the time spend in "syncManagerTestChild.js" from 5 to 3 seconds should
make it more likely that `TestUtils.waitForCondition` doesn't error out due to a
timeout.

Additionally change "updateSyncManager.js" to append the error message to the
assertion, so it's easier to see in the logs when a timeout happened.

Differential Revision: https://phabricator.services.mozilla.com/D280985
2026-02-02 09:10:53 +00:00

24 lines
917 B
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// This is the script that runs in the child xpcshell process for the test
// unit_aus_update/updateSyncManager.js.
// The main thing this script does is override the child's directory service
// so that it ends up with the same fake binary path that the parent test runner
// has opened its update lock with.
// This requires that our command line defines of the relevant helper functions
// from xpcshellUtilsAUS.js, which are:
/* global registerCustomDirProvider */
/* global resetSyncManagerLock */
print("child process is running");
registerCustomDirProvider();
resetSyncManagerLock();
// Wait a few seconds for the parent to do what it needs to do, then exit.
print("child process should now have the lock; will exit in 3 seconds");
simulateNoScriptActivity(3);
print("child process exiting now");