Open Bug 1501669 Opened 6 years ago Updated 2 years ago

Simplify command building logic

Categories

(Testing :: XPCShell Harness, enhancement, P3)

Version 3
enhancement

Tracking

(Not tracked)

People

(Reporter: ahal, Unassigned, Mentored)

Details

(Whiteboard: [lang=py])

The logic to build the xpcshell command is quite convoluted. Bug 1470914 simplified it a bit, but it should still be made a bit easier.

Currently there are multiple "build<Foo>Cmd" functions that are called and stitched together in the run_test function. We should just have a single property that does everything:

    @property
    def command(self):
        # construct the entire thing in here
        cmd = [ ... ]
        return cmd

Additionally, the logic in remotexpcshelltests.py does some strange things like deleting desktop=only arguments from the command. We should probably change this so we don't add the desktop-only arguments in the first place.
Priority: -- → P3
Whiteboard: [lang=py]

I will like to work on this issue, Can you guide me where can I start understanding this bug, I did try to read Bug 1470914 but there is no description or no comments there.

(Requesting info from :gbrown since :ahal is PTO until march)

Flags: needinfo?(whole.grains)

The desktop xpcshell harness is mostly implemented in runxpcshelltests.py. The harness runs the xpcshell binary to run each test in a separate process. The xpcshell command line is fairly complicated and varies (slightly) for different tests and harness options.

I think the focus of this bug is how self.command (the xpcshell command line) is built up here:
https://searchfox.org/mozilla-central/rev/7067bbd8194f4346ec59d77c33cd88f06763e090/testing/xpcshell/runxpcshelltests.py#760-781
Can you find a way to generate the same self.command with less code, or in a better organized way? (If you cannot, and you think there are good reasons to organize the code the way it is, that's fine too - we can probably just close this bug as WONTFIX, with an explanation.)

An important complication is that the desktop xpcshell harness is sub-classed in remotexpcshelltests.py, in order to run tests on Android. For instance, buildXpcsCmd is implemented differently for Android:
https://searchfox.org/mozilla-central/rev/7067bbd8194f4346ec59d77c33cd88f06763e090/testing/xpcshell/remotexpcshelltests.py#138-158
Structural changes to runxpcshelltests.py may require similar changes to remotexpcshelltests.py, to ensure that tests continue to work both on desktop and Android.

Flags: needinfo?(whole.grains)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.