Closed Bug 1723536 Opened 2 years ago Closed 2 years ago

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


(Testing :: XPCShell Harness, defect)



(firefox93 fixed)

93 Branch
Tracking Status
firefox93 --- fixed


(Reporter: robwu, Assigned: robwu)




(1 file)

The xpcshell test runner creates a user.js file at 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
See Also: → 1723198
Pushed by
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:
Push with failures, failure log:

Pushed by
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
Clear generated user.js before start of xpcshell test r=jmaher
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 93 Branch
You need to log in before you can comment on or make changes to this bug.