This is an archive of the discontinued LLVM Phabricator instance.

[LNT] Get cc info from CMake cache instead of from command-line
ClosedPublic

Authored by kristof.beyls on Feb 10 2017, 4:55 AM.

Details

Summary

There are multiple ways to specify the compiler to use, such as:

  • Using the --cc command line option.
  • Using the --cmake-cache command line option.
  • Using a --cmake-define=CMAKE_C_COMPILER=xxx command line option.
  • ...

Nonetheless, in the report.json file, the compiler pointed to by the
--cc command line option is reported, irrespective of the compiler
actually used by cmake during compilation.

This patch fixes that by getting the compiler used from the
CMakeCache.txt file rather than from the --cc command line option.

Diff Detail

Repository
rL LLVM

Event Timeline

kristof.beyls created this revision.Feb 10 2017, 4:55 AM
MatzeB accepted this revision.Feb 10 2017, 11:01 AM

LGTM, comments below

lnt/tests/test_suite.py
588 ↗(On Diff #87984)

Wouldn't it make more sense to keep check_call and add check_output as an additional function? The check_output() write() idiom won't output anything until the command is finished and will probably show all of stderr before stdout instead of intermixing them.

645–647 ↗(On Diff #87984)

It feels a bit odd that the 2nd loop is nearly a duplication of the first one, just that it isn't... How about:

  • Adding default=[] for the cmake_defines add_option() call.
  • Merging the two loops: for item in self.opts.cmake_defines + extra_cmake_defs: ...
This revision is now accepted and ready to land.Feb 10 2017, 11:01 AM
cmatthews accepted this revision.Feb 10 2017, 12:28 PM

LGTM. Thanks Kristof!

lnt/tests/test_suite.py
583 ↗(On Diff #87984)

I am not a big fan of using check_output for anything but the simplest uses. In this case we can't do anything with the output until the command finishes running, and the stderr is not interleaved with the output. And when it fails we give the user a nice exception as an error message.

Our ci scripts in zorg have a much nicer implementation, they print a shell like version of the command that you can paste in your own terminal, stream all the outputs and give real error messages. I will probably try and put them in here some day. Until then, you have not made this worse :)

800 ↗(On Diff #87984)

Would match work here? I think these all end up on the start of line.

This revision was automatically updated to reflect the committed changes.
kristof.beyls marked 3 inline comments as done.Feb 14 2017, 2:00 AM

Thanks for all the feedback! I've adapted the patch accordingly and committed in r295039.