|
1 |
| -// Dynamic libraries on Rust used to export a very high amount of symbols, |
2 |
| -// going as far as filling the output with mangled names and generic function |
3 |
| -// names. After the rework of #38117, this test checks that no mangled Rust symbols |
4 |
| -// are exported, and that generics are only shown if explicitely requested. |
5 |
| -// See https://github.com/rust-lang/rust/issues/37530 |
| 1 | +//! Dynamic libraries on Rust used to export a very high amount of symbols, going as far as filling |
| 2 | +//! the output with mangled names and generic function names. After the rework in #38117, this test |
| 3 | +//! checks that no mangled Rust symbols are exported, and that generics are only shown if explicitly |
| 4 | +//! requested. |
| 5 | +//! |
| 6 | +//! See <https://github.com/rust-lang/rust/issues/37530>. |
6 | 7 |
|
7 | 8 | //@ ignore-windows-msvc
|
| 9 | +// FIXME(jieyouxu): unknown reason why this test fails on msvc, likely because certain assertions |
| 10 | +// fail. |
8 | 11 |
|
9 | 12 | use run_make_support::{bin_name, dynamic_lib_name, is_windows, llvm_readobj, regex, rustc};
|
10 | 13 |
|
@@ -143,13 +146,19 @@ fn main() {
|
143 | 146 | #[track_caller]
|
144 | 147 | fn symbols_check(path: &str, symbol_check_type: SymbolCheckType, exists_once: bool) {
|
145 | 148 | let out = llvm_readobj().arg("--dyn-symbols").input(path).run().invalid_stdout_utf8();
|
146 |
| - assert_eq!( |
147 |
| - out.lines() |
148 |
| - .filter(|&line| !line.contains("__imp_") && has_symbol(line, symbol_check_type)) |
149 |
| - .count() |
150 |
| - == 1, |
151 |
| - exists_once |
152 |
| - ); |
| 149 | + |
| 150 | + let matched_lines = out |
| 151 | + .lines() |
| 152 | + .filter(|&line| !line.contains("__imp_") && has_symbol(line, symbol_check_type)) |
| 153 | + .collect::<Vec<_>>(); |
| 154 | + |
| 155 | + if exists_once && matched_lines.len() != 1 { |
| 156 | + eprintln!("symbol_check_type: {:?}", symbol_check_type); |
| 157 | + eprintln!("exists_once: {}", exists_once); |
| 158 | + eprintln!("matched_lines:\n{:#?}", matched_lines); |
| 159 | + } |
| 160 | + |
| 161 | + assert_eq!(matched_lines.len() == 1, exists_once); |
153 | 162 | }
|
154 | 163 |
|
155 | 164 | fn has_symbol(line: &str, symbol_check_type: SymbolCheckType) -> bool {
|
|
0 commit comments