BITCOV: Changes for Instrumentation

BITCOV omitts any Testwell CTC++ runtime and measures binary executed / not executed information instead of counting. The build and rebuild process changes in some details.

A script called ctc2static is used for initiating BITCOV. It has to be called during the ctc run with hook parameter

RUN_AFTER_INSTR = ctc2static

ctc2static performs two tasks:

  • Changing the way the code is instrumented.
  • Providing an auxiliary file with default name MON.aux, which is needed for reporting later. It maps the CTC_array to source files and their counters. The file naming follows the symbol file naming.

BITCOV provides three variants for the array containing the coverage information: you can use a bit array with one bit per measure point, or a byte array storing this binary information in bytes or an array of actual counters (max. 32 bit).

You initiate the variant chosen by passing certain compile flags with the configuration parameter OPT_ADD_COMPILE. Additionally, you have to define a global array with the proper size and initialize it with zeros. You can derive the proper size after one instrumentation run from the symbol file with the tool any2mem.

Table 1. Set up of the different BITCOV variants
Compile Flags The CTC_array
with bits (default) - Call
ctcpost –L MON.sym | any2mem
to get an array definition with the correct size, for example
unsigned char CTC_array[27] = {0};
with bytes
Multiply the array size by 8.
with counters
Multiply the array size by 8 and define the array as unsigned int (for example).
Instead of defining the array in your source code, you can also pass a starting address, for example 0x4200, with

You need to initialize the memory starting with this address with zeros, in the same length as calculated for array sizing.

General Restrictions with BITCOV

  • All source files must be instrumented in the same variant described above.
  • Timing instrumentation cannot be used with these variants. The source files can be instrumented individually with regard to instrumentation mode.
  • All code files have to be instrumented "together": The instrumentation must result in only one symbol file and one auxiliary file.
  • If a source file is changed and needs to be instrumented again, you need to delete the .sym and .aux files and do a full rebuild, instrumenting all files again.
  • Testwell CTC++ specific pragmas affecting the runtime cannot be used in any BITCOV variant. Pragmas with instructions for instrumentation like #pragma CTC SKIP, #pragma CTC ENDSKIP or #pragma CTC ANNOTATION can be used.