xref: /llvm-project/compiler-rt/test/profile/instrprof-tmpdir.c (revision 16ef893e9fdec2b08dafc82f5450b41834e09039)
162c37277SVedant Kumar // RUN: rm -rf %t
262c37277SVedant Kumar // RUN: mkdir -p %t
362c37277SVedant Kumar // RUN: cd %t
462c37277SVedant Kumar // RUN: %clang_profgen -o %t/binary %s
562c37277SVedant Kumar //
662c37277SVedant Kumar // Check that a dir separator is appended after %t is subsituted.
73125af2bSMartin Storsjö // RUN: env TMPDIR="%t" LLVM_PROFILE_FILE="%%traw1.profraw" %run %t/binary
862c37277SVedant Kumar // RUN: llvm-profdata show ./raw1.profraw | FileCheck %s -check-prefix TMPDIR
962c37277SVedant Kumar //
1062c37277SVedant Kumar // Check that substitution works even if a redundant dir separator is added.
113125af2bSMartin Storsjö // RUN: env TMPDIR="%t" LLVM_PROFILE_FILE="%%t/raw2.profraw" %run %t/binary
1262c37277SVedant Kumar // RUN: llvm-profdata show ./raw2.profraw | FileCheck %s -check-prefix TMPDIR
1362c37277SVedant Kumar //
1462c37277SVedant Kumar // Check that we fall back to the default path if TMPDIR is missing.
15*16ef893eSWael Yehia // RUN: %if system-aix %{ unset TMPDIR %}
16*16ef893eSWael Yehia // RUN: env %if !system-aix %{ -u TMPDIR %} LLVM_PROFILE_FILE="%%t/raw3.profraw" %run %t/binary 2>&1 | FileCheck %s -check-prefix MISSING
1762c37277SVedant Kumar // RUN: llvm-profdata show ./default.profraw | FileCheck %s -check-prefix TMPDIR
1862c37277SVedant Kumar 
1962c37277SVedant Kumar // TMPDIR: Maximum function count: 1
2062c37277SVedant Kumar 
2162c37277SVedant Kumar // MISSING: Unable to get the TMPDIR environment variable, referenced in {{.*}}raw3.profraw. Using the default path.
2262c37277SVedant Kumar 
2362c37277SVedant Kumar int main() { return 0; }
24