Added code coverate support to Godot

This commit is contained in:
Rafał Mikrut 2020-02-26 19:43:03 +01:00 committed by Relintai
parent 51ecd46a06
commit baa1442c58
2 changed files with 10 additions and 0 deletions

View File

@ -35,6 +35,7 @@ def get_opts():
EnumVariable("linker", "Linker program", "default", ("default", "bfd", "gold", "lld", "mold")), EnumVariable("linker", "Linker program", "default", ("default", "bfd", "gold", "lld", "mold")),
BoolVariable("use_llvm", "Use the LLVM compiler", False), BoolVariable("use_llvm", "Use the LLVM compiler", False),
BoolVariable("use_static_cpp", "Link libgcc and libstdc++ statically for better portability", True), BoolVariable("use_static_cpp", "Link libgcc and libstdc++ statically for better portability", True),
BoolVariable('use_coverage', 'Test Pandemonium coverage', False),
BoolVariable("use_ubsan", "Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)", 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_asan", "Use LLVM/GCC compiler address sanitizer (ASAN))", False),
BoolVariable("use_lsan", "Use LLVM/GCC compiler leak sanitizer (LSAN))", False), BoolVariable("use_lsan", "Use LLVM/GCC compiler leak sanitizer (LSAN))", False),
@ -126,6 +127,10 @@ def configure(env):
else: else:
env.Append(LINKFLAGS=["-fuse-ld=%s" % env["linker"]]) env.Append(LINKFLAGS=["-fuse-ld=%s" % env["linker"]])
if env['use_coverage']:
env.Append(CCFLAGS=['-ftest-coverage', '-fprofile-arcs'])
env.Append(LINKFLAGS=['-ftest-coverage', '-fprofile-arcs'])
# Sanitizers # Sanitizers
if env["use_ubsan"] or env["use_asan"] or env["use_lsan"] or env["use_tsan"] or env["use_msan"]: if env["use_ubsan"] or env["use_asan"] or env["use_lsan"] or env["use_tsan"] or env["use_msan"]:
env.extra_suffix += "s" env.extra_suffix += "s"

View File

@ -67,6 +67,7 @@ def get_opts():
EnumVariable("linker", "Linker program", "default", ("default", "bfd", "gold", "lld", "mold")), EnumVariable("linker", "Linker program", "default", ("default", "bfd", "gold", "lld", "mold")),
BoolVariable("use_llvm", "Use the LLVM compiler", False), BoolVariable("use_llvm", "Use the LLVM compiler", False),
BoolVariable("use_static_cpp", "Link libgcc and libstdc++ statically for better portability", True), BoolVariable("use_static_cpp", "Link libgcc and libstdc++ statically for better portability", True),
BoolVariable('use_coverage', 'Test Pandemonium coverage', False),
BoolVariable("use_ubsan", "Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)", 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_asan", "Use LLVM/GCC compiler address sanitizer (ASAN))", False),
BoolVariable("use_lsan", "Use LLVM/GCC compiler leak sanitizer (LSAN))", False), BoolVariable("use_lsan", "Use LLVM/GCC compiler leak sanitizer (LSAN))", False),
@ -170,6 +171,10 @@ def configure(env):
else: else:
env.Append(LINKFLAGS=["-fuse-ld=%s" % env["linker"]]) env.Append(LINKFLAGS=["-fuse-ld=%s" % env["linker"]])
if env['use_coverage']:
env.Append(CCFLAGS=['-ftest-coverage', '-fprofile-arcs'])
env.Append(LINKFLAGS=['-ftest-coverage', '-fprofile-arcs'])
# Sanitizers # Sanitizers
if env["use_ubsan"] or env["use_asan"] or env["use_lsan"] or env["use_tsan"] or env["use_msan"]: if env["use_ubsan"] or env["use_asan"] or env["use_lsan"] or env["use_tsan"] or env["use_msan"]:
env.extra_suffix += "s" env.extra_suffix += "s"