From c6524abc3947d684873d11d84b2e99cb62fc6802 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 8 Feb 2018 21:35:55 +0100 Subject: [PATCH] CI: also generate coverage for unit tests sanitycheck: Compile unit tests with coverage enabled always + run also first unit tests together with native_posix shippable: also include unit_testing coverage into report to codecov Signed-off-by: Alberto Escolar Piedras --- .shippable.yml | 4 ++-- scripts/sanitycheck | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.shippable.yml b/.shippable.yml index 7e8b1ee8d1a..ea53b2f04de 100644 --- a/.shippable.yml +++ b/.shippable.yml @@ -78,7 +78,7 @@ build: - > if [ "$MATRIX_BUILD" = "1" ]; then gcovr -r ${ZEPHYR_BASE} -x > shippable/codecoverage/coverage.xml; - lcov --capture --directory sanity-out/native_posix/ --output-file lcov.pre.info -q --rc lcov_branch_coverage=1; + lcov --capture --directory sanity-out/native_posix/ --directory sanity-out/unit_testing/ --output-file lcov.pre.info -q --rc lcov_branch_coverage=1; lcov -q --remove lcov.pre.info *generated* -o lcov.info --rc lcov_branch_coverage=1; rm lcov.pre.info; rm -rf sanity-out out-2nd-pass; @@ -103,7 +103,7 @@ build: - > if [ "$MATRIX_BUILD" = "1" ]; then gcovr -r ${ZEPHYR_BASE} -x > shippable/codecoverage/coverage.xml; - lcov --capture --directory sanity-out/native_posix/ --output-file lcov.pre.info -q --rc lcov_branch_coverage=1; + lcov --capture --directory sanity-out/native_posix/ --directory sanity-out/unit_testing/ --output-file lcov.pre.info -q --rc lcov_branch_coverage=1; lcov -q --remove lcov.pre.info *generated* -o lcov.info --rc lcov_branch_coverage=1; rm lcov.pre.info; rm -rf sanity-out out-2nd-pass; diff --git a/scripts/sanitycheck b/scripts/sanitycheck index 56668707625..756cb7e8689 100755 --- a/scripts/sanitycheck +++ b/scripts/sanitycheck @@ -950,8 +950,8 @@ class MakeGenerator: build_logfile = os.path.join(outdir, "build.log") run_logfile = os.path.join(outdir, "run.log") handler_logfile = os.path.join(outdir, "handler.log") - if coverage: - args += ["COVERAGE=1"] + + args += ["COVERAGE=1", "EXTRA_LDFLAGS=--coverage"] # we handle running in the UnitHandler class text = (self._get_rule_header(name) + @@ -2393,15 +2393,15 @@ def main(): reason)) - def native_posix_first(a, b): - if a[0].startswith('native_posix'): + def native_posix_and_unit_first(a, b): + if a[0].startswith('native_posix') or a[0].startswith('unit_testing'): return -1 - if b[0].startswith('native_posix'): + if b[0].startswith('native_posix') or b[0].startswith('unit_testing'): return 1 return (a > b) - (a < b) ts.instances = OrderedDict(sorted(ts.instances.items(), - key=cmp_to_key(native_posix_first))) + key=cmp_to_key(native_posix_and_unit_first))) if options.save_tests: ts.run_report(options.save_tests)