|
130 | 130 | if lowercase(get(ENV, "BINARYBUILDER_FULL_SHARD_TEST", "false")) == "true"
|
131 | 131 | @info("Beginning full shard test... (this can take a while)")
|
132 | 132 | platforms = supported_platforms()
|
| 133 | + elf_platforms = filter(p -> Sys.islinux(p) || Sys.isfreebsd(p), supported_platforms()) |
133 | 134 | else
|
134 | 135 | platforms = (default_host_platform,)
|
| 136 | + elf_platforms = (default_host_platform,) |
135 | 137 | end
|
136 | 138 |
|
137 | 139 | # Checks that the wrappers provide the correct C++ string ABI
|
|
153 | 155 | end
|
154 | 156 | end
|
155 | 157 |
|
| 158 | + # Checks that the compiler/linker include a build-id |
| 159 | + # 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++") |
| 161 | + mktempdir() do dir |
| 162 | + ur = preferred_runner()(dir; platform=platform) |
| 163 | + iobuff = IOBuffer() |
| 164 | + test_c = """ |
| 165 | + #include <stdlib.h> |
| 166 | + int test(void) { |
| 167 | + return 0; |
| 168 | + } |
| 169 | + """ |
| 170 | + test_script = """ |
| 171 | + set -e |
| 172 | + # Make sure setting `CCACHE` doesn't affect the compiler wrappers. |
| 173 | + export CCACHE=pwned |
| 174 | + export USE_CCACHE=false |
| 175 | + echo '$(test_c)' > test.c |
| 176 | + # Build object file |
| 177 | + $(compiler) -Werror -c test.c -o test.o |
| 178 | + # Build shared library |
| 179 | + $(compiler) -Werror -shared test.c -o libtest.\${dlext} |
| 180 | +
|
| 181 | + # Print out the notes in the library |
| 182 | + readelf -n libtest.\${dlext} |
| 183 | + """ |
| 184 | + cmd = `/bin/bash -c "$(test_script)"` |
| 185 | + @test run(ur, cmd, iobuff) |
| 186 | + seekstart(iobuff) |
| 187 | + # Make sure the compiled library has the note section for the build-id |
| 188 | + @test occursin(r".note.gnu.build-id", readchomp(iobuff)) |
| 189 | + end |
| 190 | + end |
| 191 | + |
156 | 192 | # This tests only that compilers for all platforms can build and link simple C code
|
157 | 193 | @testset "Compilation - $(platform) - $(compiler)" for platform in platforms, compiler in ("cc", "gcc", "clang")
|
158 | 194 | mktempdir() do dir
|
|
0 commit comments