bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.2k stars 4.06k forks source link

How to collect c++ code coverage for tensorflow (python) using bazel coverage #20196

Open BiophiliaSWDA opened 11 months ago

BiophiliaSWDA commented 11 months ago

After I compiled tensorflow with bazel, how do I get c++ code coverage for a network model implemented in python? I have the same issue to tensorflow, but did not get the suitable way. Can I use bazel coverage to get the c++ code coverage in python program?

sgowroji commented 11 months ago

Hi @BiophiliaSWDA, This is more of a Tensorflow query. Can you please file an issue with type:support/Question in the Tensorflow Github or other Tensorflow community channel? That can be addressed soon.

BiophiliaSWDA commented 11 months ago

Hi @BiophiliaSWDA, This is more of a Tensorflow query. Can you please file an issue with type:support/Question in the Tensorflow Github or other Tensorflow community channel? That can be addressed soon.

But whem I run a python script, I get a 0-byte coverage file. Here is my log:

$ bazelisk coverage test
Starting local Bazel server and connecting to it...
INFO: Using default value for --instrumentation_filter: "^//".
INFO: Override the above default with --instrumentation_filter
INFO: Analyzed target //:test (47 packages loaded, 508 targets configured).
INFO: Found 1 test target...
Target //:test up-to-date:
  bazel-bin/test
INFO: Elapsed time: 5.399s, Critical Path: 1.55s
INFO: 14 processes: 9 internal, 4 linux-sandbox, 1 worker.
INFO: Build completed successfully, 14 total actions
//:test                                                                  PASSED in 0.2s

Executed 1 out of 1 test: 1 test passes.
There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are.
(base) 

It did not generate any coverage file when I run python script. Here is my code. Link