|
72 | 72 | end
|
73 | 73 |
|
74 | 74 | @testset "Auditor - cxxabi selection" begin
|
| 75 | + libcxxstringabi_test = LibraryProduct("libcxxstringabi_test", :libcxxstringabi_test) |
| 76 | + |
| 77 | + # Factor the autobuild() out |
| 78 | + function do_build(build_path, script, platform, gcc_version) |
| 79 | + autobuild( |
| 80 | + build_path, |
| 81 | + "libcxxstringabi_test", |
| 82 | + v"1.0.0", |
| 83 | + # Copy in the build_tests sources |
| 84 | + [build_tests_dir], |
| 85 | + script, |
| 86 | + # Build for this platform |
| 87 | + [platform], |
| 88 | + # The products we expect to be build |
| 89 | + [libcxxstringabi_test], |
| 90 | + # No depenedencies |
| 91 | + []; |
| 92 | + preferred_gcc_version=gcc_version |
| 93 | + ) |
| 94 | + end |
| 95 | + |
75 | 96 | for platform in (Linux(:x86_64; compiler_abi=CompilerABI(;cxxstring_abi=:cxx03)),
|
76 | 97 | Linux(:x86_64; compiler_abi=CompilerABI(;cxxstring_abi=:cxx11)))
|
77 | 98 | # Look across multiple gcc versions; there can be tricksy interactions here
|
78 | 99 | for gcc_version in (v"4", v"6", v"9")
|
79 | 100 | # Do each build within a separate temporary directory
|
80 | 101 | mktempdir() do build_path
|
81 |
| - libcxxstringabi_test = LibraryProduct("libcxxstringabi_test", :libcxxstringabi_test) |
82 |
| - build_output_meta = autobuild( |
83 |
| - build_path, |
84 |
| - "libcxxstringabi_test", |
85 |
| - v"1.0.0", |
86 |
| - # Copy in the libfoo sources |
87 |
| - [build_tests_dir], |
88 |
| - # Easy build script |
89 |
| - raw""" |
| 102 | + script = raw""" |
90 | 103 | cd ${WORKSPACE}/srcdir/cxxstringabi_tests
|
91 | 104 | make install
|
92 | 105 | install_license /usr/share/licenses/libuv/LICENSE
|
93 |
| - """, |
94 |
| - # Build for this platform |
95 |
| - [platform], |
96 |
| - # The products we expect to be build |
97 |
| - [libcxxstringabi_test], |
98 |
| - # No depenedencies |
99 |
| - []; |
100 |
| - preferred_gcc_version=gcc_version |
101 |
| - ) |
102 |
| - |
| 106 | + """ |
| 107 | + build_output_meta = do_build(build_path, script, platform, gcc_version) |
103 | 108 | # Extract our platform's build
|
104 | 109 | @test haskey(build_output_meta, platform)
|
105 | 110 | tarball_path, tarball_hash = build_output_meta[platform][1:2]
|
|
117 | 122 | detected_cxxstring_abi = BinaryBuilder.detect_cxxstring_abi(oh, platform)
|
118 | 123 | @test detected_cxxstring_abi == cxxstring_abi(platform)
|
119 | 124 | end
|
| 125 | + |
| 126 | + # Explicitly test cxx string abi mismatches |
| 127 | + if gcc_version > v"4" |
| 128 | + script = """ |
| 129 | + mkdir -p \${libdir} |
| 130 | + /opt/\${target}/bin/\${target}-g++ -fPIC \\ |
| 131 | + -D_GLIBCXX_USE_CXX11_ABI=$(cxxstring_abi(platform) == :cxx03 ? "1" : "0") \\ |
| 132 | + -o \${libdir}/libcxxstringabi_test.\${dlext} \\ |
| 133 | + -shared \${WORKSPACE}/srcdir/cxxstringabi_tests/lib.cc |
| 134 | + install_license /usr/share/licenses/libuv/LICENSE |
| 135 | + """ |
| 136 | + @test_logs (:warn, r"ignoring our choice of compiler") match_mode=:any begin |
| 137 | + do_build(build_path, script, platform, gcc_version) |
| 138 | + end |
| 139 | + end |
120 | 140 | end
|
121 | 141 | end
|
122 | 142 | end
|
| 143 | + |
| 144 | + # Explicitly test not setting a cxx string abi at all |
| 145 | + script = raw""" |
| 146 | + cd ${WORKSPACE}/srcdir/cxxstringabi_tests |
| 147 | + make install |
| 148 | + install_license /usr/share/licenses/libuv/LICENSE |
| 149 | + """ |
| 150 | + platform = Linux(:x86_64) |
| 151 | + mktempdir() do build_path |
| 152 | + @test_logs (:warn, r"contains std::string values") match_mode=:any begin |
| 153 | + do_build(build_path, script, platform, v"6") |
| 154 | + end |
| 155 | + end |
123 | 156 | end
|
124 | 157 |
|
125 | 158 |
|
|
0 commit comments