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
2323CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.pdb
2424CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe
2525CHECK-32: compiling foobar.c -> foo.exe-foobar.obj
26- CHECK-32: {{.*}}clang-cl{{(.exe )?}} -m32
26+ CHECK-32: {{.*}}clang-cl{{(\.EXE )?}} -m32
2727CHECK-32: linking foo.exe-foobar.obj -> foo.exe
28- CHECK-32: {{.*}}lld-link
28+ CHECK-32: {{.*}}lld-link{{(\.EXE)?}}
2929
3030CHECK-64: Script Arguments:
3131CHECK-64: Arch: 64
@@ -44,6 +44,6 @@ CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe-foobar.obj
4444CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.pdb
4545CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe
4646CHECK-64: compiling foobar.c -> foo.exe-foobar.obj
47- CHECK-64: {{.*}}clang-cl{{(.exe )?}} -m64
47+ CHECK-64: {{.*}}clang-cl{{(\.EXE )?}} -m64
4848CHECK-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
77CHECK: Cleaning {{.*}}toolchain-clang.test.tmp{{.}}foo.exe-foobar.o
88CHECK: Cleaning {{.*}}toolchain-clang.test.tmp{{.}}foo.exe
99CHECK: 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
1212CHECK: 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
232332BIT: Cleaning {{.*}}toolchain-msvc.test.tmp\foo.pdb
242432BIT: Cleaning {{.*}}toolchain-msvc.test.tmp\foo.exe
252532BIT: 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
272732BIT: 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
292932BIT: Env
303032BIT: LIB = {{.*}}\ATLMFC\lib\{{(x86|arm)}}
313132BIT: {{.*}}\lib\{{(x86|arm)}}
@@ -51,9 +51,9 @@ RUN: | FileCheck --check-prefix=64BIT %s
515164BIT: Cleaning {{.*}}toolchain-msvc.test.tmp\foo.pdb
525264BIT: Cleaning {{.*}}toolchain-msvc.test.tmp\foo.exe
535364BIT: 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
555564BIT: 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
575764BIT: Env
585864BIT: LIB = {{.*}}\ATLMFC\lib\{{(x64|arm64)}}
595964BIT: {{.*}}\lib\{{(x64|arm64)}}
Original file line number Diff line number Diff line change 44
55import argparse
66import os
7+ import shutil
78import signal
89import subprocess
910import sys
@@ -170,16 +171,14 @@ def print_environment(env):
170171 print (' {0} = {1}' .format (e , formatted_value ))
171172
172173def 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
183182
184183def find_toolchain (compiler , tools_dir ):
185184 if compiler == 'msvc' :
You can’t perform that action at this time.
0 commit comments