62c372770d
Add support for expanding the %t filename specifier in LLVM_PROFILE_FILE to the TMPDIR environment variable. This is supported on all platforms. On Darwin, TMPDIR is used to specify a temporary application-specific scratch directory. When testing apps on remote devices, it can be challenging for the host device to determine the correct TMPDIR, so it's helpful to have the runtime do this work. rdar://68524185 Differential Revision: https://reviews.llvm.org/D87332
23 lines
995 B
C
23 lines
995 B
C
// RUN: rm -rf %t
|
|
// RUN: mkdir -p %t
|
|
// RUN: cd %t
|
|
// RUN: %clang_profgen -o %t/binary %s
|
|
//
|
|
// Check that a dir separator is appended after %t is subsituted.
|
|
// RUN: env TMPDIR="%t" LLVM_PROFILE_FILE="%%traw1.profraw" %run ./binary
|
|
// RUN: llvm-profdata show ./raw1.profraw | FileCheck %s -check-prefix TMPDIR
|
|
//
|
|
// Check that substitution works even if a redundant dir separator is added.
|
|
// RUN: env TMPDIR="%t" LLVM_PROFILE_FILE="%%t/raw2.profraw" %run ./binary
|
|
// RUN: llvm-profdata show ./raw2.profraw | FileCheck %s -check-prefix TMPDIR
|
|
//
|
|
// Check that we fall back to the default path if TMPDIR is missing.
|
|
// RUN: env -u TMPDIR LLVM_PROFILE_FILE="%%t/raw3.profraw" %run ./binary 2>&1 | FileCheck %s -check-prefix MISSING
|
|
// RUN: llvm-profdata show ./default.profraw | FileCheck %s -check-prefix TMPDIR
|
|
|
|
// TMPDIR: Maximum function count: 1
|
|
|
|
// MISSING: Unable to get the TMPDIR environment variable, referenced in {{.*}}raw3.profraw. Using the default path.
|
|
|
|
int main() { return 0; }
|