This appendix contains several examples of command line usage for cvcov. For complete details about using cvcov, see the cvcov(1) man page and Chapter 3, “Tester Command Line Reference”.
The following examples demonstrate commands that support the creation, inspection, modification, and deletion of tests:
cattest describes the test details for a test, test set, or test group.
Example A-2. cattest Example without -r
% cvcov cattest tut_testset Test Info Settings ---------------------------------------------------------- Test /disk2/tutorial/tutorial/tut_testset Type set Description full coverage testset Number of Exes 1 Exe List copyn Number of Subtests 9 Subtest List [0] /disk2/tutorial/tutorial/test0000 [1] /disk2/tutorial/tutorial/test0001 [2] /disk2/tutorial/tutorial/test0002 [3] /disk2/tutorial/tutorial/test0003 [4] /disk2/tutorial/tutorial/test0004 [5] /disk2/tutorial/tutorial/test0005 [6] /disk2/tutorial/tutorial/test0006 [7] /disk2/tutorial/tutorial/test0007 [8] /disk2/tutorial/tutorial/test0008 Experiment List exp##0 |
Example A-3. cattest Example with -r
% cvcov cattest -r tut_testset Test Info Settings --------------------------------------------------------- Test /disk2/tutorial/tutorial/tut_testset Type set Description full coverage testset Number of Exes 1 Exe List copyn Number of Subtests 9 Subtest List /disk2/tutorial/tutorial/test0000 /disk2/tutorial/tutorial/test0001 /disk2/tutorial/tutorial/test0002 /disk2/tutorial/tutorial/test0003 /disk2/tutorial/tutorial/test0004 /disk2/tutorial/tutorial/test0005 /disk2/tutorial/tutorial/test0006 /disk2/tutorial/tutorial/test0007 /disk2/tutorial/tutorial/test0008 Experiment List exp##0 |
lsinstr lists the test directories in the current working directory.
% cvcov lsinstr test0000 Instrumentation Info --------------------------------------------------------- Executable copyn Version 0 Instrument Directory /x/tmp/carol/ Instrument File tut_instr_file Criteria RBPA Instrumented Objects copyn.pixie(2.57X) libc.so.1_RBP_Instr(1.07X) |
mktest creates a test directory.
Example A-5. Test Description File Examples
% cvcov mktest -cmd "copyn tut_instr_file targetfile" cvcov: Made test directory: /d/Tester/tutorial/test0002 % cvcov cattest test0002 Test Info Settings --------------------------------------------------------- Test /d/Tester/tutorial/test0002 Type single Description Command Line copyn tut_instr_file targetfile Number of Exes 1 Exe List copyn Instrument Directory /d/Tester/tutorial Experiment List |
After the data has been collected from the test experiments, data can be analyzed with special commands for the various types of coverage available.
lssum shows the overall coverage based on the user-defined weighted average over function, line, block, branch, and arc coverage.
% cvcov lssum test0000
Coverages Covered Total % Coverage Weight
------------------------------------------------------------
Function 2 2 100.00% 0.400
Source Line 17 35 48.57% 0.200
Branch 0 10 0.00% 0.200
Arc 8 18 44.44% 0.200
Block 19 42 45.24% 0.000
Weighted Sum 58.60% 1.000
|
lsfun lists coverage information for the specified functions in the program that was tested.
% cvcov lsfun -pretty -sort function test0000 Functions Files Counts ------------------------------------- copy_file copyn.c 1 main copyn.c 1 |
![]() | : C++ inline functions are not counted as functions. |
lsblock displays a list of blocks for one or more functions and the count information associated with each block.
cvcov lsblock -pat main -pretty test0000 Blocks Functions Files Counts ------------------------------------------------- 13~16 main copyn.c 1 17~17 main copyn.c 0 18~18 main copyn.c 0 19~19 main copyn.c 0 21~21 main copyn.c 1 22~22 main copyn.c 0 23~23 main copyn.c 0 24~24 main copyn.c 0 26~26 main copyn.c 1 26~27 main copyn.c 1 27~27 main copyn.c 1 28~28 main copyn.c 0 28~28(2) main copyn.c 0 28~28(3) main copyn.c 0 28~28(4) main copyn.c 0 30~30 main copyn.c 0 31~31 main copyn.c 0 33~33 main copyn.c 0 34~34 main copyn.c 0 36~36 main copyn.c 0 37~37 main copyn.c 0 39~39 main copyn.c 0 41~41 main copyn.c 0 43~43 main copyn.c 1 43~43(2) main copyn.c 0 43~43(3) main copyn.c 1 |
lsbranch lists coverage information for branches in the program, including the line number at which the branch occurs.
lsarc shows arc coverage, that is, the number of arcs taken out of the total possible arcs.
lscall lists the call graph for the executable with counts for each function.
Lists the coverage for native source lines.
% cvcov lsline -pretty -pat main test0000 Functions Files Covered Total % Coverage --------------------------------------------------------- main copyn.c 6 20 30.00% |
lssource displays the source annotated with line counts. This option requires the code to be compiled with the -g option.
Example A-13. lssource Example
diff shows the difference in coverage for different versions of the same program. The following examples show different uses of the diff option.
Example A-14. diff between Two Tests
Example A-15. diff between Different Instrumentations of the Same Test
% cvcov diff test0000/exp##0 test0000/exp##1
Experiment 1: test0000/exp##0
Experiment 2: test0000/exp##1
Coverages Exp 1 Exp 2 Differences
----------------------------------------------------------
Function Coverage 2(100.00%) 2(100.00%) 0(0.00%)
Source Line Coverage 17(48.57%) 17(47.22%) 0(1.35%)
Branch Coverage 0(0.00%) 0(0.00%) 0(0.00%)
Arc Coverage 8(44.44%) 8(44.44%) 0(0.00%)
Block Coverage 19(45.24%) 19(44.19%) 0(-1.05%) |
A test set is a named collection of tests and other test sets. Test sets can be hierarchical. There are several commands used with test sets, including mktset, addtest, deltest, and optimize.
optimize selects the minimum set of tests that give the same coverage or meet the given coverage criteria as the given set.
Example A-16. Optimizing Test Sets
% cvcov optimize -pretty -blocks -branches test00*
Test Block Coverage Branch Coverage
---------------------------------------------------------
test0000 41.54% 0.00%
test0001 7.69% 10.00%
test0002 7.69% 10.00%
test0003 9.23% 20.00%
test0004 9.23% 20.00%
test0005 6.15% 20.00%
test0006 1.54% 10.00%
Total Coverage 83.08% 90.00% |