summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-02-27 14:13:23 +0100
committerGitHub <noreply@github.com>2020-02-27 14:13:23 +0100
commit2ceaa6a09666c6d789930a2d95ea0e047cfeb327 (patch)
treec5501cffa45153073424a67f6a6eacac11d08fa2
parentc1abfd437ec89741cc975ab91bd2b55dbb8ae2f4 (diff)
parentb2b0210d66af700f6b9cc6c94e82fa876a7a1883 (diff)
Merge pull request #36572 from qarmin/coverage
Added code coverage support to Godot
-rw-r--r--platform/server/detect.py4
-rw-r--r--platform/x11/detect.py5
2 files changed, 9 insertions, 0 deletions
diff --git a/platform/server/detect.py b/platform/server/detect.py
index d82df77957..ef94dc436c 100644
--- a/platform/server/detect.py
+++ b/platform/server/detect.py
@@ -32,6 +32,7 @@ def get_opts():
return [
BoolVariable('use_llvm', 'Use the LLVM compiler', False),
BoolVariable('use_static_cpp', 'Link libgcc and libstdc++ statically for better portability', False),
+ BoolVariable('use_coverage', 'Test Godot coverage', False),
BoolVariable('use_ubsan', 'Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)', False),
BoolVariable('use_asan', 'Use LLVM/GCC compiler address sanitizer (ASAN))', False),
BoolVariable('use_lsan', 'Use LLVM/GCC compiler leak sanitizer (LSAN))', False),
@@ -99,6 +100,9 @@ def configure(env):
env.Append(CPPDEFINES=['TYPED_METHOD_BIND'])
env.extra_suffix = ".llvm" + env.extra_suffix
+ if env['use_coverage']:
+ env.Append(CCFLAGS=['-ftest-coverage', '-fprofile-arcs'])
+ env.Append(LINKFLAGS=['-ftest-coverage', '-fprofile-arcs'])
if env['use_ubsan'] or env['use_asan'] or env['use_lsan'] or env['use_tsan']:
env.extra_suffix += "s"
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index b5b7895da9..cd22ee9ff6 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -61,6 +61,7 @@ def get_opts():
BoolVariable('use_lld', 'Use the LLD linker', False),
BoolVariable('use_thinlto', 'Use ThinLTO', False),
BoolVariable('use_static_cpp', 'Link libgcc and libstdc++ statically for better portability', False),
+ BoolVariable('use_coverage', 'Test Godot coverage', False),
BoolVariable('use_ubsan', 'Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)', False),
BoolVariable('use_asan', 'Use LLVM/GCC compiler address sanitizer (ASAN))', False),
BoolVariable('use_lsan', 'Use LLVM/GCC compiler leak sanitizer (LSAN))', False),
@@ -141,6 +142,10 @@ def configure(env):
print("Using LLD with GCC is not supported yet, try compiling with 'use_llvm=yes'.")
sys.exit(255)
+ if env['use_coverage']:
+ env.Append(CCFLAGS=['-ftest-coverage', '-fprofile-arcs'])
+ env.Append(LINKFLAGS=['-ftest-coverage', '-fprofile-arcs'])
+
if env['use_ubsan'] or env['use_asan'] or env['use_lsan'] or env['use_tsan']:
env.extra_suffix += "s"