This is an archive of the discontinued Mercurial Phabricator instance.

test-rebase: add a brute force test
ClosedPublic

Authored by quark on Aug 7 2017, 12:11 PM.

Details

Summary

Rebase is becoming more complex and it looks like a good idea to try some
brute force enumeration to cover cases that are hard to find manually.

Using brute force to generate repos in different shapes and enumerating the
rebase source and destination would generate too many cases that takes too
long to compute. This patch limits the "brute force" to only the "rebase
source" part. Repo and destination are still manual.

The added test cases are crafted manually to reveal some behaviors that are
not covered by other tests:

  • "revlog index out of range" crash
  • after rebase, p1 == p2, p2 != null
  • "nothing to merge" abort

In the future we might want to add more tests here. For now I'm more
interested in revealing interesting behaviors in a minified way. I tried
some more complex cases but didn't find other interesting behaviors.

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

quark created this revision.Aug 7 2017, 12:11 PM

Thanks for the patch, more testing is always good.

I'm wondering if we could use hypothesis (https://github.com/HypothesisWorks/hypothesis-python) for more tests like that. One article I found interesting was: http://hypothesis.works/articles/rule-based-stateful-testing/

quark added a comment.Aug 7 2017, 1:07 PM

While I think hypothesis might be somehow useful. It is to generate random test cases, which is different from the efficient brute force here.

This revision was automatically updated to reflect the committed changes.