Closed dlt-lee closed 3 years ago
Hello,
You first need to decide whether you want to perform object coverage analysis or source coverage analysis (getting familiar with the relevant doc area will help: https://docs.adacore.com/gnatcoverage-docs/html/getting_started.html#general-principles-and-common-notions). From then:
--level=insn
or --level=branch
).--level=stmt+mcdc
in both gnatcov
invocations), designate units of interest (see the error message at the end of your logs, and of course the doc can help: https://docs.adacore.com/gnatcoverage-docs/html/units_of_interest.html); also in that case the --routines
option is useless (it’s valid only for object coverage).I hope this helps,
Hi, I use gnatcov run --level=stmt+decision ./bin/unit_tests --routines=f to generate trace file and gnatcov coverage --level=stmt+mcdc --annotate=html unit_tests.trace --routines=f for aanalysis report. But I get the following log: bjuci@bjuci-ThinkPad-X270-W10DG:~/github/gtest-demo/build$ gnatcov run --level=stmt+decision ./bin/unit_tests --routines=f warning: Support for coverage of non-instrumented native programs is deprecated and will disappear after GNATcoverage 21 releases. You are encouraged to migrate to instrumentation-based coverage: you can read more about it in our documentation: http://docs.adacore.com/gnatcoverage-docs/html/gnatcov.html Running main() from gtest_main.cc [==========] Running 2 tests from 1 test case. [----------] Global test environment set-up. [----------] 2 tests from example [ RUN ] example.add [ OK ] example.add (10 ms) [ RUN ] example.subtract [ OK ] example.subtract (1 ms) [----------] 2 tests from example (19 ms total)
[----------] Global test environment tear-down [==========] 2 tests from 1 test case ran. (56 ms total) [ PASSED ] 2 tests. bjuci@bjuci-ThinkPad-X270-W10DG:~/github/gtest-demo/build$ gnatcov coverage --level=stmt+mcdc --annotate=html unit_tests.trace --routines=f gnatcov: Please specify SCOs on the command line, specifying Units in project or using --units/--scos. Usage: gnatcov coverage [OPTIONS] TRACE_FILEs Run 'gnatcov coverage --help' for more information. Is there anything wrong? Thanks