|
130 | 130 | end
|
131 | 131 | end
|
132 | 132 |
|
| 133 | + @testset "C and link to quadmath - $(platform)" for platform in platforms |
| 134 | + mktempdir() do dir |
| 135 | + # Use a recent GCC with libgfortran5 |
| 136 | + options = (preferred_gcc_version=v"9", compilers=[:c]) |
| 137 | + shards = choose_shards(platform; options...) |
| 138 | + concrete_platform = get_concrete_platform(platform, shards) |
| 139 | + prefix = setup_workspace( |
| 140 | + dir, |
| 141 | + [], |
| 142 | + concrete_platform, |
| 143 | + default_host_platform; |
| 144 | + ) |
| 145 | + # Install `MPICH_jll` in the `${prefix}` to make sure we can link to |
| 146 | + # libquadmath without problems, see |
| 147 | + # https://github.com/JuliaPackaging/BinaryBuilderBase.jl/pull/157#issuecomment-879263820 |
| 148 | + artifact_paths = |
| 149 | + setup_dependencies(prefix, |
| 150 | + [PackageSpec(; name="MPICH_jll", version="3.4.2")], |
| 151 | + concrete_platform, verbose=false) |
| 152 | + ur = preferred_runner()(prefix.path; |
| 153 | + platform=concrete_platform, |
| 154 | + shards = shards, |
| 155 | + options...) |
| 156 | + iobuff = IOBuffer() |
| 157 | + test_c = """ |
| 158 | + #include <stdio.h> |
| 159 | + int main() { |
| 160 | + printf("Hello World!\\n"); |
| 161 | + return 0; |
| 162 | + } |
| 163 | + """ |
| 164 | + test_script = """ |
| 165 | + set -e |
| 166 | + echo '$(test_c)' > test.c |
| 167 | + # Make sure we can compile successfully also when linking to libmpifort |
| 168 | + cc -o test test.c -L\${libdir} -lmpifort -lquadmath |
| 169 | + ./test |
| 170 | + """ |
| 171 | + cmd = `/bin/bash -c "$(test_script)"` |
| 172 | + if arch(platform) == "i686" && libc(platform) == "musl" |
| 173 | + # We can't run this program for this platform |
| 174 | + @test_broken run(ur, cmd, iobuff; tee_stream=devnull) |
| 175 | + else |
| 176 | + @test run(ur, cmd, iobuff; tee_stream=devnull) |
| 177 | + seekstart(iobuff) |
| 178 | + # Test that we get the output we expect |
| 179 | + @test endswith(readchomp(iobuff), "Hello World!") |
| 180 | + end |
| 181 | + cleanup_dependencies(prefix, artifact_paths, concrete_platform) |
| 182 | + end |
| 183 | + end |
| 184 | + |
133 | 185 | @testset "C++ - $(platform)" for platform in platforms
|
134 | 186 | mktempdir() do dir
|
135 | 187 | # Use an old GCC with libgfortran3
|
|
167 | 219 | echo '$(test_cpp)' > test.cpp
|
168 | 220 | # Make sure we can compile successfully also when `\${libdir}` is in the
|
169 | 221 | # linker search path
|
170 |
| - g++ -o test test.cpp -L\${libdir} |
| 222 | + c++ -o test test.cpp -L\${libdir} |
171 | 223 | ./test
|
172 | 224 | """
|
173 | 225 | cmd = `/bin/bash -c "$(test_script)"`
|
|
0 commit comments