summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorRichard Samuels <richard.l.samuels@gmail.com>2022-02-14 15:54:50 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-02-14 16:39:56 +0000
commitc7bfbfeefcce9c73997e61d19c5efd7d57cf8971 (patch)
treeedb4bd431a089d1db31dc1c1556bb27a7dc8b5cc /SConstruct
parentbabeb73f150a771624480aaae40e2f1fbaba66ae (diff)
downloadmongo-c7bfbfeefcce9c73997e61d19c5efd7d57cf8971.tar.gz
SERVER-60832 Readd and fix gcov code coverage variant
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct13
1 files changed, 10 insertions, 3 deletions
diff --git a/SConstruct b/SConstruct
index 446b3dea8e0..150ae43b4b5 100644
--- a/SConstruct
+++ b/SConstruct
@@ -2515,10 +2515,14 @@ if env.TargetOSIs('posix'):
if has_option( "gcov" ):
if not (env.TargetOSIs('linux') and env.ToolchainIs('gcc')):
# TODO: This should become supported under: https://jira.mongodb.org/browse/SERVER-49877
- env.FatalError("Coverage option 'gcov' is currently only supported on linux with gcc. See SERVER-49877.")
+ # TODO SERVER-63055: clang is not supported due to consistent
+ # failures in ValidateCollections when using gcov.
+ env.FatalError("Coverage option 'gcov' is currently only supported on linux with gcc. See SERVER-49877 and SERVER-63055.")
- env.Append( CCFLAGS=["-fprofile-arcs", "-ftest-coverage", "-fprofile-update=single"] )
- env.Append( LINKFLAGS=["-fprofile-arcs", "-ftest-coverage", "-fprofile-update=single"] )
+ env.AppendUnique(
+ CCFLAGS=['--coverage'],
+ LINKFLAGS=['--coverage'],
+ )
if optBuild and not optBuildForSize:
env.Append( CCFLAGS=["-O3" if "O3" in selected_experimental_optimizations else "-O2"] )
@@ -2936,6 +2940,9 @@ def doConfigure(myenv):
if not AddToLINKFLAGSIfSupported(myenv, f'-fuse-ld={linker_ld}'):
myenv.FatalError(f"Linker {linker_ld} could not be configured.")
+ if has_option('gcov') and AddToCCFLAGSIfSupported(myenv, '-fprofile-update=single'):
+ myenv.AppendUnique(LINKFLAGS=['-fprofile-update=single'])
+
detectCompiler = Configure(myenv, help=False, custom_tests = {
'CheckForCXXLink': CheckForCXXLink,
})