|
1 | 1 | using Test |
2 | 2 | using Pkg, Pkg.PlatformEngines, Pkg.BinaryPlatforms, Pkg.Artifacts |
3 | 3 | using BinaryBuilderBase |
4 | | -using BinaryBuilderBase: abi_agnostic, get_concrete_platform, march |
| 4 | +using BinaryBuilderBase: abi_agnostic, get_concrete_platform, march, get_cpu_features |
5 | 5 |
|
6 | 6 | @testset "Supported Platforms" begin |
7 | 7 | all = supported_platforms() |
|
205 | 205 | # Extending different platforms |
206 | 206 | @test !platforms_match(ExtendedPlatform(Linux(:i686); cuda="10.1"), ExtendedPlatform(FreeBSD(:x86_64); cuda="11.1")) |
207 | 207 | end |
| 208 | + |
| 209 | + @testset "extended_platform_key_abi" begin |
| 210 | + if VERSION >= v"1.4" |
| 211 | + @test get_cpu_features() isa Vector{String} |
| 212 | + else |
| 213 | + @test_throws ErrorException get_cpu_features() |
| 214 | + end |
| 215 | + |
| 216 | + @test @test_logs (:warn, r"^Cannot determine the microarchitecture") march(String[]) === nothing |
| 217 | + for (cpu_features, μarch) in ( |
| 218 | + (["mmx", "sse", "sse2"], "x86_64"), |
| 219 | + # The following sets of CPU features are obtained on real machines |
| 220 | + (["64bit", "aes", "avx", "cmov", "cx16", "fma4", "lzcnt", "mmx", "pclmul", "popcnt", "prfchw", "sahf", "sse", "sse2", "sse3", "sse4.1", "sse4.2", "sse4a", "ssse3", "xop", "xsave"], "avx"), |
| 221 | + (["64bit", "aes", "avx", "avx2", "bmi", "bmi2", "cmov", "cx16", "cx8", "f16c", "fma", "fsgsbase", "fxsr", "invpcid", "lzcnt", "mmx", "movbe", "pclmul", "popcnt", "rdrnd", "sahf", "sse", "sse2", "sse3", "sse4.1", "sse4.2", "ssse3", "xsave", "xsaveopt"], "avx2"), |
| 222 | + (["64bit", "aes", "avx", "avx2", "bmi", "bmi2", "cmov", "cx16", "f16c", "fma", "fsgsbase", "invpcid", "lzcnt", "mmx", "movbe", "pclmul", "popcnt", "rdrnd", "sahf", "sse", "sse2", "sse3", "sse4.1", "sse4.2", "ssse3", "xsave", "xsaveopt"], "avx2"), |
| 223 | + (["64bit", "adx", "aes", "avx", "avx2", "bmi", "bmi2", "clflushopt", "clwb", "clzero", "cmov", "cx16", "f16c", "fma", "fsgsbase", "lzcnt", "mmx", "movbe", "mwaitx", "pclmul", "popcnt", "prfchw", "rdpid", "rdrnd", "rdseed", "sahf", "sha", "sse", "sse2", "sse3", "sse4.1", "sse4.2", "sse4a", "ssse3", "wbnoinvd", "xsave", "xsavec", "xsaveopt", "xsaves"], "avx2"), |
| 224 | + (["64bit", "adx", "aes", "avx", "avx2", "avx512bw", "avx512cd", "avx512dq", "avx512f", "avx512vl", "avx512vnni", "bmi", "bmi2", "clflushopt", "clwb", "cmov", "cx16", "cx8", "f16c", "fma", "fsgsbase", "fxsr", "invpcid", "lzcnt", "mmx", "movbe", "mpx", "pclmul", "pku", "popcnt", "prfchw", "rdrnd", "rdseed", "rtm", "sahf", "sse", "sse2", "sse3", "sse4.1", "sse4.2", "ssse3", "xsave", "xsavec", "xsaveopt", "xsaves"], "avx512") |
| 225 | + ) |
| 226 | + @test march(cpu_features) == μarch |
| 227 | + p = Linux(:x86_64) |
| 228 | + @test extended_platform_key_abi(; p=p, cpu_features=cpu_features) == ExtendedPlatform(p; march=μarch) |
| 229 | + end |
| 230 | + p = Linux(:i686) |
| 231 | + @test extended_platform_key_abi(; p=p, cpu_features=String[]) == p |
| 232 | + end |
208 | 233 | end |
209 | 234 |
|
210 | 235 | @testset "AnyPlatform" begin |
|
0 commit comments