Can we do away with do_get_profile and Services.fog.initializeFOG in xpcshell?
Categories
(Toolkit :: Telemetry, task, P4)
Tracking
()
People
(Reporter: chutten, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [telemetry:fog:m?])
It sucks that FOG instrumentation tests all need the same front matter:
// FOG needs a profile directory to store its info.
do_get_profile();
// FOG needs to be initialized exactly once.
Services.fog.initializeFOG();
Is there anything we can do about this?
An idea: the only part of do_get_profile() that FOG needs is ProfD. Maybe we can do that part cheaply before every test file in head.js? Like maybe here? And then, thereafter, is initializeFOG cheap enough for us to run unconditionally? Is there a mode of initialization we could run unconditionally?
If not, is there a clever JS thing we could do to intercept test methods and ensure FOG is init the first time they're called?
Maybe we can make this nice.
| Reporter | ||
Updated•7 months ago
|
Comment 1•5 months ago
•
|
||
Can we make testGetValue (and/or other similar methods) throw if initializeFOG was never called and/or there's no ProfD?
| Reporter | ||
Comment 2•5 months ago
|
||
(In reply to :Gijs (he/him) from comment #1)
Can we make
testGetValue(and/or other similar methods) throw ifinitializeFOGwas never called and/or there's noProfD?
Yes, but we'd have to write a lot of copy-pasta to make it happen and it's very possible that new metric types would forget to check. I'd prefer to have do_get_profile(); Services.fog.initializeFOG(); unconditionally run on xpcshell tests if possible, because that would be the easier-to-maintain and more ergonomic result.
Description
•