This is an archive of the discontinued LLVM Phabricator instance.

Fix (benignly) incorrect GoogleTest specs in various lit configs.
Needs ReviewPublic

Authored by dlj on Jun 29 2017, 5:52 PM.

Details

Reviewers
chandlerc
Summary

The GoogleTest lit format accepts two parameters to its constructor: a subdirectory to find test binaries, and a required suffix for the test filenames. Typically, the config should look like this:

config.test_format = lit.formats.GoogleTest('.', 'Tests')

This will search the current directory for filenames ending with 'Tests', and run the matching binaries it finds as GoogleTests. It appears that several lit configs pass a different value for the subdirectory, however. They use "config.llvm_build_mode", which would be set by @LLVM_BUILD_MODE@, but never is. Fortunately, this means that the Python lookup passes and finds an empty string, which means that lit searches the current directory.

I can imagine cases where looking for a build-specific subdirectory might have worked in the paste, but I suspect it is no longer the right behaviour to check with cmake. So, I'm removing the (somewhat confusing) LLVM_BUILD_MODE logic altogether.

Event Timeline

dlj created this revision.Jun 29 2017, 5:52 PM

Hi,

I believe that this "build mode" is intended for the Visual Studio MSVC build. This build is special in that it can produce builds for multiple configurations, e.g. Debug, Release & RelWithDebInfo, within the same top level build output directory. It is this configuration type that defines the "build mode". This means that the unit tests will only pick up the configuration that matches that of the lit that was run. Without the "build mode" I believe lit might end up running all configurations of unit tests that have been built, which is probably not the intended behaviour.

Cheers,
Andrew

dlj added a comment.Jul 5 2017, 9:37 PM

Hi,

I believe that this "build mode" is intended for the Visual Studio MSVC build. This build is special in that it can produce builds for multiple configurations, e.g. Debug, Release & RelWithDebInfo, within the same top level build output directory. It is this configuration type that defines the "build mode". This means that the unit tests will only pick up the configuration that matches that of the lit that was run. Without the "build mode" I believe lit might end up running all configurations of unit tests that have been built, which is probably not the intended behaviour.

Cheers,
Andrew

Ah, excellent. I suspected something like this.

(I don't usually have access to Windows, and even then I typically use Ninja instead of VS... so cleanups like this could be hit-or-miss, I guess.)