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