File tree Expand file tree Collapse file tree 4 files changed +21
-22
lines changed Expand file tree Collapse file tree 4 files changed +21
-22
lines changed Original file line number Diff line number Diff line change @@ -23,9 +23,9 @@ CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe-foobar.obj
23
23
CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.pdb
24
24
CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe
25
25
CHECK-32: compiling foobar.c -> foo.exe-foobar.obj
26
- CHECK-32: {{.*}}clang-cl{{(.exe )?}} -m32
26
+ CHECK-32: {{.*}}clang-cl{{(\.EXE )?}} -m32
27
27
CHECK-32: linking foo.exe-foobar.obj -> foo.exe
28
- CHECK-32: {{.*}}lld-link
28
+ CHECK-32: {{.*}}lld-link{{(\.EXE)?}}
29
29
30
30
CHECK-64: Script Arguments:
31
31
CHECK-64: Arch: 64
@@ -44,6 +44,6 @@ CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe-foobar.obj
44
44
CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.pdb
45
45
CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe
46
46
CHECK-64: compiling foobar.c -> foo.exe-foobar.obj
47
- CHECK-64: {{.*}}clang-cl{{(.exe )?}} -m64
47
+ CHECK-64: {{.*}}clang-cl{{(\.EXE )?}} -m64
48
48
CHECK-64: linking foo.exe-foobar.obj -> foo.exe
49
- CHECK-64: {{.*}}lld-link{{(.exe )?}}
49
+ CHECK-64: {{.*}}lld-link{{(\.EXE )?}}
Original file line number Diff line number Diff line change @@ -7,8 +7,8 @@ RUN: | FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 %s
7
7
CHECK: Cleaning {{.*}}toolchain-clang.test.tmp{{.}}foo.exe-foobar.o
8
8
CHECK: Cleaning {{.*}}toolchain-clang.test.tmp{{.}}foo.exe
9
9
CHECK: compiling foobar.c -> foo.exe-foobar.o
10
- CHECK-32: {{.*}}clang++{{(.exe )?}} -m32 -g -O0 -c -o {{.*}}foo.exe-foobar.o {{.*}}foobar.c
11
- CHECK-64: {{.*}}clang++{{(.exe )?}} -m64 -g -O0 -c -o {{.*}}foo.exe-foobar.o {{.*}}foobar.c
10
+ CHECK-32: {{.*}}clang++{{(\.EXE )?}} -m32 -g -O0 -c -o {{.*}}foo.exe-foobar.o {{.*}}foobar.c
11
+ CHECK-64: {{.*}}clang++{{(\.EXE )?}} -m64 -g -O0 -c -o {{.*}}foo.exe-foobar.o {{.*}}foobar.c
12
12
CHECK: linking foo.exe-foobar.o -> foo.exe
13
- CHECK-32: {{.*}}clang++{{(.exe )?}} -m32 {{(-L.* )?(-Wl,-rpath,.* )?}}-o {{.*}}foo.exe {{.*}}foo.exe-foobar.o
14
- CHECK-64: {{.*}}clang++{{(.exe )?}} -m64 {{(-L.* )?(-Wl,-rpath,.* )?}}-o {{.*}}foo.exe {{.*}}foo.exe-foobar.o
13
+ CHECK-32: {{.*}}clang++{{(\.EXE )?}} -m32 {{(-L.* )?(-Wl,-rpath,.* )?}}-o {{.*}}foo.exe {{.*}}foo.exe-foobar.o
14
+ CHECK-64: {{.*}}clang++{{(\.EXE )?}} -m64 {{(-L.* )?(-Wl,-rpath,.* )?}}-o {{.*}}foo.exe {{.*}}foo.exe-foobar.o
Original file line number Diff line number Diff line change @@ -23,9 +23,9 @@ RUN: | FileCheck --check-prefix=64BIT %s
23
23
32BIT: Cleaning {{.*}}toolchain-msvc.test.tmp\foo.pdb
24
24
32BIT: Cleaning {{.*}}toolchain-msvc.test.tmp\foo.exe
25
25
32BIT: compiling foobar.c -> foo.exe-foobar.obj
26
- 32BIT: Command Line: {{.*}}\{{[Hh]ost[Xx](64|86)}}\{{(x86|arm)}}\cl.exe
26
+ 32BIT: Command Line: {{.*}}\{{[Hh]ost[Xx](64|86)}}\{{(x86|arm)}}\cl.EXE
27
27
32BIT: linking foo.exe-foobar.obj -> foo.exe
28
- 32BIT: Command Line: {{.*}}\{{[Hh]ost[Xx](64|86)}}\{{(x86|arm)}}\link.exe
28
+ 32BIT: Command Line: {{.*}}\{{[Hh]ost[Xx](64|86)}}\{{(x86|arm)}}\link.EXE
29
29
32BIT: Env
30
30
32BIT: LIB = {{.*}}\ATLMFC\lib\{{(x86|arm)}}
31
31
32BIT: {{.*}}\lib\{{(x86|arm)}}
@@ -51,9 +51,9 @@ RUN: | FileCheck --check-prefix=64BIT %s
51
51
64BIT: Cleaning {{.*}}toolchain-msvc.test.tmp\foo.pdb
52
52
64BIT: Cleaning {{.*}}toolchain-msvc.test.tmp\foo.exe
53
53
64BIT: compiling foobar.c -> foo.exe-foobar.obj
54
- 64BIT: Command Line: {{.*}}\{{[Hh]ost[Xx](64|86)}}\{{(x64|arm64)}}\cl.exe
54
+ 64BIT: Command Line: {{.*}}\{{[Hh]ost[Xx](64|86)}}\{{(x64|arm64)}}\cl.EXE
55
55
64BIT: linking foo.exe-foobar.obj -> foo.exe
56
- 64BIT: Command Line: {{.*}}\{{[Hh]ost[Xx](64|86)}}\{{(x64|arm64)}}\link.exe
56
+ 64BIT: Command Line: {{.*}}\{{[Hh]ost[Xx](64|86)}}\{{(x64|arm64)}}\link.EXE
57
57
64BIT: Env
58
58
64BIT: LIB = {{.*}}\ATLMFC\lib\{{(x64|arm64)}}
59
59
64BIT: {{.*}}\lib\{{(x64|arm64)}}
Original file line number Diff line number Diff line change 4
4
5
5
import argparse
6
6
import os
7
+ import shutil
7
8
import signal
8
9
import subprocess
9
10
import sys
@@ -170,16 +171,14 @@ def print_environment(env):
170
171
print (' {0} = {1}' .format (e , formatted_value ))
171
172
172
173
def find_executable (binary_name , search_paths ):
173
- if sys .platform == 'win32' :
174
- binary_name = binary_name + '.exe'
175
-
176
- search_paths = os .pathsep .join (search_paths )
177
- paths = search_paths + os .pathsep + os .environ .get ('PATH' , '' )
178
- for path in paths .split (os .pathsep ):
179
- p = os .path .join (path , binary_name )
180
- if os .path .exists (p ) and not os .path .isdir (p ):
181
- return os .path .normpath (p )
182
- return None
174
+ # shutil.which will ignore PATH if given a path argument, we want to include it.
175
+ search_paths .append (os .environ .get ('PATH' , '' ))
176
+ search_path = os .pathsep .join (search_paths )
177
+ binary_path = shutil .which (binary_name , path = search_path )
178
+ if binary_path is not None :
179
+ # So for example, we get '/bin/gcc' instead of '/usr/../bin/gcc'.
180
+ binary_path = os .path .normpath (binary_path )
181
+ return binary_path
183
182
184
183
def find_toolchain (compiler , tools_dir ):
185
184
if compiler == 'msvc' :
You can’t perform that action at this time.
0 commit comments