Add an option in mach to run mochitests test files packaged in a jar

RESOLVED DUPLICATE of bug 939719

Status

defect
RESOLVED DUPLICATE of bug 939719
6 years ago
a year ago

People

(Reporter: ochameau, Assigned: ochameau)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Assignee)

Description

6 years ago
Currently, it is quite challenging to run mochitest in the same way TBPL does. It would be really handy to be able to replicate the exact same behavior TBPL has. Running tests in a jar is one significant difference.

Based on some feedback on #ateam, adding --packaged option to mach mochitest sounds like a good way to offer this.
(Assignee)

Updated

6 years ago
Attachment #816488 - Flags: review?(ted)
Attachment #816488 - Flags: feedback?(jmaher)
Comment on attachment 816488 [details] [diff] [review]
Adds --packaged option for mach mochitest to run tests in a jar

Review of attachment 816488 [details] [diff] [review]:
-----------------------------------------------------------------

My only general feedback is to rename the comments to be packaged instead of tests.jar.  Ted is on PTO today, so give him a day or so for the review.

::: testing/mochitest/mach_commands.py
@@ +233,5 @@
> +                                              "test-package-stage", "mochitest")
> +            # We have to remove mozinfo.json file that confuses mozbuild/base.py
> +            # introducing two different obj dirs
> +            try:
> +              os.remove(os.path.join(self.mochitest_dir, "mozinfo.json"))

does this have any side effects on future 'mach mochitest' runs without the packaged flag?

@@ +426,5 @@
>              'executed.')
>      func = path(func)
>  
> +    packaged = CommandArgument('--packaged', action='store_true',
> +        help='Runs mochitests with tests files being packaged in a jar.')

I would reference this as run tests from a tests.zip package as we do in buildbot automation.

while you are trying to solve running tests from tests.jar, this actually solves a lot of other problems, specifically the issue of running outside of the build tree!
Attachment #816488 - Flags: feedback?(jmaher) → feedback+
(Assignee)

Comment 4

6 years ago
(In reply to Joel Maher (:jmaher) from comment #3)
> Comment on attachment 816488 [details] [diff] [review]
> ::: testing/mochitest/mach_commands.py
> @@ +233,5 @@
> > +                                              "test-package-stage", "mochitest")
> > +            # We have to remove mozinfo.json file that confuses mozbuild/base.py
> > +            # introducing two different obj dirs
> > +            try:
> > +              os.remove(os.path.join(self.mochitest_dir, "mozinfo.json"))
> 
> does this have any side effects on future 'mach mochitest' runs without the
> packaged flag?

I don't think so. mochitest_dir refers to the test-pagckage-stage directory, that, if I understand things correctly, should only be used when we run this packaged mode.
Comment on attachment 816488 [details] [diff] [review]
Adds --packaged option for mach mochitest to run tests in a jar

Review of attachment 816488 [details] [diff] [review]:
-----------------------------------------------------------------

::: testing/mochitest/mach_commands.py
@@ +231,5 @@
> +            # as it will look for tests.jar next to runtests.py file
> +            self.mochitest_dir = os.path.join(self.topobjdir, "dist",
> +                                              "test-package-stage", "mochitest")
> +            # We have to remove mozinfo.json file that confuses mozbuild/base.py
> +            # introducing two different obj dirs

This is unfortunate. We could work around this by fixing the harness to do the right thing here and passing down the mozbuild bits from the mach level, but it's probably a lot more work.

@@ +235,5 @@
> +            # introducing two different obj dirs
> +            try:
> +              os.remove(os.path.join(self.mochitest_dir, "mozinfo.json"))
> +            except:
> +              ()

"pass" is what you're looking for here.
Attachment #816488 - Flags: review?(ted) → review+
n.b.: you and bug 895471 are going to race touching this file.

Comment 7

6 years ago
I landed already, so I unbitrotted this. I didn't address review feedback, though. :-)

Updated

6 years ago
Assignee: poirot.alex → gijskruitbosch+bugs
Status: NEW → ASSIGNED

Comment 8

6 years ago
One of these days, I'll not forget to tell bzexport --no-take-bug.
Assignee: gijskruitbosch+bugs → poirot.alex
I had disabled the creation of tests.jar a few months ago to solve another bug.  Is this still an issue?  If not, we should close it.
Flags: needinfo?(poirot.alex)
(Assignee)

Comment 10

5 years ago
Oh really then that's even better!
So we no longer run tests with this special mode on tbpl?
If that's the case, yes, we can close this bug and forget about the packaged mode!!
Flags: needinfo?(poirot.alex)
this was fixed by bug 939719
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 939719
Component: Mochitest Chrome → Mochitest
Product: Testing → Testing
You need to log in before you can comment on or make changes to this bug.