@@ -26,10 +26,8 @@ using BinaryBuilderBase: RustBuild, CompilerShard
26
26
Platform (" x86_64" , " macos" ; libgfortran_version= v " 5" ),
27
27
Platform (" aarch64" , " macos" ; libgfortran_version= v " 5" ),
28
28
]
29
- @test expand_gfortran_versions (Platform (" aarch64" , " freebsd" )) == [
30
- Platform (" aarch64" , " freebsd" ; libgfortran_version= v " 4" ),
31
- Platform (" aarch64" , " freebsd" ; libgfortran_version= v " 5" ),
32
- ]
29
+ @test expand_gfortran_versions (Platform (" aarch64" , " freebsd" )) ==
30
+ [Platform (" aarch64" , " freebsd" ; libgfortran_version= v " 5" )]
33
31
@test expand_gfortran_versions ([Platform (" x86_64" , " linux" ; sanitize= " memory" )]) ==
34
32
[Platform (" x86_64" , " linux" ; sanitize= " memory" )]
35
33
@test expand_gfortran_versions (Platform[]) isa Vector{Platform}
178
176
# With LLVM 12 we can only use GCC 6+
179
177
@test gcc_version (Platform (" x86_64" , " freebsd" ), available_gcc_builds; llvm_version= v " 12" ) ==
180
178
filter (≥ (v " 6" ), getversion .(available_gcc_builds))
181
- # We can only use GCC 7 + on AArch64
179
+ # We can only use GCC 9 + on AArch64
182
180
@test gcc_version (Platform (" aarch64" , " freebsd" ), available_gcc_builds) ==
183
- filter (≥ (v "7 " ), getversion .(available_gcc_builds))
181
+ filter (≥ (v "9 " ), getversion .(available_gcc_builds))
184
182
185
183
# libgfortran v3 and libstdcxx 22 restrict us to only v4.8, v5.2 and v6.1
186
184
p = Platform (" x86_64" , " linux" ; libgfortran_version= v " 3" , libstdcxx_version= v " 3.4.22" )
@@ -219,52 +217,79 @@ end
219
217
220
218
@testset " Compiler wrappers" begin
221
219
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))
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
229
229
end
230
230
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)
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
239
241
end
240
242
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)
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
249
270
end
250
271
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))
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
260
283
end
261
284
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)
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
268
293
end
269
294
end
270
295
end
0 commit comments