1// RUN: rm -rf %t
2// RUN: mkdir -p %t
3// RUN: cd %t
4// RUN: %clang_profgen -o %t/binary %s
5//
6// Check that a dir separator is appended after %t is subsituted.
7// RUN: env TMPDIR="%t" LLVM_PROFILE_FILE="%%traw1.profraw" %run %t/binary
8// RUN: llvm-profdata show ./raw1.profraw | FileCheck %s -check-prefix TMPDIR
9//
10// Check that substitution works even if a redundant dir separator is added.
11// RUN: env TMPDIR="%t" LLVM_PROFILE_FILE="%%t/raw2.profraw" %run %t/binary
12// RUN: llvm-profdata show ./raw2.profraw | FileCheck %s -check-prefix TMPDIR
13//
14// Check that we fall back to the default path if TMPDIR is missing.
15// RUN: env -u TMPDIR LLVM_PROFILE_FILE="%%t/raw3.profraw" %run %t/binary 2>&1 | FileCheck %s -check-prefix MISSING
16// RUN: llvm-profdata show ./default.profraw | FileCheck %s -check-prefix TMPDIR
17
18// TMPDIR: Maximum function count: 1
19
20// MISSING: Unable to get the TMPDIR environment variable, referenced in {{.*}}raw3.profraw. Using the default path.
21
22int main() { return 0; }
23

source code of compiler-rt/test/profile/instrprof-tmpdir.c