This is an archive of the discontinued LLVM Phabricator instance.

[lldb][NFC] Add more tests for GenerateOptionsUsage
ClosedPublic

Authored by DavidSpickett on Apr 11 2022, 6:01 AM.

Details

Summary

This adds a few targeted tests to make sure that when refactoring
this function later I don't break these properties.

Some are tested in passing elsewhere but this makes it more
obvious what went wrong when it fails.

This doesn't cover everything the function does, I couldn't
find any examples that would exercise some of the code.

Diff Detail

Event Timeline

DavidSpickett created this revision.Apr 11 2022, 6:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 11 2022, 6:01 AM
DavidSpickett requested review of this revision.Apr 11 2022, 6:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 11 2022, 6:01 AM
DavidSpickett added a subscriber: jingham.

@jingham You suggested I take a look at this function after I did a small fix a while back so adding you on review for this and the following changes.

I realised that in theory the tests could still pass if your ordering
just happend to land in the right way.

For the short option [-ABCabc] there's not a lot I can do about that,
so I added another check for a different command. More chance to catch
non-determinism. I don't think any commands have enough options to make
it 100% sure.

For the detailed options I switched from a regex to cutting up the
output with python. Then once we've got all the short names we can
check the whole order.

(and I checked, when it fails you do get a list specific comparison output)

jingham accepted this revision.Apr 29 2022, 10:29 AM

Ah, tests for help that I asked for in another review... Excellent.

This revision is now accepted and ready to land.Apr 29 2022, 10:29 AM
This revision was automatically updated to reflect the committed changes.