This is an archive of the discontinued LLVM Phabricator instance.

[lld] Make tests calling llvm-ar more robust
ClosedPublic

Authored by chrisjackson on Jul 11 2018, 7:02 AM.

Details

Summary

Some lit tests that call llvm-ar use the 'r' flag. If the target archive already
exists and is in a corrupt state, this can cause the test to fail. We have
added 'rm -f archive' calls before the llvm-ar calls to increase the robustness
of the tests.

A similar fix for one test was added in revision r336366.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

chrisjackson created this revision.Jul 11 2018, 7:02 AM

Perhaps you could make the arguments to ar consistent while you are there? Seems like rsc would make sense is every case. Otherwise lgtm. Its really shame that ar can't delete the file itself :(

chrisjackson added a comment.EditedJul 12 2018, 4:58 AM

@sbc100
I agree it would be nice to have an option for llvm-ar to start the archive anew.
I'm not sure about changing all the flag settings as you suggest though. I don't want to enforce a standard or accidentally change the way any of the tests work.
Perhaps standardisation of flags could be a different revision.

Sure, that can be followup change.

ruiu accepted this revision.Jul 12 2018, 2:25 PM

LGTM

This revision is now accepted and ready to land.Jul 12 2018, 2:25 PM
This revision was automatically updated to reflect the committed changes.
This revision was automatically updated to reflect the committed changes.