From 048aab6d66c45423386d0216fd7bf445fbd1dc7f Mon Sep 17 00:00:00 2001 From: Evan Benn Date: Mon, 7 Nov 2022 14:50:35 +1100 Subject: tests: Add llvm-cov option and run target for code coverage Code coverage can be requested with -Dllvm_cov and run with ninja llvm-cov-tests or llvm-cov-cli. BUG=b:187647884 BRANCH=None TEST=meson test; ninja llvm-cov-tests TEST=ran test_build.sh with coverage enabled TEST=jenkins ran test_build.sh with coverage disabled Change-Id: Id6c73bff46e7b88d425956a80def97082b201f56 Signed-off-by: Evan Benn Reviewed-on: https://review.coreboot.org/c/flashrom/+/69268 Tested-by: build bot (Jenkins) Reviewed-by: Anastasia Klimchuk --- tests/meson.build | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/meson.build b/tests/meson.build index 0d605d21a..2de4ee8aa 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -121,7 +121,11 @@ flashrom_tests = executable('flashrom_unit_tests', '-U_FORTIFY_SOURCE', ], export_dynamic : true, - link_args : mocks, + link_args : mocks + link_args, dependencies : [cmocka_dep, flashrom_test_dep], ) test('cmocka test flashrom', flashrom_tests) + +if get_option('llvm_cov').enabled() + run_target('llvm-cov-tests', command : ['../scripts/llvm-cov', flashrom_tests]) +endif -- cgit v1.2.3