Skip to content

Commit 952b133

Browse files
authored
[clang][compiler-rt][test] Removed dirname command substitutions from tests (#105754)
This patch rewrites tests in clang and compiler-rt that uses bash command substitution syntax $() to execute the dirname command. This is done so that the tests can be run using lit's internal shell. Fixes #102384.
1 parent 1990d8d commit 952b133

File tree

2 files changed

+56
-54
lines changed

2 files changed

+56
-54
lines changed

clang/test/Driver/offload-packager.c

Lines changed: 50 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -3,63 +3,64 @@
33
// REQUIRES: amdgpu-registered-target
44
// UNSUPPORTED: system-windows
55

6-
// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t.elf.o
6+
// RUN: rm -rf %t && mkdir -p %t
7+
// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t/elf.o
78

89
// Check that we can extract files from the packaged binary.
9-
// RUN: clang-offload-packager -o %t.out \
10-
// RUN: --image=file=%t.elf.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_70 \
11-
// RUN: --image=file=%t.elf.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_80 \
12-
// RUN: --image=file=%t.elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908 \
13-
// RUN: --image=file=%t.elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx90a \
14-
// RUN: --image=file=%t.elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx90c
15-
// RUN: clang-offload-packager %t.out \
16-
// RUN: --image=file=%t-sm_70.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_70 \
17-
// RUN: --image=file=%t-gfx908.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908
18-
// RUN: diff %t-sm_70.o %t.elf.o
19-
// RUN: diff %t-gfx908.o %t.elf.o
10+
// RUN: clang-offload-packager -o %t/package.out \
11+
// RUN: --image=file=%t/elf.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_70 \
12+
// RUN: --image=file=%t/elf.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_80 \
13+
// RUN: --image=file=%t/elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908 \
14+
// RUN: --image=file=%t/elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx90a \
15+
// RUN: --image=file=%t/elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx90c
16+
// RUN: clang-offload-packager %t/package.out \
17+
// RUN: --image=file=%t/sm_70.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_70 \
18+
// RUN: --image=file=%t/gfx908.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908
19+
// RUN: diff %t/sm_70.o %t/elf.o
20+
// RUN: diff %t/gfx908.o %t/elf.o
2021

2122
// Check that we generate a new name if one is not given
22-
// RUN: clang-offload-packager -o %t \
23-
// RUN: --image=file=%t.elf.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_70 \
24-
// RUN: --image=file=%t.elf.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_80 \
25-
// RUN: --image=file=%t.elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908 \
26-
// RUN: --image=file=%t.elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx90a \
27-
// RUN: --image=file=%t.elf.o,kind=hip,triple=amdgcn-amd-amdhsa,arch=gfx90c
28-
// RUN: cd $(dirname "%t") && clang-offload-packager %t --image=kind=openmp
29-
// RUN: diff *-nvptx64-nvidia-cuda-sm_70.0.o %t.elf.o; rm *-nvptx64-nvidia-cuda-sm_70.0.o
30-
// RUN: diff *-nvptx64-nvidia-cuda-sm_80.1.o %t.elf.o; rm *-nvptx64-nvidia-cuda-sm_80.1.o
31-
// RUN: diff *-amdgcn-amd-amdhsa-gfx908.2.o %t.elf.o; rm *-amdgcn-amd-amdhsa-gfx908.2.o
32-
// RUN: diff *-amdgcn-amd-amdhsa-gfx90a.3.o %t.elf.o; rm *-amdgcn-amd-amdhsa-gfx90a.3.o
33-
// RUN: not diff *-amdgcn-amd-amdhsa-gfx90c.4.o %t.elf.o
23+
// RUN: clang-offload-packager -o %t/package \
24+
// RUN: --image=file=%t/elf.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_70 \
25+
// RUN: --image=file=%t/elf.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_80 \
26+
// RUN: --image=file=%t/elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908 \
27+
// RUN: --image=file=%t/elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx90a \
28+
// RUN: --image=file=%t/elf.o,kind=hip,triple=amdgcn-amd-amdhsa,arch=gfx90c
29+
// RUN: clang-offload-packager %t/package --image=kind=openmp
30+
// RUN: diff *-nvptx64-nvidia-cuda-sm_70.0.o %t/elf.o; rm *-nvptx64-nvidia-cuda-sm_70.0.o
31+
// RUN: diff *-nvptx64-nvidia-cuda-sm_80.1.o %t/elf.o; rm *-nvptx64-nvidia-cuda-sm_80.1.o
32+
// RUN: diff *-amdgcn-amd-amdhsa-gfx908.2.o %t/elf.o; rm *-amdgcn-amd-amdhsa-gfx908.2.o
33+
// RUN: diff *-amdgcn-amd-amdhsa-gfx90a.3.o %t/elf.o; rm *-amdgcn-amd-amdhsa-gfx90a.3.o
34+
// RUN: not diff *-amdgcn-amd-amdhsa-gfx90c.4.o %t/elf.o
3435

3536
// Check that we can extract from an ELF object file
36-
// RUN: clang-offload-packager -o %t.out \
37-
// RUN: --image=file=%t.elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908 \
38-
// RUN: --image=file=%t.elf.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_70
39-
// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t.o -fembed-offload-object=%t.out
40-
// RUN: clang-offload-packager %t.out \
41-
// RUN: --image=file=%t-sm_70.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_70 \
42-
// RUN: --image=file=%t-gfx908.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908
43-
// RUN: diff %t-sm_70.o %t.elf.o
44-
// RUN: diff %t-gfx908.o %t.elf.o
37+
// RUN: clang-offload-packager -o %t/package.out \
38+
// RUN: --image=file=%t/elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908 \
39+
// RUN: --image=file=%t/elf.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_70
40+
// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t/package.o -fembed-offload-object=%t/package.out
41+
// RUN: clang-offload-packager %t/package.out \
42+
// RUN: --image=file=%t/sm_70.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_70 \
43+
// RUN: --image=file=%t/gfx908.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908
44+
// RUN: diff %t/sm_70.o %t/elf.o
45+
// RUN: diff %t/gfx908.o %t/elf.o
4546

4647
// Check that we can extract from a bitcode file
47-
// RUN: clang-offload-packager -o %t.out \
48-
// RUN: --image=file=%t.elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908 \
49-
// RUN: --image=file=%t.elf.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_70
50-
// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -o %t.bc -fembed-offload-object=%t.out
51-
// RUN: clang-offload-packager %t.out \
52-
// RUN: --image=file=%t-sm_70.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_70 \
53-
// RUN: --image=file=%t-gfx908.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908
54-
// RUN: diff %t-sm_70.o %t.elf.o
55-
// RUN: diff %t-gfx908.o %t.elf.o
48+
// RUN: clang-offload-packager -o %t/package.out \
49+
// RUN: --image=file=%t/elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908 \
50+
// RUN: --image=file=%t/elf.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_70
51+
// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -o %t/package.bc -fembed-offload-object=%t/package.out
52+
// RUN: clang-offload-packager %t/package.out \
53+
// RUN: --image=file=%t/sm_70.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_70 \
54+
// RUN: --image=file=%t/gfx908.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908
55+
// RUN: diff %t/sm_70.o %t/elf.o
56+
// RUN: diff %t/gfx908.o %t/elf.o
5657

5758
// Check that we can extract from an archive file to an archive file.
58-
// RUN: clang-offload-packager -o %t.out \
59-
// RUN: --image=file=%t.elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908 \
60-
// RUN: --image=file=%t.elf.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_70
61-
// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t.o -fembed-offload-object=%t.out
62-
// RUN: llvm-ar rcs %t.a %t.o
63-
// RUN: clang-offload-packager %t.a --archive --image=file=%t-gfx908.a,arch=gfx908
64-
// RUN: llvm-ar t %t-gfx908.a 2>&1 | FileCheck %s
59+
// RUN: clang-offload-packager -o %t/package.out \
60+
// RUN: --image=file=%t/elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908 \
61+
// RUN: --image=file=%t/elf.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_70
62+
// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t/package.o -fembed-offload-object=%t/package.out
63+
// RUN: llvm-ar rcs %t/package.a %t/package.o
64+
// RUN: clang-offload-packager %t/package.a --archive --image=file=%t/gfx908.a,arch=gfx908
65+
// RUN: llvm-ar t %t/gfx908.a 2>&1 | FileCheck %s
6566
// CHECK: {{.*}}.o

compiler-rt/test/hwasan/TestCases/hwasan_symbolize.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
// RUN: %clang_hwasan -Wl,--build-id -g %s -o %t
2-
// RUN: echo '[{"prefix": "'"$(realpath $(dirname %s))"'/", "link": "http://test.invalid/{file}:{line}"}]' > %t.linkify
3-
// RUN: %env_hwasan_opts=symbolize=0 not %run %t 2>&1 | hwasan_symbolize --html --symbols $(dirname %t) --index | FileCheck %s
4-
// RUN: %env_hwasan_opts=symbolize=0 not %run %t 2>&1 | hwasan_symbolize --html --linkify %t.linkify --symbols $(dirname %t) --index | FileCheck --check-prefixes=CHECK,LINKIFY %s
5-
// RUN: %env_hwasan_opts=symbolize=0 not %run %t 2>&1 | hwasan_symbolize --symbols $(dirname %t) --index | FileCheck %s
1+
// RUN: rm -rf %t && mkdir -p %t
2+
// RUN: %clang_hwasan -Wl,--build-id -g %s -o %t/hwasan_symbolize_test
3+
// RUN: echo '[{"prefix": "'"%S"'/", "link": "http://test.invalid/{file}:{line}"}]' > %t/hwasan_symbolize_test.linkify
4+
// RUN: %env_hwasan_opts=symbolize=0 not %run %t/hwasan_symbolize_test 2>&1 | hwasan_symbolize --html --symbols %t --index | FileCheck %s
5+
// RUN: %env_hwasan_opts=symbolize=0 not %run %t/hwasan_symbolize_test 2>&1 | hwasan_symbolize --html --linkify %t/hwasan_symbolize_test.linkify --symbols %t --index | FileCheck --check-prefixes=CHECK,LINKIFY %s
6+
// RUN: %env_hwasan_opts=symbolize=0 not %run %t/hwasan_symbolize_test 2>&1 | hwasan_symbolize --symbols %t --index | FileCheck %s
67

78
#include <sanitizer/hwasan_interface.h>
89
#include <stdlib.h>

0 commit comments

Comments
 (0)