@@ -217,52 +217,79 @@ end
217217
218218 @testset " Compiler wrappers" begin
219219 platform = Platform (" x86_64" , " linux" ; libc= " musl" )
220- mktempdir () do bin_path
221- platform_bin_dir = joinpath (bin_path, triplet (platform))
222- generate_compiler_wrappers! (platform; bin_path = bin_path)
223- # Make sure the C++ string ABI is not set
224- @test ! occursin (" -D_GLIBCXX_USE_CXX11_ABI" , read (joinpath (platform_bin_dir, " gcc" ), String))
225- # Make sure gfortran doesn't uses ccache when BinaryBuilderBase.use_ccache is true
226- BinaryBuilderBase. use_ccache[] && @test ! occursin (" ccache" , read (joinpath (platform_bin_dir, " gfortran" ), String))
220+ @testset " $(triplet (platform)) " begin
221+ mktempdir () do bin_path
222+ platform_bin_dir = joinpath (bin_path, triplet (platform))
223+ generate_compiler_wrappers! (platform; bin_path = bin_path)
224+ # Make sure the C++ string ABI is not set
225+ @test ! occursin (" -D_GLIBCXX_USE_CXX11_ABI" , read (joinpath (platform_bin_dir, " gcc" ), String))
226+ # Make sure gfortran doesn't uses ccache when BinaryBuilderBase.use_ccache is true
227+ BinaryBuilderBase. use_ccache[] && @test ! occursin (" ccache" , read (joinpath (platform_bin_dir, " gfortran" ), String))
228+ end
227229 end
228230 platform = Platform (" x86_64" , " linux" ; libc= " musl" , cxxstring_abi= " cxx03" )
229- mktempdir () do bin_path
230- platform_bin_dir = joinpath (bin_path, triplet (platform))
231- generate_compiler_wrappers! (platform; bin_path = bin_path)
232- gcc = read (joinpath (platform_bin_dir, " gcc" ), String)
233- # Make sure the C++ string ABI is set as expected
234- @test occursin (" -D_GLIBCXX_USE_CXX11_ABI=0" , gcc)
235- # Make sure the unsafe flags check is there
236- @test occursin (" You used one or more of the unsafe flags" , gcc)
231+ @testset " $(triplet (platform)) " begin
232+ mktempdir () do bin_path
233+ platform_bin_dir = joinpath (bin_path, triplet (platform))
234+ generate_compiler_wrappers! (platform; bin_path = bin_path)
235+ gcc = read (joinpath (platform_bin_dir, " gcc" ), String)
236+ # Make sure the C++ string ABI is set as expected
237+ @test occursin (" -D_GLIBCXX_USE_CXX11_ABI=0" , gcc)
238+ # Make sure the unsafe flags check is there
239+ @test occursin (" You used one or more of the unsafe flags" , gcc)
240+ end
237241 end
238242 platform = Platform (" x86_64" , " linux" ; libc= " musl" , cxxstring_abi= " cxx11" )
239- mktempdir () do bin_path
240- platform_bin_dir = joinpath (bin_path, triplet (platform))
241- generate_compiler_wrappers! (platform; bin_path = bin_path, allow_unsafe_flags = true )
242- gcc = read (joinpath (platform_bin_dir, " gcc" ), String)
243- # Make sure the C++ string ABI is set as expected
244- @test occursin (" -D_GLIBCXX_USE_CXX11_ABI=1" , gcc)
245- # Make sure the unsafe flags check is not there in this case
246- @test ! occursin (" You used one or more of the unsafe flags" , gcc)
243+ @testset " $(triplet (platform)) " begin
244+ mktempdir () do bin_path
245+ platform_bin_dir = joinpath (bin_path, triplet (platform))
246+ generate_compiler_wrappers! (platform; bin_path = bin_path, allow_unsafe_flags = true )
247+ gcc = read (joinpath (platform_bin_dir, " gcc" ), String)
248+ # Make sure the C++ string ABI is set as expected
249+ @test occursin (" -D_GLIBCXX_USE_CXX11_ABI=1" , gcc)
250+ # Make sure the unsafe flags check is not there in this case
251+ @test ! occursin (" You used one or more of the unsafe flags" , gcc)
252+ end
253+ end
254+ platform = Platform (" aarch64" , " macos" )
255+ @testset " $(triplet (platform)) " begin
256+ mktempdir () do bin_path
257+ platform_bin_dir = joinpath (bin_path, triplet (platform))
258+ generate_compiler_wrappers! (platform; bin_path = bin_path, gcc_version = v " 4" )
259+ if Sys. isunix ()
260+ cd (platform_bin_dir) do
261+ @test readchomp (` ./xcrun echo foo` ) == " foo"
262+ withenv (" SDKROOT" => " /bar" ) do
263+ @test readchomp (` ./xcrun --show-sdk-path` ) == " /bar"
264+ @test readchomp (` ./xcrun --show-sdk-path echo foo` ) == " /bar\n foo"
265+ @test readchomp (` ./xcrun --sdk /baz --show-sdk-path echo foo` ) == " /baz\n foo"
266+ end
267+ end
268+ end
269+ end
247270 end
248271 platform = Platform (" x86_64" , " freebsd" )
249- mktempdir () do bin_path
250- platform_bin_dir = joinpath (bin_path, triplet (platform))
251- generate_compiler_wrappers! (platform; bin_path = bin_path, compilers = [:c , :rust , :go ])
252- clang = read (joinpath (platform_bin_dir, " clang" ), String)
253- # Check link flags
254- @test occursin (" -L/opt/$(triplet (platform)) /$(triplet (platform)) /lib" , clang)
255- # Other compilers
256- @test occursin (" GOOS=\" freebsd\" " , read (joinpath (platform_bin_dir, " go" ), String))
257- @test occursin (" --target=x86_64-unknown-freebsd" , read (joinpath (platform_bin_dir, " rustc" ), String))
272+ @testset " $(triplet (platform)) " begin
273+ mktempdir () do bin_path
274+ platform_bin_dir = joinpath (bin_path, triplet (platform))
275+ generate_compiler_wrappers! (platform; bin_path = bin_path, compilers = [:c , :rust , :go ])
276+ clang = read (joinpath (platform_bin_dir, " clang" ), String)
277+ # Check link flags
278+ @test occursin (" -L/opt/$(triplet (platform)) /$(triplet (platform)) /lib" , clang)
279+ # Other compilers
280+ @test occursin (" GOOS=\" freebsd\" " , read (joinpath (platform_bin_dir, " go" ), String))
281+ @test occursin (" --target=x86_64-unknown-freebsd" , read (joinpath (platform_bin_dir, " rustc" ), String))
282+ end
258283 end
259284 platform = Platform (" x86_64" , " linux" ; libc= " glibc" , cxxstring_abi= " cxx11" )
260- mktempdir () do bin_path
261- platform_bin_dir = joinpath (bin_path, triplet (platform))
262- generate_compiler_wrappers! (platform; bin_path = bin_path, compilers = [:c ], gcc_version= v " 5" )
263- clang = read (joinpath (platform_bin_dir, " clang" ), String)
264- # Check link flags
265- @test occursin (" -L/opt/$(aatriplet (platform)) /lib/gcc/opt/$(aatriplet (platform)) /lib/gcc" , clang)
285+ @testset " $(triplet (platform)) " begin
286+ mktempdir () do bin_path
287+ platform_bin_dir = joinpath (bin_path, triplet (platform))
288+ generate_compiler_wrappers! (platform; bin_path = bin_path, compilers = [:c ], gcc_version= v " 5" )
289+ clang = read (joinpath (platform_bin_dir, " clang" ), String)
290+ # Check link flags
291+ @test occursin (" -L/opt/$(aatriplet (platform)) /lib/gcc/opt/$(aatriplet (platform)) /lib/gcc" , clang)
292+ end
266293 end
267294 end
268295end
0 commit comments