This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Allow the use of ccache when running the test suite.
ClosedPublic

Authored by EricWF on Dec 12 2014, 8:16 PM.

Details

Summary

In order to get the bots running quicker I would like to be able to use ccache
with the test suite. This patch adds support for running the test suite using
ccache. To use ccache pass --param=use_ccache=true when running the test suite.

ccache will not cache any command that invokes ld, so the build step needs to be
split into two separate compile commands. The cost of splitting the build step
into two parts when not using ccache seems to be minimal. On my machine I saw a
difference of ~5 seconds on a 5 minute test suite run.

A full test suite run with ccache generates about 250MB of cached data.

I recorded the following times for running the test suite in the following configurations:

  • no ccache: 340s
  • initial ccache run: 380s
  • rerun with ccache (no changes): 53s.
  • rerun with ccache (<string> changed): 80s
  • rerun with ccache (<cmath> changed): 169s
  • rerun with ccache (<valarray> changed): 69s

Diff Detail

Event Timeline

EricWF updated this revision to Diff 17251.Dec 12 2014, 8:16 PM
EricWF retitled this revision from to [libcxx] Allow the use of ccache when running the test suite..
EricWF updated this object.
EricWF edited the test plan for this revision. (Show Details)
EricWF added reviewers: mclow.lists, danalbert, jroelofs.
EricWF added a subscriber: Unknown Object (MLST).
jroelofs accepted this revision.Dec 13 2014, 9:48 AM
jroelofs edited edge metadata.

If the compiler changes on every iteration of the buildbot, how will ccache make that faster?

Also, ccache makes me a bit uncomfortable in a buildbot kind of environment. It's great for development, but it definitely adds one more area for build hysteresis. Perhaps we ought to have nightly (or whatever appropriate frequency) clean builds in addition to such a ccache bot.

All of that being said, this is awesome. LGTM.

test/lit.cfg
122

it'd be nice if this named temporary had something in common with the test file name.

This revision is now accepted and ready to land.Dec 13 2014, 9:48 AM
danalbert edited edge metadata.Dec 15 2014, 11:44 AM

Couldn't you just set cxx_under_test to 'ccache clang++' and be done with it? Using ccache in build bots where the compiler goes through regular updates feels fragile to me...

As for splitting into separate build/link commands, that's how I have to do it in Android anyway, so that part is good with me :)

If the compiler changes on every iteration of the buildbot, how will ccache make that faster?

The compiler doesn't change every iteration for the most part. On my buildbots I try and update the compiler once a week or so.

Also, ccache makes me a bit uncomfortable in a buildbot kind of environment. It's great for development, but it definitely adds one more area for build hysteresis. Perhaps we ought to have nightly (or whatever appropriate frequency) clean builds in addition to such a ccache bot.

Very good point. As I understand it, this should only matter when the compiler changes. I'll make sure to clear the cache entirely when updating the compilers.

Couldn't you just set cxx_under_test to 'ccache clang++' and be done with it?

As it currently stands that wouldn't work. cxx_under_test is expected to be a single token.

I understand concerns about this setup being fragile. However I would still like to try it out on my bots for the time being. There are a number of extra configurations I would like to run and currently I don't have the resources to do it. My OSX builder takes 30-45 minutes per run. It would be nice to get this down.

Couldn't you just set cxx_under_test to 'ccache clang++' and be done with it?

As it currently stands that wouldn't work. cxx_under_test is expected to be a single token.

That should be an easy fix though, right?

Couldn't you just set cxx_under_test to 'ccache clang++' and be done with it?

As it currently stands that wouldn't work. cxx_under_test is expected to be a single token.

That should be an easy fix though, right?

Not really. Doing so means we can't use lit.util.which('ccache clang++'). I currently use the compiler path to try and find the llvm-symbolizer binary.

EricWF closed this revision.Dec 19 2014, 11:28 AM