|
128 | 128 | @test endswith(readchomp(iobuff), "Hello World!")
|
129 | 129 | end
|
130 | 130 |
|
| 131 | + @testset "C++ - $(platform)" for platform in platforms |
| 132 | + ur = preferred_runner()(dir; platform=platform) |
| 133 | + iobuff = IOBuffer() |
| 134 | + test_c = """ |
| 135 | + #include <iostream> |
| 136 | + class breakCCompiler; // Courtesy of Meson |
| 137 | + int main() { |
| 138 | + std::cout << "Hello World!" << std::endl; |
| 139 | + return 0; |
| 140 | + } |
| 141 | + """ |
| 142 | + test_script = """ |
| 143 | + set -e |
| 144 | + # Install `CompilerSupportLibraries_jll` v0.5.0 in the `\${prefix}` to make |
| 145 | + # sure it doesn't break compilation of the program |
| 146 | + mkdir -p \${prefix} |
| 147 | + wget -qO - "https://github.com/JuliaBinaryWrappers/CompilerSupportLibraries_jll.jl/releases/download/CompilerSupportLibraries-v0.5.0%2B0/CompilerSupportLibraries.v0.5.0.\${target}-libgfortran3.tar.gz" | tar xzf - -C \${prefix} |
| 148 | + echo '$(test_c)' > test.cpp |
| 149 | + # Make sure we can compile successfully also when `\${libdir}` is in the |
| 150 | + # linker search path |
| 151 | + g++ -o test test.cpp -L\${libdir} |
| 152 | + ./test |
| 153 | + """ |
| 154 | + cmd = `/bin/bash -c "$(test_script)"` |
| 155 | + if arch(platform) == "i686" && libc(platform) == "musl" |
| 156 | + # We can't run C++ programs for this platform |
| 157 | + @test_broken run(ur, cmd, iobuff; tee_stream=devnull) |
| 158 | + else |
| 159 | + @test run(ur, cmd, iobuff; tee_stream=devnull) |
| 160 | + seekstart(iobuff) |
| 161 | + # Test that we get the output we expect |
| 162 | + @test endswith(readchomp(iobuff), "Hello World!") |
| 163 | + end |
| 164 | + end |
| 165 | + |
131 | 166 | # This tests that compilers for all Intel Linux platforms can build a simple
|
132 | 167 | # Fortran program that we can also run
|
133 | 168 | @testset "Fortran - $(platform)" for platform in filter(p -> Sys.islinux(p) && proc_family(p) == "intel", supported_platforms())
|
|
140 | 175 | """
|
141 | 176 | cmd = `/bin/bash -c "echo '$(test_f)' > test.f && gfortran -o test test.f && ./test"`
|
142 | 177 | if arch(platform) == "i686" && libc(platform) == "musl"
|
| 178 | + # We can't run Fortran programs for this platform |
143 | 179 | @test_broken run(ur, cmd, iobuff; tee_stream=devnull)
|
144 | 180 | else
|
145 | 181 | @test run(ur, cmd, iobuff; tee_stream=devnull)
|
|
0 commit comments