Shivam Gupta 64d19542e7 [LIT] Added an option to llvm-lit to emit the necessary test coverage data, divided per test case
This patch is the first part of https://llvm.org/OpenProjects.html#llvm_patch_coverage.

We have first define a new variable LLVM_TEST_COVERAGE which when set, pass --per-test-coverage option to
llvm-lit which will help in setting a unique value to LLVM_PROFILE_FILE for each RUN. So for example
coverage data for test case llvm/test/Analysis/AliasSet/memtransfer.ll will be emitted as
build/test/Analysis/AliasSet/memtransfer0.profraw

Reviewed By: hnrklssn

Differential Revision: https://reviews.llvm.org/D154280
2023-07-26 16:47:17 +05:30

12 lines
291 B
Python

# Check that the environment variable is set correctly
# RUN: %{python} %s | FileCheck %s
# Python script to read the environment variable
# and print its value
import os
llvm_profile_file = os.environ.get('LLVM_PROFILE_FILE')
print(llvm_profile_file)
# CHECK: per-test-coverage0.profraw