diff options
author | Evan Benn <evanbenn@chromium.org> | 2022-11-07 14:50:35 +1100 |
---|---|---|
committer | Anastasia Klimchuk <aklm@chromium.org> | 2022-12-11 21:27:27 +0000 |
commit | 048aab6d66c45423386d0216fd7bf445fbd1dc7f (patch) | |
tree | 874616e6fe90975fdd041d6fd35cdbd1c846fad9 /meson.build | |
parent | 80408ceafc2a9a550bb5ef7aabd772dbf5d34487 (diff) | |
download | flashrom-048aab6d66c45423386d0216fd7bf445fbd1dc7f.tar.gz flashrom-048aab6d66c45423386d0216fd7bf445fbd1dc7f.tar.bz2 flashrom-048aab6d66c45423386d0216fd7bf445fbd1dc7f.zip |
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 <evanbenn@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/69268
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/meson.build b/meson.build index 859256fe..27a284e9 100644 --- a/meson.build +++ b/meson.build @@ -45,6 +45,7 @@ config_default_programmer_name = get_option('default_programmer_name') config_default_programmer_args = get_option('default_programmer_args') cargs = [] +link_args = [] deps = [] srcs = files( '82802ab.c', @@ -539,6 +540,11 @@ endif cargs += '-DCONFIG_DEFAULT_PROGRAMMER_ARGS="' + config_default_programmer_args + '"' +if get_option('llvm_cov').enabled() + cargs += ['-fprofile-instr-generate', '-fcoverage-mapping'] + link_args += ['-fprofile-instr-generate', '-fcoverage-mapping'] +endif + install_headers([ 'include/libflashrom.h', ], @@ -567,7 +573,7 @@ libflashrom = both_libraries( cargs, ], install : true, - link_args : vflag, + link_args : link_args + [vflag], link_depends : mapfile, ) @@ -601,7 +607,7 @@ configure_file( ) if get_option('classic_cli').auto() or get_option('classic_cli').enabled() - executable( + classic_cli = executable( 'flashrom', files( 'cli_classic.c', @@ -612,8 +618,12 @@ if get_option('classic_cli').auto() or get_option('classic_cli').enabled() include_directories : include_dir, install : true, install_dir : get_option('sbindir'), + link_args : link_args, link_with : libflashrom.get_static_lib(), # flashrom needs internal symbols of libflashrom ) + if get_option('llvm_cov').enabled() + run_target('llvm-cov-cli', command : ['scripts/llvm-cov', classic_cli]) + endif endif if get_option('ich_descriptors_tool').auto() or get_option('ich_descriptors_tool').enabled() |