[llvm] Get rid of "%T" expansions

The %T lit expansion expands to a common directory shared between all the tests in the same directory, which is unexpected and unintuitive, and more importantly, it's been a source of subtle race conditions and flaky tests. In https://reviews.llvm.org/D35396, it was agreed that it would be best to simply ban %T and only keep %t, which is unique to each test. When a test needs a temporary directory, it can just create one using mkdir %t.

This patch removes %T in llvm.

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

llvm-svn: 310953
diff --git a/llvm/test/Transforms/GCOVProfiling/function-numbering.ll b/llvm/test/Transforms/GCOVProfiling/function-numbering.ll
index 6f10fd2..4e8beb7 100644
--- a/llvm/test/Transforms/GCOVProfiling/function-numbering.ll
+++ b/llvm/test/Transforms/GCOVProfiling/function-numbering.ll
@@ -2,15 +2,16 @@
 ; functions aren't emitted.
 
 ; Inject metadata to set the .gcno file location
-; RUN: echo '!14 = !{!"%/T/function-numbering.ll", !0}' > %t1
-; RUN: cat %s %t1 > %t2
+; RUN: rm -rf %t && mkdir -p %t
+; RUN: echo '!14 = !{!"%/t/function-numbering.ll", !0}' > %t/1
+; RUN: cat %s %t/1 > %t/2
 
-; RUN: opt -insert-gcov-profiling -S < %t2 | FileCheck --check-prefix GCDA %s
-; RUN: llvm-cov gcov -n -dump %T/function-numbering.gcno 2>&1 | FileCheck --check-prefix GCNO %s
-; RUNN: rm %T/function-numbering.gcno
+; RUN: opt -insert-gcov-profiling -S < %t/2 | FileCheck --check-prefix GCDA %s
+; RUN: llvm-cov gcov -n -dump %t/function-numbering.gcno 2>&1 | FileCheck --check-prefix GCNO %s
+; RUNN: rm %t/function-numbering.gcno
 
-; RUN: opt -passes=insert-gcov-profiling -S < %t2 | FileCheck --check-prefix GCDA %s
-; RUN: llvm-cov gcov -n -dump %T/function-numbering.gcno 2>&1 | FileCheck --check-prefix GCNO %s
+; RUN: opt -passes=insert-gcov-profiling -S < %t/2 | FileCheck --check-prefix GCDA %s
+; RUN: llvm-cov gcov -n -dump %t/function-numbering.gcno 2>&1 | FileCheck --check-prefix GCNO %s
 
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.10.0"
diff --git a/llvm/test/Transforms/GCOVProfiling/global-ctor.ll b/llvm/test/Transforms/GCOVProfiling/global-ctor.ll
index e20da85..86488ee 100644
--- a/llvm/test/Transforms/GCOVProfiling/global-ctor.ll
+++ b/llvm/test/Transforms/GCOVProfiling/global-ctor.ll
@@ -1,12 +1,13 @@
-; RUN: echo '!16 = !{!"%/T/global-ctor.ll", !0}' > %t1
-; RUN: cat %s %t1 > %t2
-; RUN: opt -insert-gcov-profiling -disable-output < %t2
-; RUN: not grep '_GLOBAL__sub_I_global-ctor' %T/global-ctor.gcno
-; RUN: rm %T/global-ctor.gcno
+; RUN: rm -rf %t && mkdir -p %t
+; RUN: echo '!16 = !{!"%/t/global-ctor.ll", !0}' > %t/1
+; RUN: cat %s %t/1 > %t/2
+; RUN: opt -insert-gcov-profiling -disable-output < %t/2
+; RUN: not grep '_GLOBAL__sub_I_global-ctor' %t/global-ctor.gcno
+; RUN: rm %t/global-ctor.gcno
 
-; RUN: opt -passes=insert-gcov-profiling -disable-output < %t2
-; RUN: not grep '_GLOBAL__sub_I_global-ctor' %T/global-ctor.gcno
-; RUN: rm %T/global-ctor.gcno
+; RUN: opt -passes=insert-gcov-profiling -disable-output < %t/2
+; RUN: not grep '_GLOBAL__sub_I_global-ctor' %t/global-ctor.gcno
+; RUN: rm %t/global-ctor.gcno
 
 @x = global i32 0, align 4
 @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__sub_I_global-ctor.ll, i8* null }]
diff --git a/llvm/test/Transforms/GCOVProfiling/linezero.ll b/llvm/test/Transforms/GCOVProfiling/linezero.ll
index a2e5381..64b5274 100644
--- a/llvm/test/Transforms/GCOVProfiling/linezero.ll
+++ b/llvm/test/Transforms/GCOVProfiling/linezero.ll
@@ -1,8 +1,10 @@
-; RUN: sed -e 's|PATTERN|%/T|g' %s | opt -insert-gcov-profiling -disable-output
-; RUN: rm %T/linezero.gcno
+; RUN: rm -rf %t && mkdir -p %t
 
-; RUN: sed -e 's|PATTERN|%/T|g' %s | opt -passes=insert-gcov-profiling -disable-output
-; RUN: rm %T/linezero.gcno
+; RUN: sed -e 's|PATTERN|%/t|g' %s | opt -insert-gcov-profiling -disable-output
+; RUN: rm %t/linezero.gcno
+
+; RUN: sed -e 's|PATTERN|%/t|g' %s | opt -passes=insert-gcov-profiling -disable-output
+; RUN: rm %t/linezero.gcno
 
 ; This is a crash test.
 
diff --git a/llvm/test/Transforms/GCOVProfiling/linkagename.ll b/llvm/test/Transforms/GCOVProfiling/linkagename.ll
index dc46a35..0e5e94e 100644
--- a/llvm/test/Transforms/GCOVProfiling/linkagename.ll
+++ b/llvm/test/Transforms/GCOVProfiling/linkagename.ll
@@ -1,12 +1,13 @@
-; RUN: echo '!9 = !{!"%/T/linkagename.ll", !0}' > %t1
-; RUN: cat %s %t1 > %t2
-; RUN: opt -insert-gcov-profiling -disable-output < %t2
-; RUN: grep _Z3foov %T/linkagename.gcno
-; RUN: rm %T/linkagename.gcno
+; RUN: rm -rf %t && mkdir -p %t
+; RUN: echo '!9 = !{!"%/t/linkagename.ll", !0}' > %t/1
+; RUN: cat %s %t/1 > %t/2
+; RUN: opt -insert-gcov-profiling -disable-output < %t/2
+; RUN: grep _Z3foov %t/linkagename.gcno
+; RUN: rm %t/linkagename.gcno
 
-; RUN: opt -passes=insert-gcov-profiling -disable-output < %t2
-; RUN: grep _Z3foov %T/linkagename.gcno
-; RUN: rm %T/linkagename.gcno
+; RUN: opt -passes=insert-gcov-profiling -disable-output < %t/2
+; RUN: grep _Z3foov %t/linkagename.gcno
+; RUN: rm %t/linkagename.gcno
 
 define void @_Z3foov() !dbg !5 {
 entry:
diff --git a/llvm/test/Transforms/GCOVProfiling/return-block.ll b/llvm/test/Transforms/GCOVProfiling/return-block.ll
index 0170569..93d441f 100644
--- a/llvm/test/Transforms/GCOVProfiling/return-block.ll
+++ b/llvm/test/Transforms/GCOVProfiling/return-block.ll
@@ -1,23 +1,24 @@
 ; Inject metadata to set the .gcno file location
-; RUN: echo '!19 = !{!"%/T/return-block.ll", !0}' > %t1
-; RUN: cat %s %t1 > %t2
+; RUN: rm -rf %t && mkdir -p %t
+; RUN: echo '!19 = !{!"%/t/return-block.ll", !0}' > %t/1
+; RUN: cat %s %t/1 > %t/2
 
 ; By default, the return block is last.
-; RUN: opt -insert-gcov-profiling -disable-output %t2
-; RUN: llvm-cov gcov -n -dump %T/return-block.gcno 2>&1 | FileCheck -check-prefix=CHECK -check-prefix=RETURN-LAST %s
+; RUN: opt -insert-gcov-profiling -disable-output %t/2
+; RUN: llvm-cov gcov -n -dump %t/return-block.gcno 2>&1 | FileCheck -check-prefix=CHECK -check-prefix=RETURN-LAST %s
 
 ; But we can optionally emit it second, to match newer gcc versions.
-; RUN: opt -insert-gcov-profiling -gcov-exit-block-before-body -disable-output %t2
-; RUN: llvm-cov gcov -n -dump %T/return-block.gcno 2>&1 | FileCheck -check-prefix=CHECK -check-prefix=RETURN-SECOND %s
-; RUN: rm  %T/return-block.gcno
+; RUN: opt -insert-gcov-profiling -gcov-exit-block-before-body -disable-output %t/2
+; RUN: llvm-cov gcov -n -dump %t/return-block.gcno 2>&1 | FileCheck -check-prefix=CHECK -check-prefix=RETURN-SECOND %s
+; RUN: rm  %t/return-block.gcno
 
 ; By default, the return block is last.
-; RUN: opt -passes=insert-gcov-profiling -disable-output %t2
-; RUN: llvm-cov gcov -n -dump %T/return-block.gcno 2>&1 | FileCheck -check-prefix=CHECK -check-prefix=RETURN-LAST %s
+; RUN: opt -passes=insert-gcov-profiling -disable-output %t/2
+; RUN: llvm-cov gcov -n -dump %t/return-block.gcno 2>&1 | FileCheck -check-prefix=CHECK -check-prefix=RETURN-LAST %s
 
 ; But we can optionally emit it second, to match newer gcc versions.
-; RUN: opt -passes=insert-gcov-profiling -gcov-exit-block-before-body -disable-output %t2
-; RUN: llvm-cov gcov -n -dump %T/return-block.gcno 2>&1 | FileCheck -check-prefix=CHECK -check-prefix=RETURN-SECOND %s
+; RUN: opt -passes=insert-gcov-profiling -gcov-exit-block-before-body -disable-output %t/2
+; RUN: llvm-cov gcov -n -dump %t/return-block.gcno 2>&1 | FileCheck -check-prefix=CHECK -check-prefix=RETURN-SECOND %s
 
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
diff --git a/llvm/test/Transforms/GCOVProfiling/three-element-mdnode.ll b/llvm/test/Transforms/GCOVProfiling/three-element-mdnode.ll
index b92f780..dd1fa8b 100644
--- a/llvm/test/Transforms/GCOVProfiling/three-element-mdnode.ll
+++ b/llvm/test/Transforms/GCOVProfiling/three-element-mdnode.ll
@@ -1,9 +1,10 @@
-; RUN: echo '!10 = !{!"%/T/aaa.gcno", !"%/T/bbb.gcda", !0}' > %t1
-; RUN: cat %s %t1 > %t2
-; RUN: opt -insert-gcov-profiling -S -o %t3 < %t2
-; RUN: grep _Z3foov %T/aaa.gcno
-; RUN: grep bbb.gcda %t3
-; RUN: rm %T/aaa.gcno
+; RUN: rm -rf %t && mkdir -p %t
+; RUN: echo '!10 = !{!"%/t/aaa.gcno", !"%/t/bbb.gcda", !0}' > %t/1
+; RUN: cat %s %t/1 > %t/2
+; RUN: opt -insert-gcov-profiling -S -o %t/3 < %t/2
+; RUN: grep _Z3foov %t/aaa.gcno
+; RUN: grep bbb.gcda %t/3
+; RUN: rm %t/aaa.gcno
 
 define void @_Z3foov() !dbg !5 {
 entry:
diff --git a/llvm/test/Transforms/GCOVProfiling/version.ll b/llvm/test/Transforms/GCOVProfiling/version.ll
index da70ac4..0dc93a0 100644
--- a/llvm/test/Transforms/GCOVProfiling/version.ll
+++ b/llvm/test/Transforms/GCOVProfiling/version.ll
@@ -1,20 +1,21 @@
-; RUN: echo '!9 = !{!"%/T/version.ll", !0}' > %t1
-; RUN: cat %s %t1 > %t2
-; RUN: opt -insert-gcov-profiling -disable-output < %t2
-; RUN: head -c8 %T/version.gcno | grep '^oncg.204'
-; RUN: rm %T/version.gcno
-; RUN: not opt -insert-gcov-profiling -default-gcov-version=asdfasdf -disable-output < %t2
-; RUN: opt -insert-gcov-profiling -default-gcov-version=407* -disable-output < %t2
-; RUN: head -c8 %T/version.gcno | grep '^oncg.704'
-; RUN: rm %T/version.gcno
+; RUN: rm -rf %t && mkdir -p %t
+; RUN: echo '!9 = !{!"%/t/version.ll", !0}' > %t/1
+; RUN: cat %s %t/1 > %t/2
+; RUN: opt -insert-gcov-profiling -disable-output < %t/2
+; RUN: head -c8 %t/version.gcno | grep '^oncg.204'
+; RUN: rm %t/version.gcno
+; RUN: not opt -insert-gcov-profiling -default-gcov-version=asdfasdf -disable-output < %t/2
+; RUN: opt -insert-gcov-profiling -default-gcov-version=407* -disable-output < %t/2
+; RUN: head -c8 %t/version.gcno | grep '^oncg.704'
+; RUN: rm %t/version.gcno
 
-; RUN: opt -passes=insert-gcov-profiling -disable-output < %t2
-; RUN: head -c8 %T/version.gcno | grep '^oncg.204'
-; RUN: rm %T/version.gcno
-; RUN: not opt -passes=insert-gcov-profiling -default-gcov-version=asdfasdf -disable-output < %t2
-; RUN: opt -passes=insert-gcov-profiling -default-gcov-version=407* -disable-output < %t2
-; RUN: head -c8 %T/version.gcno | grep '^oncg.704'
-; RUN: rm %T/version.gcno
+; RUN: opt -passes=insert-gcov-profiling -disable-output < %t/2
+; RUN: head -c8 %t/version.gcno | grep '^oncg.204'
+; RUN: rm %t/version.gcno
+; RUN: not opt -passes=insert-gcov-profiling -default-gcov-version=asdfasdf -disable-output < %t/2
+; RUN: opt -passes=insert-gcov-profiling -default-gcov-version=407* -disable-output < %t/2
+; RUN: head -c8 %t/version.gcno | grep '^oncg.704'
+; RUN: rm %t/version.gcno
 
 define void @test() !dbg !5 {
   ret void, !dbg !8