NB I have the custom targets which run by python scripts. So I couldn't use bazel coverage directly for this one. 1. I defined in .bazelrc build:coverage --collect_code_coverage build:coverage --instrumentation_filter="^//src[/:]" coverage --instrumentation_filter="^//src[/:]" In the root BUILD config_setting( name = "Coverage", flag_values = { ":coverage": "true", }, ) bool_flag( name = "coverage", build_setting_default = False, ) In the cc_binary wrapper I use + select({"//:Coverage": coverageCopts, "//conditions:default": [], }), // and select({"//:Coverage": coverageLopts, "//conditions:default": [], }), where coverageCopts = ["--coverage", "-fprofile-abs-path", "-fprofile-arcs", "-ftest-coverage"] coverageLopts = ["--coverage", "-lgcov"] and run this python script (from bazel) like this: bazel run --subcommands --//\:coverage=true script:runner But for some mystical reasons I have a lack of gcno files. although there are these gcno's for neighboring files from the same library. Grepping for bazel --subcommands indicates the presences of --coverage flag for this cpp file. I did bazel clean --expunge - same result. Continue reading...