|
131 | 131 | @info("Beginning full shard test... (this can take a while)") |
132 | 132 | platforms = supported_platforms() |
133 | 133 | elf_platforms = filter(p -> Sys.islinux(p) || Sys.isfreebsd(p), supported_platforms()) |
| 134 | + win_platforms = filter(p -> Sys.iswindows(p), supported_platforms()) |
134 | 135 | else |
135 | 136 | platforms = (default_host_platform,) |
136 | 137 | elf_platforms = (default_host_platform,) |
| 138 | + win_platforms = (Platform("x86_64", "windows"),) |
137 | 139 | end |
138 | 140 |
|
139 | 141 | # Checks that the wrappers provide the correct C++ string ABI |
|
157 | 159 |
|
158 | 160 | # Checks that the compiler/linker include a build-id |
159 | 161 | # This is only available on ELF-based platforms |
160 | | - @testset "Compilation - build-id note $(platform) - $(compiler)" for platform in elf_platforms, compiler in ("cc", "gcc", "clang", "c++", "g++", "clang++") |
| 162 | + @testset "Compilation - Linux build-id note $(platform) - $(compiler)" for platform in elf_platforms, compiler in ("cc", "gcc", "clang", "c++", "g++", "clang++") |
161 | 163 | mktempdir() do dir |
162 | 164 | ur = preferred_runner()(dir; platform=platform) |
163 | 165 | iobuff = IOBuffer() |
|
187 | 189 | end |
188 | 190 | end |
189 | 191 |
|
| 192 | + # Checks that Windows can include a build-id |
| 193 | + @testset "Compilation - Windows build-id note $(platform) - $(compiler)" for platform in win_platforms, compiler in ("cc", "gcc", "clang", "c++", "g++", "clang++") |
| 194 | + mktempdir() do dir |
| 195 | + # Windows build-id support requires binutils 2.25, which is part of our GCC 5 |
| 196 | + ur = preferred_runner()(dir; platform=platform, preferred_gcc_version=v"5") |
| 197 | + iobuff = IOBuffer() |
| 198 | + test_c = """ |
| 199 | + #include <stdlib.h> |
| 200 | + int test(void) { |
| 201 | + return 0; |
| 202 | + } |
| 203 | + """ |
| 204 | + test_script = """ |
| 205 | + set -e |
| 206 | + # We need readpe to get the information from the library |
| 207 | + apk add pev |
| 208 | + # Make sure setting `CCACHE` doesn't affect the compiler wrappers. |
| 209 | + export CCACHE=pwned |
| 210 | + export USE_CCACHE=false |
| 211 | + echo '$(test_c)' > test.c |
| 212 | + # Build shared library |
| 213 | + $(compiler) -shared test.c -o libtest.\${dlext} |
| 214 | +
|
| 215 | + # Print out the notes in the library |
| 216 | + readpe libtest.\${dlext} |
| 217 | + """ |
| 218 | + cmd = `/bin/bash -c "$(test_script)"` |
| 219 | + @test run(ur, cmd, iobuff) |
| 220 | + seekstart(iobuff) |
| 221 | + # Make sure the compiled library has the section for the build-id |
| 222 | + @test occursin(".buildid", readchomp(iobuff)) |
| 223 | + end |
| 224 | + end |
| 225 | + |
190 | 226 | # This tests only that compilers for all platforms can build and link simple C code |
191 | 227 | @testset "Compilation - $(platform) - $(compiler)" for platform in platforms, compiler in ("cc", "gcc", "clang") |
192 | 228 | mktempdir() do dir |
|
0 commit comments