50 lines · plain
1# Test not to trigger the assertion failure in llvm-cov with empty bitmap.2# REQUIRES: asserts3 4# mcdc-maxbs.o contains the record:5#6# sub:7# Decision,File 0, 5:11 -> 5:59 = M:1, C:48# Branch,File 0, 5:12 -> 5:20 = #5, ((#0 - #1) - #5) [1,3,2]9# Branch,File 0, 5:24 -> 5:32 = #6, (#5 - #6) [3,0,2]10# Branch,File 0, 5:38 -> 5:46 = #7, (#4 - #7) [2,4,0]11# Branch,File 0, 5:50 -> 5:58 = #8, (#7 - #8) [4,0,0]12# Decision,File 1, 1:23 -> 1:47 = M:0, C:213# Branch,File 1, 1:23 -> 1:33 = #2, (#0 - #2) [1,2,0]14# Branch,File 1, 1:37 -> 1:47 = #3, (#2 - #3) [2,0,0]15#16# With the previous implementation, `Decision M:0 C:2` was picked up as17# the last `Decision`.18# The size of the bitmap was reported as `1` in this case.19# Actually, the largest `Decision` is `M:1 C:4` and the size should be `3`20# (Idx=1, len=16 bits).21#22# When a corresponding bitmap was not emitted, the dummy zero-ed bitmap is23# allocated as `BitmapBytes` with `getMaxBitmapSize(Record) + 1`24# (in this case, `1 + 1`, less than `3`).25# It may overrun and would trigger `unexpected test vector`26# by trailing uninitialized garbage.27 28# RUN: llvm-profdata merge %S/Inputs/mcdc-maxbs.proftext -o %t.profdata29# RUN: llvm-cov report --show-mcdc-summary %S/Inputs/mcdc-maxbs.o -instr-profile %t.profdata30 31# Instructions for regenerating the test object:32 33cd %S/Inputs # or copy %S/Inputs/mcdc-maxbs.c into the working directory34 35clang -Os -fcoverage-mcdc -fprofile-instr-generate \36 -fcoverage-mapping -fcoverage-compilation-dir=. \37 -mllvm -enable-name-compression=false \38 mcdc-maxbs.c -c -o mcdc-maxbs.o39 40# Instructions for regenerating the test vector:41 42clang -fprofile-instr-generate mcdc-maxbs.o43rm -f default.prof*44 45# Doesn't crash if argc > 146./a.out47 48llvm-profdata merge --sparse -o default.profdata default.profraw49llvm-profdata merge --text -o mcdc-maxbs.proftext default.profdata50