This is an archive of the discontinued LLVM Phabricator instance.

[lit] Fix discovery of GTest unit tests
AbandonedPublic

Authored by rovka on Sep 2 2016, 5:49 AM.

Details

Reviewers
ddunbar
Summary

During test discovery, we invoke each test executable with --gtest_list_tests.
For this we use subprocess.Popen, which according to the Python docs only raises
exceptions when called with invalid arguments, or when the child process raises
an exception before the new program starts to execute. If the invocation returns
a non-zero code, we silently assume that it has succeeded and there are no tests
to be discovered there.

This happens when building with BUILD_SHARED_LIBS - due to a mishap in CMake, we
set the wrong rpath for tests that live 2 directories away from unittest/. When
invoking those executables with --gtest_list_tests, they fail to find their
libraries and error out. Lit just assumes everything went well and we end up
unknowingly running fewer tests in this configuration (~1700 instead of ~1800).

We can fix this by replacing the call to subprocess.Popen with
subprocess.check_output, so we get an exception when the child process returns
with a non-zero return code.

Diff Detail

Event Timeline

rovka updated this revision to Diff 70148.Sep 2 2016, 5:49 AM
rovka retitled this revision from to [lit] Fix discovery of GTest unit tests.
rovka updated this object.
rovka added a reviewer: ddunbar.
rovka added a subscriber: llvm-commits.
rovka abandoned this revision.Sep 5 2016, 8:36 AM

Looks like this was fixed in r280455 / 280550.