This is an archive of the discontinued LLVM Phabricator instance.

[test-suite] Enable MicroBenchmarks by default
ClosedPublic

Authored by homerdin on Apr 30 2018, 7:49 AM.

Diff Detail

Event Timeline

homerdin created this revision.Apr 30 2018, 7:49 AM
MatzeB accepted this revision.May 18 2018, 3:24 PM

LGTM. Please watch the buildbots carefully (and revert in case of problems) when you push this.

This revision is now accepted and ready to land.May 18 2018, 3:24 PM
This revision was automatically updated to reflect the committed changes.

The cmake system in the benchmark library uses cmake's try_run if CMAKE_CROSSCOMPILING is not set. It looks like this is what was causing the failures (trying to run something it cannot). The documentation for cross-compiling clang/llvm using clang/llvm lists -DCMAKE_CROSSCOMPILING=True as a needed cmake option. I'm not sure if we would want the same for the test suite. Ideally we would automatically set the variable when cross compiling. I have not been able to reproduce the issue so I'm not certain if this is the cause. Is anyone familiar with cmake and cross compilation?

CMake Error at MicroBenchmarks/libs/benchmark-1.3.0/CMakeLists.txt:181 (message):
  Failed to determine the source files for the regular expression backend

Cross compiling currently is a mess. Basically cmake only works properly when you have a complete gcc style cross toolchain, or a MacOS style toolchain on Mac. Most llvm developers currently are not in a position to set one of those two things up when they just want to test a compiler they made some changes to; to be honest when I started hacking on the llvm test-suite cmake I wasn't even aware of what assumptions are made there/what problem exist...

So today we circumvent some of the cmake conventions. That said try_run tests are just lazy and will somewhat fall short in cross compilation setting sanyway. How about forcing the googletest cmake to use C++11 and always use std::regex?

homerdin updated this revision to Diff 148101.May 22 2018, 2:25 PM
homerdin added reviewers: dberris, eizan.

I've added some definitions to the MicroBenchmarks/libs/CMakeLists.txt. Keeping these out of the benchmark library CMakeLists.txt will prevent having to make custom changes whenever the benchmark library is upgraded. I am not currently setup to test this while cross compiling. The try_run's should still compile but fail to build, but with the HAVE_STD_REGEX this will not be a fatal error.

Adding dberris and Eizan as reviewers.

homerdin reopened this revision.May 22 2018, 2:26 PM
This revision is now accepted and ready to land.May 22 2018, 2:26 PM
MatzeB accepted this revision.May 22 2018, 2:28 PM

LGTM

This revision was automatically updated to reflect the committed changes.
homerdin updated this revision to Diff 148901.May 29 2018, 7:06 AM

Added a definition that will prevent the benchmark library from building cxx03_test which will fail when using c++11.