Closed Bug 1723536 Opened 3 years ago Closed 3 years ago

objdir/temp/user.js generated by XPCShellTests' buildPrefsFile expands on every test run

Categories

(Testing :: XPCShell Harness, defect)

Default
defect

Tracking

(firefox93 fixed)

RESOLVED FIXED
93 Branch
Tracking Status
firefox93 --- fixed

People

(Reporter: robwu, Assigned: robwu)

References

Details

Attachments

(1 file)

The xpcshell test runner creates a user.js file at https://searchfox.org/mozilla-central/rev/4b88e0b8cca115009e82fdd65e5bf5812ff99128/testing/xpcshell/runxpcshelltests.py#1122-1159. The tempDir referenced there is not a temporary directory, but a fixed one at objdir/temp/ (set by the mach command runner).

This buildPrefsFile logic relies on profile.merge, which appends prefs to an existing user.js file if any. At every test run (./mach test path/to/xpcshell/test.js), this file becomes increasingly larger (the directory is not cleaned up in this case).

Within the same checkout of the tree, any existing prefs are effectively overwritten because the last value takes precedence. But if a pref is removed from the testing/profiles/xpcshell/user.js file (e.g. after updating the tree), then a test run with the non-clobbered object directory can result in an unexpected test failure if the pref did anything significant.

To avoid that issue, we should empty that user.js file before re-generating it.
A side effect of that change is that devs cannot manually add prefs to objdir/temp/user.js. But for them the alternative would be to use the --pref flag of mach (or prefs = in test manifests), so I think that such a change would be fine.

Working on it as part of bug 1723198.

In remote xpcshell tests, the file is currently removed at the end of a test run. The fix for bug 1723198 causes the file to be kept, which triggers this bug.

Assignee: nobody → rob
Status: NEW → ASSIGNED
See Also: → 1723198
Pushed by rob@robwu.nl: https://hg.mozilla.org/integration/autoland/rev/15c67fd83308 Clear generated user.js before start of xpcshell test r=jmaher

Backed out 2 changesets (Bug 1723198, Bug 1723536) for causing xpcshell failures in test_SocketScalars.js and test_ext_cookieBehaviors.js
Backout link: https://hg.mozilla.org/integration/autoland/rev/5d3b6ace0a3b0a38f16f92688998e1d0f55ea3cb
Push with failures, failure log:

Pushed by rob@robwu.nl: https://hg.mozilla.org/integration/autoland/rev/47c08d2c33f4 Clear generated user.js before start of xpcshell test r=jmaher

Backed out for causing xpcshell failures on test_SocketScalars.js.

Push with failures

Failure log

Backout link

Flags: needinfo?(rob)

Handled in bug 1723198

Flags: needinfo?(rob)
Depends on: 1716307
Pushed by rob@robwu.nl: https://hg.mozilla.org/integration/autoland/rev/11c7bc6d58ee Clear generated user.js before start of xpcshell test r=jmaher
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 93 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: