[compiler-rt] 3125af2 - [compiler-rt] [test] [profile] Avoid issues with an implicit .exe suffix

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 14:35:35 PDT 2023


Author: Martin Storsjö
Date: 2023-04-20T00:35:20+03:00
New Revision: 3125af2b6b8a5a502d8cef480a874474b55efef1

URL: https://github.com/llvm/llvm-project/commit/3125af2b6b8a5a502d8cef480a874474b55efef1
DIFF: https://github.com/llvm/llvm-project/commit/3125af2b6b8a5a502d8cef480a874474b55efef1.diff

LOG: [compiler-rt] [test] [profile] Avoid issues with an implicit .exe suffix

Mingw toolchains implicitly add an .exe suffix if the output linked
file doesn't have a suffix. In many cases the extra suffix doesn't
cause any issues, but in some tests, this discrepancy between expected
output file name and actual output file does affect the tests.

In one test, a rm command fails to remove the executable since it
doesn't have the expected name. By failing to remove the executable, the
later llvm-profdata command tries to read the executable as if it was
a profile data file.

In another test, when the Python executor executes commands, it can
resolve executable names without the extra .exe suffix for absolute
paths (when most binaries are executed as e.g. "%t/foo"), but it fails
to resolve the executables for relative paths such as "./foo". Making
the paths absolute by using %t here shouldn't affect what the test tries
to validate.

Differential Revision: https://reviews.llvm.org/D148169

Added: 
    

Modified: 
    compiler-rt/test/profile/instrprof-basic.c
    compiler-rt/test/profile/instrprof-tmpdir.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/profile/instrprof-basic.c b/compiler-rt/test/profile/instrprof-basic.c
index 17631d1b9a989..de66e1b274680 100644
--- a/compiler-rt/test/profile/instrprof-basic.c
+++ b/compiler-rt/test/profile/instrprof-basic.c
@@ -38,7 +38,7 @@
 // RUN: %run %t.dir4/merge4
 // RUN: %run %t.dir4/merge4
 // RUN: %run %t.dir4/merge4
-// RUN: rm -f %t.dir4/merge4
+// RUN: rm -f %t.dir4/merge4*
 // RUN: llvm-profdata merge -o %t.m4.profdata ./
 // RUN: %clang_profuse=%t.m4.profdata -O0 -o - -S -emit-llvm %s | FileCheck %s --check-prefix=COMMON  --check-prefix=PGOMERGE
 

diff  --git a/compiler-rt/test/profile/instrprof-tmpdir.c b/compiler-rt/test/profile/instrprof-tmpdir.c
index 036313850ed63..6f323e7e6a01a 100644
--- a/compiler-rt/test/profile/instrprof-tmpdir.c
+++ b/compiler-rt/test/profile/instrprof-tmpdir.c
@@ -4,15 +4,15 @@
 // 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: env TMPDIR="%t" LLVM_PROFILE_FILE="%%traw1.profraw" %run %t/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: env TMPDIR="%t" LLVM_PROFILE_FILE="%%t/raw2.profraw" %run %t/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: env -u TMPDIR LLVM_PROFILE_FILE="%%t/raw3.profraw" %run %t/binary 2>&1 | FileCheck %s -check-prefix MISSING
 // RUN: llvm-profdata show ./default.profraw | FileCheck %s -check-prefix TMPDIR
 
 // TMPDIR: Maximum function count: 1


        


More information about the llvm-commits mailing list