[libcxx] Add code coverage configuration to CMake and LIT.
Summary: This patch adds configuration to CMake and LIT for running the libc++ test-suite to generate code coverage. To use code coverage use following instructions. * Find the clang resource dir using `$CXX -print-search-dirs`. Let <library-dir> be the first library search directory. * `cmake <regular-options> -DLIBCXX_GENERATE_COVERAGE=ON -DLIBCXX_COVERAGE_LIBRARY=<library-dir>/lib/<platform>/libclang_rt.profile.a <source>` * `make cxx` * `make check-libcxx` * `make generate-libcxx-coverage` The reason I want this patch upstreamed is so I can setup a bot that generates code coverage and posts in online for every revision. Reviewers: mclow.lists, jroelofs, danalbert Reviewed By: danalbert Differential Revision: http://reviews.llvm.org/D8716 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@233669 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -98,6 +98,7 @@ class Configuration(object):
|
||||
self.configure_debug_mode()
|
||||
self.configure_warnings()
|
||||
self.configure_sanitizer()
|
||||
self.configure_coverage()
|
||||
self.configure_substitutions()
|
||||
self.configure_features()
|
||||
|
||||
@@ -594,6 +595,12 @@ class Configuration(object):
|
||||
self.lit_config.fatal('unsupported value for '
|
||||
'use_sanitizer: {0}'.format(san))
|
||||
|
||||
def configure_coverage(self):
|
||||
self.generate_coverage = self.get_lit_bool('generate_coverage', False)
|
||||
if self.generate_coverage:
|
||||
self.cxx.flags += ['-g', '--coverage']
|
||||
self.cxx.compile_flags += ['-O0']
|
||||
|
||||
def configure_substitutions(self):
|
||||
sub = self.config.substitutions
|
||||
# Configure compiler substitions
|
||||
|
Reference in New Issue
Block a user