[clang] clang: Remove requires system-linux from some driver tests (PR #111976)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 5 10:40:21 PST 2024


https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/111976

>From c9b2950be07d7272ece89b8bca6e3e982391a5c3 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Fri, 11 Oct 2024 14:33:32 +0400
Subject: [PATCH 1/8] clang: Remove requires system-linux from some driver
 tests

Works for me on macos.
---
 clang/test/Driver/amdgpu-hip-system-arch.c         | 1 -
 clang/test/Driver/amdgpu-openmp-system-arch-fail.c | 1 -
 clang/test/Driver/hip-partial-link.hip             | 2 +-
 clang/test/Driver/hip-temps-linux.hip              | 1 -
 clang/test/Driver/linker-wrapper.c                 | 6 ++----
 clang/test/Driver/nvptx-cuda-system-arch.c         | 1 -
 clang/test/Driver/openmp-system-arch.c             | 1 -
 7 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/clang/test/Driver/amdgpu-hip-system-arch.c b/clang/test/Driver/amdgpu-hip-system-arch.c
index f25a4087080f6d..7be7b9cad1be02 100644
--- a/clang/test/Driver/amdgpu-hip-system-arch.c
+++ b/clang/test/Driver/amdgpu-hip-system-arch.c
@@ -1,4 +1,3 @@
-// REQUIRES: system-linux
 // REQUIRES: shell
 
 // RUN: mkdir -p %t
diff --git a/clang/test/Driver/amdgpu-openmp-system-arch-fail.c b/clang/test/Driver/amdgpu-openmp-system-arch-fail.c
index 85c82e4598cb10..b7e1d0b2c56659 100644
--- a/clang/test/Driver/amdgpu-openmp-system-arch-fail.c
+++ b/clang/test/Driver/amdgpu-openmp-system-arch-fail.c
@@ -1,4 +1,3 @@
-// REQUIRES: system-linux
 // REQUIRES: shell
 
 // RUN: mkdir -p %t
diff --git a/clang/test/Driver/hip-partial-link.hip b/clang/test/Driver/hip-partial-link.hip
index 8b27f78f3bdd12..5580e569780194 100644
--- a/clang/test/Driver/hip-partial-link.hip
+++ b/clang/test/Driver/hip-partial-link.hip
@@ -1,4 +1,4 @@
-// REQUIRES: x86-registered-target, amdgpu-registered-target, lld, system-linux
+// REQUIRES: x86-registered-target, amdgpu-registered-target, lld
 
 // RUN: %clang -x hip --target=x86_64-unknown-linux-gnu --no-offload-new-driver \
 // RUN:   --offload-arch=gfx906 -c -nostdinc -nogpuinc -nohipwrapperinc \
diff --git a/clang/test/Driver/hip-temps-linux.hip b/clang/test/Driver/hip-temps-linux.hip
index 83a7528dd4560a..3fb8a94a3463c8 100644
--- a/clang/test/Driver/hip-temps-linux.hip
+++ b/clang/test/Driver/hip-temps-linux.hip
@@ -1,6 +1,5 @@
 // REQUIRES: x86-registered-target
 // REQUIRES: amdgpu-registered-target
-// REQUIRES: system-linux
 
 // Check no temporary files or directores are left after compilation.
 // RUN: rm -rf %t/mytmp
diff --git a/clang/test/Driver/linker-wrapper.c b/clang/test/Driver/linker-wrapper.c
index 470af4d5d70cac..5d20fc413e485d 100644
--- a/clang/test/Driver/linker-wrapper.c
+++ b/clang/test/Driver/linker-wrapper.c
@@ -2,8 +2,6 @@
 // REQUIRES: nvptx-registered-target
 // REQUIRES: amdgpu-registered-target
 
-// REQUIRES: system-linux
-
 // An externally visible variable so static libraries extract.
 __attribute__((visibility("protected"), used)) int x;
 
@@ -30,7 +28,7 @@ __attribute__((visibility("protected"), used)) int x;
 // RUN: clang-linker-wrapper --host-triple=x86_64-unknown-linux-gnu --dry-run --device-debug -O0 \
 // RUN:   --linker-path=/usr/bin/ld %t.o -o a.out 2>&1 | FileCheck %s --check-prefix=NVPTX-LINK-DEBUG
 
-// NVPTX-LINK-DEBUG: clang{{.*}} -o {{.*}}.img --target=nvptx64-nvidia-cuda -march=sm_70 -O2 -flto {{.*}}.o {{.*}}.o -g 
+// NVPTX-LINK-DEBUG: clang{{.*}} -o {{.*}}.img --target=nvptx64-nvidia-cuda -march=sm_70 -O2 -flto {{.*}}.o {{.*}}.o -g
 
 // RUN: clang-offload-packager -o %t.out \
 // RUN:   --image=file=%t.elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908 \
@@ -93,7 +91,7 @@ __attribute__((visibility("protected"), used)) int x;
 
 // CUDA: clang{{.*}} -o [[IMG_SM70:.+]] --target=nvptx64-nvidia-cuda -march=sm_70
 // CUDA: clang{{.*}} -o [[IMG_SM52:.+]] --target=nvptx64-nvidia-cuda -march=sm_52
-// CUDA: fatbinary{{.*}}-64 --create {{.*}}.fatbin --image=profile=sm_70,file=[[IMG_SM70]] --image=profile=sm_52,file=[[IMG_SM52]] 
+// CUDA: fatbinary{{.*}}-64 --create {{.*}}.fatbin --image=profile=sm_70,file=[[IMG_SM70]] --image=profile=sm_52,file=[[IMG_SM52]]
 // CUDA: usr/bin/ld{{.*}} {{.*}}.openmp.image.{{.*}}.o {{.*}}.cuda.image.{{.*}}.o
 
 // RUN: clang-offload-packager -o %t.out \
diff --git a/clang/test/Driver/nvptx-cuda-system-arch.c b/clang/test/Driver/nvptx-cuda-system-arch.c
index 6a8a218406d139..b6a7617930fc19 100644
--- a/clang/test/Driver/nvptx-cuda-system-arch.c
+++ b/clang/test/Driver/nvptx-cuda-system-arch.c
@@ -1,4 +1,3 @@
-// REQUIRES: system-linux
 // REQUIRES: shell
 
 // RUN: mkdir -p %t
diff --git a/clang/test/Driver/openmp-system-arch.c b/clang/test/Driver/openmp-system-arch.c
index cd49f460099666..75322dae69de46 100644
--- a/clang/test/Driver/openmp-system-arch.c
+++ b/clang/test/Driver/openmp-system-arch.c
@@ -1,4 +1,3 @@
-// REQUIRES: system-linux
 // REQUIRES: shell
 
 // RUN: mkdir -p %t

>From 322d58b6bd48d15b83aeda6d2e801c11ccedf621 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Tue, 15 Oct 2024 21:57:26 +0400
Subject: [PATCH 2/8] Add xfail zos to 3 tests

---
 clang/test/Driver/amdgpu-hip-system-arch.c | 1 +
 clang/test/Driver/nvptx-cuda-system-arch.c | 1 +
 clang/test/Driver/openmp-system-arch.c     | 1 +
 3 files changed, 3 insertions(+)

diff --git a/clang/test/Driver/amdgpu-hip-system-arch.c b/clang/test/Driver/amdgpu-hip-system-arch.c
index 7be7b9cad1be02..9c27bc09fb36cf 100644
--- a/clang/test/Driver/amdgpu-hip-system-arch.c
+++ b/clang/test/Driver/amdgpu-hip-system-arch.c
@@ -1,4 +1,5 @@
 // REQUIRES: shell
+// XFAIL: target={{.*}}-zos{{.*}}
 
 // RUN: mkdir -p %t
 // RUN: cp %S/Inputs/amdgpu-arch/amdgpu_arch_fail %t/
diff --git a/clang/test/Driver/nvptx-cuda-system-arch.c b/clang/test/Driver/nvptx-cuda-system-arch.c
index b6a7617930fc19..c54eeac73f73b5 100644
--- a/clang/test/Driver/nvptx-cuda-system-arch.c
+++ b/clang/test/Driver/nvptx-cuda-system-arch.c
@@ -1,4 +1,5 @@
 // REQUIRES: shell
+// XFAIL: target={{.*}}-zos{{.*}}
 
 // RUN: mkdir -p %t
 // RUN: cp %S/Inputs/nvptx-arch/nvptx_arch_fail %t/
diff --git a/clang/test/Driver/openmp-system-arch.c b/clang/test/Driver/openmp-system-arch.c
index 75322dae69de46..d097c6bc065484 100644
--- a/clang/test/Driver/openmp-system-arch.c
+++ b/clang/test/Driver/openmp-system-arch.c
@@ -1,4 +1,5 @@
 // REQUIRES: shell
+// XFAIL: target={{.*}}-zos{{.*}}
 
 // RUN: mkdir -p %t
 // RUN: cp %S/Inputs/amdgpu-arch/amdgpu_arch_fail %t/

>From 833a4550f20711c11e100875a4f45422a4cdbea8 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Wed, 16 Oct 2024 09:09:24 +0400
Subject: [PATCH 3/8] Fix path separator check on windows

---
 clang/test/Driver/hip-temps-linux.hip | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/clang/test/Driver/hip-temps-linux.hip b/clang/test/Driver/hip-temps-linux.hip
index 3fb8a94a3463c8..c04121268bf697 100644
--- a/clang/test/Driver/hip-temps-linux.hip
+++ b/clang/test/Driver/hip-temps-linux.hip
@@ -2,16 +2,16 @@
 // REQUIRES: amdgpu-registered-target
 
 // Check no temporary files or directores are left after compilation.
-// RUN: rm -rf %t/mytmp
-// RUN: mkdir -p %t/mytmp
+// RUN: rm -rf %t%{fs-sep}mytmp
+// RUN: mkdir -p %t%{fs-sep}mytmp
 // RUN: env TMPDIR="%t/mytmp" %clang --target=x86_64-linux-gnu -nogpulib -nogpuinc \
 // RUN:   --rocm-path=%S/Inputs/rocm -nostdinc -nostdlib -c \
 // RUN:   --offload-arch=gfx1030 -emit-llvm -v %s 2>&1 | \
-// RUN:   FileCheck -check-prefixes=CHECK %s
+// RUN:   FileCheck -DTMPDIR=%t%{fs-sep}mytmp%{fs-sep} %s
 // RUN: ls %t/mytmp >%t/mytmp.txt 2>&1
 // RUN: touch %t/empty.txt
 // RUN: diff %t/mytmp.txt %t/empty.txt
 
-// CHECK: -o {{.*}}/mytmp/hip-temps-linux-gfx1030-{{.*}}.bc
+// CHECK: -o {{.*}}[[TMPDIR]]hip-temps-linux-gfx1030-{{.*}}.bc
 
 int main() {}

>From ba074b3258549b83e57a987b4d0984e88721d561 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Wed, 16 Oct 2024 16:01:54 +0400
Subject: [PATCH 4/8] Try to fix windows

---
 clang/test/Driver/hip-temps-linux.hip | 5 +++--
 clang/test/Driver/linker-wrapper.c    | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/clang/test/Driver/hip-temps-linux.hip b/clang/test/Driver/hip-temps-linux.hip
index c04121268bf697..12968ebdd024c7 100644
--- a/clang/test/Driver/hip-temps-linux.hip
+++ b/clang/test/Driver/hip-temps-linux.hip
@@ -4,8 +4,9 @@
 // Check no temporary files or directores are left after compilation.
 // RUN: rm -rf %t%{fs-sep}mytmp
 // RUN: mkdir -p %t%{fs-sep}mytmp
-// RUN: env TMPDIR="%t/mytmp" %clang --target=x86_64-linux-gnu -nogpulib -nogpuinc \
-// RUN:   --rocm-path=%S/Inputs/rocm -nostdinc -nostdlib -c \
+// RUN: env TMPDIR="%t/mytmp" TMP="%t/mytmp" %clang --target=x86_64-linux-gnu \
+// RUN:   -nogpulib -nogpuinc -nostdinc -nostdlib \
+// RUN:   --rocm-path=%S/Inputs/rocm -c \
 // RUN:   --offload-arch=gfx1030 -emit-llvm -v %s 2>&1 | \
 // RUN:   FileCheck -DTMPDIR=%t%{fs-sep}mytmp%{fs-sep} %s
 // RUN: ls %t/mytmp >%t/mytmp.txt 2>&1
diff --git a/clang/test/Driver/linker-wrapper.c b/clang/test/Driver/linker-wrapper.c
index 5d20fc413e485d..fac4331e51f694 100644
--- a/clang/test/Driver/linker-wrapper.c
+++ b/clang/test/Driver/linker-wrapper.c
@@ -118,7 +118,7 @@ __attribute__((visibility("protected"), used)) int x;
 
 // HIP: clang{{.*}} -o [[IMG_GFX90A:.+]] --target=amdgcn-amd-amdhsa -mcpu=gfx90a
 // HIP: clang{{.*}} -o [[IMG_GFX908:.+]] --target=amdgcn-amd-amdhsa -mcpu=gfx908
-// HIP: clang-offload-bundler{{.*}}-type=o -bundle-align=4096 -compress -compression-level=6 -targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx90a,hip-amdgcn-amd-amdhsa--gfx908 -input=/dev/null -input=[[IMG_GFX90A]] -input=[[IMG_GFX908]] -output={{.*}}.hipfb
+// HIP: clang-offload-bundler{{.*}}-type=o -bundle-align=4096 -compress -compression-level=6 -targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx90a,hip-amdgcn-amd-amdhsa--gfx908 -input={{/dev/null|NUL}} -input=[[IMG_GFX90A]] -input=[[IMG_GFX908]] -output={{.*}}.hipfb
 
 // RUN: clang-offload-packager -o %t.out \
 // RUN:   --image=file=%t.elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908 \
@@ -209,7 +209,7 @@ __attribute__((visibility("protected"), used)) int x;
 // RUN:   %t.o -o a.out 2>&1 | FileCheck %s --check-prefix=RELOCATABLE-LINK-HIP
 
 // RELOCATABLE-LINK-HIP: clang{{.*}} -o {{.*}}.img --target=amdgcn-amd-amdhsa
-// RELOCATABLE-LINK-HIP: clang-offload-bundler{{.*}} -type=o -bundle-align=4096 -targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx90a -input=/dev/null -input={{.*}} -output={{.*}}
+// RELOCATABLE-LINK-HIP: clang-offload-bundler{{.*}} -type=o -bundle-align=4096 -targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx90a -input={{/dev/null|NUL}} -input={{.*}} -output={{.*}}
 // RELOCATABLE-LINK-HIP: /usr/bin/ld.lld{{.*}}-r
 // RELOCATABLE-LINK-HIP: llvm-objcopy{{.*}}a.out --remove-section .llvm.offloading
 

>From bf15969b7b6dd9f230b13656d953f7685a90a131 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Wed, 16 Oct 2024 17:47:51 +0400
Subject: [PATCH 5/8] Try to fix windows

---
 clang/test/Driver/hip-temps-linux.hip | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/clang/test/Driver/hip-temps-linux.hip b/clang/test/Driver/hip-temps-linux.hip
index 12968ebdd024c7..387ea81e25fce0 100644
--- a/clang/test/Driver/hip-temps-linux.hip
+++ b/clang/test/Driver/hip-temps-linux.hip
@@ -1,10 +1,11 @@
 // REQUIRES: x86-registered-target
 // REQUIRES: amdgpu-registered-target
 
-// Check no temporary files or directores are left after compilation.
+// Check no temporary files or directories are left after compilation.
+
 // RUN: rm -rf %t%{fs-sep}mytmp
 // RUN: mkdir -p %t%{fs-sep}mytmp
-// RUN: env TMPDIR="%t/mytmp" TMP="%t/mytmp" %clang --target=x86_64-linux-gnu \
+// RUN: env TMPDIR="%t/mytmp" TEMP="%t/mytmp" TMP="%t/mytmp" %clang --target=x86_64-linux-gnu \
 // RUN:   -nogpulib -nogpuinc -nostdinc -nostdlib \
 // RUN:   --rocm-path=%S/Inputs/rocm -c \
 // RUN:   --offload-arch=gfx1030 -emit-llvm -v %s 2>&1 | \

>From 64f68ca257df0514cd13cb83577b8cf77c776e40 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Fri, 18 Oct 2024 09:40:28 +0400
Subject: [PATCH 6/8] Revert the hard cases

---
 clang/test/Driver/hip-partial-link.hip |  2 +-
 clang/test/Driver/linker-wrapper.c     | 10 ++++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/clang/test/Driver/hip-partial-link.hip b/clang/test/Driver/hip-partial-link.hip
index 5580e569780194..8b27f78f3bdd12 100644
--- a/clang/test/Driver/hip-partial-link.hip
+++ b/clang/test/Driver/hip-partial-link.hip
@@ -1,4 +1,4 @@
-// REQUIRES: x86-registered-target, amdgpu-registered-target, lld
+// REQUIRES: x86-registered-target, amdgpu-registered-target, lld, system-linux
 
 // RUN: %clang -x hip --target=x86_64-unknown-linux-gnu --no-offload-new-driver \
 // RUN:   --offload-arch=gfx906 -c -nostdinc -nogpuinc -nohipwrapperinc \
diff --git a/clang/test/Driver/linker-wrapper.c b/clang/test/Driver/linker-wrapper.c
index fac4331e51f694..470af4d5d70cac 100644
--- a/clang/test/Driver/linker-wrapper.c
+++ b/clang/test/Driver/linker-wrapper.c
@@ -2,6 +2,8 @@
 // REQUIRES: nvptx-registered-target
 // REQUIRES: amdgpu-registered-target
 
+// REQUIRES: system-linux
+
 // An externally visible variable so static libraries extract.
 __attribute__((visibility("protected"), used)) int x;
 
@@ -28,7 +30,7 @@ __attribute__((visibility("protected"), used)) int x;
 // RUN: clang-linker-wrapper --host-triple=x86_64-unknown-linux-gnu --dry-run --device-debug -O0 \
 // RUN:   --linker-path=/usr/bin/ld %t.o -o a.out 2>&1 | FileCheck %s --check-prefix=NVPTX-LINK-DEBUG
 
-// NVPTX-LINK-DEBUG: clang{{.*}} -o {{.*}}.img --target=nvptx64-nvidia-cuda -march=sm_70 -O2 -flto {{.*}}.o {{.*}}.o -g
+// NVPTX-LINK-DEBUG: clang{{.*}} -o {{.*}}.img --target=nvptx64-nvidia-cuda -march=sm_70 -O2 -flto {{.*}}.o {{.*}}.o -g 
 
 // RUN: clang-offload-packager -o %t.out \
 // RUN:   --image=file=%t.elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908 \
@@ -91,7 +93,7 @@ __attribute__((visibility("protected"), used)) int x;
 
 // CUDA: clang{{.*}} -o [[IMG_SM70:.+]] --target=nvptx64-nvidia-cuda -march=sm_70
 // CUDA: clang{{.*}} -o [[IMG_SM52:.+]] --target=nvptx64-nvidia-cuda -march=sm_52
-// CUDA: fatbinary{{.*}}-64 --create {{.*}}.fatbin --image=profile=sm_70,file=[[IMG_SM70]] --image=profile=sm_52,file=[[IMG_SM52]]
+// CUDA: fatbinary{{.*}}-64 --create {{.*}}.fatbin --image=profile=sm_70,file=[[IMG_SM70]] --image=profile=sm_52,file=[[IMG_SM52]] 
 // CUDA: usr/bin/ld{{.*}} {{.*}}.openmp.image.{{.*}}.o {{.*}}.cuda.image.{{.*}}.o
 
 // RUN: clang-offload-packager -o %t.out \
@@ -118,7 +120,7 @@ __attribute__((visibility("protected"), used)) int x;
 
 // HIP: clang{{.*}} -o [[IMG_GFX90A:.+]] --target=amdgcn-amd-amdhsa -mcpu=gfx90a
 // HIP: clang{{.*}} -o [[IMG_GFX908:.+]] --target=amdgcn-amd-amdhsa -mcpu=gfx908
-// HIP: clang-offload-bundler{{.*}}-type=o -bundle-align=4096 -compress -compression-level=6 -targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx90a,hip-amdgcn-amd-amdhsa--gfx908 -input={{/dev/null|NUL}} -input=[[IMG_GFX90A]] -input=[[IMG_GFX908]] -output={{.*}}.hipfb
+// HIP: clang-offload-bundler{{.*}}-type=o -bundle-align=4096 -compress -compression-level=6 -targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx90a,hip-amdgcn-amd-amdhsa--gfx908 -input=/dev/null -input=[[IMG_GFX90A]] -input=[[IMG_GFX908]] -output={{.*}}.hipfb
 
 // RUN: clang-offload-packager -o %t.out \
 // RUN:   --image=file=%t.elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908 \
@@ -209,7 +211,7 @@ __attribute__((visibility("protected"), used)) int x;
 // RUN:   %t.o -o a.out 2>&1 | FileCheck %s --check-prefix=RELOCATABLE-LINK-HIP
 
 // RELOCATABLE-LINK-HIP: clang{{.*}} -o {{.*}}.img --target=amdgcn-amd-amdhsa
-// RELOCATABLE-LINK-HIP: clang-offload-bundler{{.*}} -type=o -bundle-align=4096 -targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx90a -input={{/dev/null|NUL}} -input={{.*}} -output={{.*}}
+// RELOCATABLE-LINK-HIP: clang-offload-bundler{{.*}} -type=o -bundle-align=4096 -targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx90a -input=/dev/null -input={{.*}} -output={{.*}}
 // RELOCATABLE-LINK-HIP: /usr/bin/ld.lld{{.*}}-r
 // RELOCATABLE-LINK-HIP: llvm-objcopy{{.*}}a.out --remove-section .llvm.offloading
 

>From c7773417b9b3afb08a2889965b4b0ecf784cc0a7 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Mon, 28 Oct 2024 15:29:47 -0700
Subject: [PATCH 7/8] More fs-sep

---
 clang/test/Driver/hip-temps-linux.hip | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/clang/test/Driver/hip-temps-linux.hip b/clang/test/Driver/hip-temps-linux.hip
index 387ea81e25fce0..c7cccd02f63ff1 100644
--- a/clang/test/Driver/hip-temps-linux.hip
+++ b/clang/test/Driver/hip-temps-linux.hip
@@ -5,14 +5,14 @@
 
 // RUN: rm -rf %t%{fs-sep}mytmp
 // RUN: mkdir -p %t%{fs-sep}mytmp
-// RUN: env TMPDIR="%t/mytmp" TEMP="%t/mytmp" TMP="%t/mytmp" %clang --target=x86_64-linux-gnu \
+// RUN: env TMPDIR="%t%{fs-sep}mytmp" TEMP="%t%{fs-sep}mytmp" TMP="%t%{fs-sep}mytmp" %clang --target=x86_64-linux-gnu \
 // RUN:   -nogpulib -nogpuinc -nostdinc -nostdlib \
 // RUN:   --rocm-path=%S/Inputs/rocm -c \
 // RUN:   --offload-arch=gfx1030 -emit-llvm -v %s 2>&1 | \
 // RUN:   FileCheck -DTMPDIR=%t%{fs-sep}mytmp%{fs-sep} %s
-// RUN: ls %t/mytmp >%t/mytmp.txt 2>&1
-// RUN: touch %t/empty.txt
-// RUN: diff %t/mytmp.txt %t/empty.txt
+// RUN: ls %t%{fs-sep}mytmp >%t%{fs-sep}mytmp.txt 2>&1
+// RUN: touch %t%{fs-sep}empty.txt
+// RUN: diff %t%{fs-sep}mytmp.txt %t%{fs-sep}empty.txt
 
 // CHECK: -o {{.*}}[[TMPDIR]]hip-temps-linux-gfx1030-{{.*}}.bc
 

>From 8c678b6d5144e3f8e958acfb56b01670855ea7bf Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Tue, 5 Nov 2024 09:54:21 -0800
Subject: [PATCH 8/8] Try again and relax the windows test too

---
 clang/test/Driver/hip-temps-linux.hip   | 22 ++++++++++------------
 clang/test/Driver/hip-temps-windows.hip |  7 +++----
 2 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/clang/test/Driver/hip-temps-linux.hip b/clang/test/Driver/hip-temps-linux.hip
index c7cccd02f63ff1..3981eb0abfd5ce 100644
--- a/clang/test/Driver/hip-temps-linux.hip
+++ b/clang/test/Driver/hip-temps-linux.hip
@@ -1,19 +1,17 @@
 // REQUIRES: x86-registered-target
 // REQUIRES: amdgpu-registered-target
 
-// Check no temporary files or directories are left after compilation.
-
-// RUN: rm -rf %t%{fs-sep}mytmp
-// RUN: mkdir -p %t%{fs-sep}mytmp
-// RUN: env TMPDIR="%t%{fs-sep}mytmp" TEMP="%t%{fs-sep}mytmp" TMP="%t%{fs-sep}mytmp" %clang --target=x86_64-linux-gnu \
-// RUN:   -nogpulib -nogpuinc -nostdinc -nostdlib \
-// RUN:   --rocm-path=%S/Inputs/rocm -c \
+// Check no temporary files or directores are left after compilation.
+// RUN: rm -rf %t/mytmp
+// RUN: mkdir -p %t/mytmp
+// RUN: env TMP="%t/mytmp" TMPDIR="%t/mytmp" %clang --target=x86_64-linux-gnu -nogpulib -nogpuinc \
+// RUN:   --rocm-path=%S/Inputs/rocm -nostdinc -nostdlib -c \
 // RUN:   --offload-arch=gfx1030 -emit-llvm -v %s 2>&1 | \
-// RUN:   FileCheck -DTMPDIR=%t%{fs-sep}mytmp%{fs-sep} %s
-// RUN: ls %t%{fs-sep}mytmp >%t%{fs-sep}mytmp.txt 2>&1
-// RUN: touch %t%{fs-sep}empty.txt
-// RUN: diff %t%{fs-sep}mytmp.txt %t%{fs-sep}empty.txt
+// RUN:   FileCheck -check-prefixes=CHECK -DOUTPUT_PATH=%t%{fs-sep}mytmp%{fs-sep} %s
+// RUN: ls %t/mytmp >%t/mytmp.txt 2>&1
+// RUN: touch %t/empty.txt
+// RUN: diff %t/mytmp.txt %t/empty.txt
 
-// CHECK: -o {{.*}}[[TMPDIR]]hip-temps-linux-gfx1030-{{.*}}.bc
+// CHECK: -o {{"?}}[[OUTPUT_PATH]]hip-temps-linux-gfx1030-{{.*}}.bc{{"?}}
 
 int main() {}
diff --git a/clang/test/Driver/hip-temps-windows.hip b/clang/test/Driver/hip-temps-windows.hip
index ac1ac208a65dc5..46d11dedc8a11c 100644
--- a/clang/test/Driver/hip-temps-windows.hip
+++ b/clang/test/Driver/hip-temps-windows.hip
@@ -1,18 +1,17 @@
 // REQUIRES: x86-registered-target
 // REQUIRES: amdgpu-registered-target
-// REQUIRES: system-windows
 
 // Check no temporary files or directores are left after compilation.
 // RUN: rm -rf %t/mytmp
 // RUN: mkdir -p %t/mytmp
-// RUN: env TMP="%t/mytmp" %clang --target=x86_64-pc-windows-msvc -nogpulib -nogpuinc \
+// RUN: env TMP="%t/mytmp" TMPDIR="%t/mytmp" %clang --target=x86_64-pc-windows-msvc -nogpulib -nogpuinc \
 // RUN:   --rocm-path=%S/Inputs/rocm -nostdinc -nostdlib -c \
 // RUN:   --offload-arch=gfx1030 -emit-llvm -v %s 2>&1 | \
-// RUN:   FileCheck -check-prefixes=CHECK %s
+// RUN:   FileCheck -check-prefixes=CHECK -DOUTPUT_PATH=%t%{fs-sep}mytmp%{fs-sep} %s
 // RUN: ls %t/mytmp >%t/mytmp.txt 2>&1
 // RUN: touch %t/empty.txt
 // RUN: diff %t/mytmp.txt %t/empty.txt
 
-// CHECK: -o "{{.*}}mytmp{{/|\\\\}}hip-temps-windows-gfx1030-{{.*}}.bc"
+// CHECK: -o [[OUTPUT_PATH]]hip-temps-windows-gfx1030-{{.*}}.bc
 
 int main() {}



More information about the cfe-commits mailing list