This is an archive of the discontinued Mercurial Phabricator instance.

run-tests: refactor filtering logic for --retest flag
ClosedPublic

Authored by khanchi97 on Aug 22 2020, 7:05 AM.

Details

Summary

How I got to this:
While re-running failed tests using --retest I noticed that the output:
"running x tests using y parallel processes".
was not actually correct, because x was the total number of tests present
in the directory, but it should be the number of failed tests. Although
it would run only the failed tests and later will say that remaining tests
were skipped.
Changes in test files reflect the fixed behaviour.

This patch change and move the logic for filtering failed test for
--retest option and make sure that we create instances of
class Test only for the tests we need to run.

As mentioned in the deleted text (in this patch itself) the logic
for --retest should be outside of TestSuite.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

khanchi97 created this revision.Aug 22 2020, 7:05 AM
pulkit added a subscriber: pulkit.Aug 24 2020, 3:40 AM
pulkit added inline comments.
tests/run-tests.py
3249

Instead of re-implementing this test list building logic, I think we can just filter the existing tests list which we have above to check for errpath.

khanchi97 added inline comments.Aug 24 2020, 4:20 AM
tests/run-tests.py
3249

We are not re-implementing the test build logic here. If you see next line, I think we are doing what you are suggesting i.e. filtering the existing tests list.

marmoute requested changes to this revision.Aug 26 2020, 12:45 PM
marmoute added a subscriber: marmoute.
marmoute added inline comments.
tests/run-tests.py
3252

I and confuse about this line. What are we joining? Do we have any test for this case?

This revision now requires changes to proceed.Aug 26 2020, 12:45 PM
khanchi97 added inline comments.Aug 26 2020, 1:25 PM
tests/run-tests.py
3252

This is to make test name for "multiple dimensions" testcases (not much familiar with multiple dimensions though). See https://www.mercurial-scm.org/repo/hg-committed/file/tip/tests/test-run-tests.t#l959

Maybe I should consider adding a comment before this line?

marmoute added inline comments.Aug 26 2020, 2:05 PM
tests/run-tests.py
3252

I missed the fact we could have multiple "cases". You should probably document it.

And add a tes for this case with --retest

pulkit accepted this revision.Sep 2 2020, 12:29 PM
pulkit added inline comments.
tests/run-tests.py
3249

Okay, seems like I misread.

Can you follow up by adding a utility function to get errpath since we now have the same logic at couple of places (other one is ~30 lines below).

khanchi97 added inline comments.Sep 2 2020, 1:12 PM
tests/run-tests.py
3249

Sure.

pulkit accepted this revision.Sep 3 2020, 2:15 AM
This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.