From eae170db2a6f0461cfe2f55b84ae4e89bd719a74 Mon Sep 17 00:00:00 2001 From: Matthias Gierlings Date: Tue, 10 Apr 2018 22:10:37 +0200 Subject: Codecov - cover MT code in XMSS_PrivateKey Codecov does not reach all parts of the `XMSS_PrivateKey` code because too few cores are detected during the CI run. To cover the missed codepaths always return a large enough core count if botan is compiled with coverage. --- configure.py | 2 ++ src/build-data/buildh.in | 4 ++++ src/lib/pubkey/xmss/xmss_tools.cpp | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/configure.py b/configure.py index 26a5ba8a2..bf4cf1365 100755 --- a/configure.py +++ b/configure.py @@ -1857,6 +1857,8 @@ def create_template_vars(source_paths, build_paths, options, modules, cc, arch, 'build_fuzzers': options.build_fuzzers, + 'build_coverage' : options.with_coverage_info or options.with_coverage, + 'symlink_shared_lib': options.build_shared_lib and shared_lib_uses_symlinks(), 'libobj_dir': build_paths.libobj_dir, diff --git a/src/build-data/buildh.in b/src/build-data/buildh.in index 807b6f479..594eab9c8 100644 --- a/src/build-data/buildh.in +++ b/src/build-data/buildh.in @@ -56,6 +56,10 @@ #define BOTAN_HAS_SANITIZER_%{i|upper} %{endfor} +%{if build_coverage} +#define BOTAN_HAS_COVERAGE +%{endif} + #define BOTAN_TARGET_ARCH_IS_%{arch|upper} %{if endian} #define BOTAN_TARGET_CPU_IS_%{endian|upper}_ENDIAN diff --git a/src/lib/pubkey/xmss/xmss_tools.cpp b/src/lib/pubkey/xmss/xmss_tools.cpp index f4f762aeb..3297664fb 100644 --- a/src/lib/pubkey/xmss/xmss_tools.cpp +++ b/src/lib/pubkey/xmss/xmss_tools.cpp @@ -66,11 +66,19 @@ size_t XMSS_Tools::bench_threads() if(durations[0].count() < durations[1].count()) { +#if defined(BOTAN_HAS_COVERAGE) + return 4; +#else return concurrency[0]; +#endif } else { +#if defined(BOTAN_HAS_COVERAGE) + return 4; +#else return concurrency[1]; +#endif } } -- cgit v1.2.3