Files
TheRock/compiler/amd-llvm/llvm/test/tools/llvm-cov/mcdc-maxbs.test
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

50 lines
1.8 KiB
Plaintext

# Test not to trigger the assertion failure in llvm-cov with empty bitmap.
# REQUIRES: asserts
# mcdc-maxbs.o contains the record:
#
# sub:
# Decision,File 0, 5:11 -> 5:59 = M:1, C:4
# Branch,File 0, 5:12 -> 5:20 = #5, ((#0 - #1) - #5) [1,3,2]
# Branch,File 0, 5:24 -> 5:32 = #6, (#5 - #6) [3,0,2]
# Branch,File 0, 5:38 -> 5:46 = #7, (#4 - #7) [2,4,0]
# Branch,File 0, 5:50 -> 5:58 = #8, (#7 - #8) [4,0,0]
# Decision,File 1, 1:23 -> 1:47 = M:0, C:2
# Branch,File 1, 1:23 -> 1:33 = #2, (#0 - #2) [1,2,0]
# Branch,File 1, 1:37 -> 1:47 = #3, (#2 - #3) [2,0,0]
#
# With the previous implementation, `Decision M:0 C:2` was picked up as
# the last `Decision`.
# The size of the bitmap was reported as `1` in this case.
# Actually, the largest `Decision` is `M:1 C:4` and the size should be `3`
# (Idx=1, len=16 bits).
#
# When a corresponding bitmap was not emitted, the dummy zero-ed bitmap is
# allocated as `BitmapBytes` with `getMaxBitmapSize(Record) + 1`
# (in this case, `1 + 1`, less than `3`).
# It may overrun and would trigger `unexpected test vector`
# by trailing uninitialized garbage.
# RUN: llvm-profdata merge %S/Inputs/mcdc-maxbs.proftext -o %t.profdata
# RUN: llvm-cov report --show-mcdc-summary %S/Inputs/mcdc-maxbs.o -instr-profile %t.profdata
# Instructions for regenerating the test object:
cd %S/Inputs # or copy %S/Inputs/mcdc-maxbs.c into the working directory
clang -Os -fcoverage-mcdc -fprofile-instr-generate \
-fcoverage-mapping -fcoverage-compilation-dir=. \
-mllvm -enable-name-compression=false \
mcdc-maxbs.c -c -o mcdc-maxbs.o
# Instructions for regenerating the test vector:
clang -fprofile-instr-generate mcdc-maxbs.o
rm -f default.prof*
# Doesn't crash if argc > 1
./a.out
llvm-profdata merge --sparse -o default.profdata default.profraw
llvm-profdata merge --text -o mcdc-maxbs.proftext default.profdata