|
1 | | -use colored::*; |
2 | | -use regex::bytes::Regex; |
3 | 1 | use std::ffi::OsString; |
4 | 2 | use std::num::NonZeroUsize; |
5 | 3 | use std::path::{Path, PathBuf}; |
6 | 4 | use std::{env, process::Command}; |
| 5 | + |
| 6 | +use colored::*; |
| 7 | +use regex::bytes::Regex; |
7 | 8 | use ui_test::color_eyre::eyre::{Context, Result}; |
8 | 9 | use ui_test::{ |
9 | 10 | status_emitter, CommandBuilder, Config, Format, Match, Mode, OutputConflictHandling, |
@@ -44,12 +45,15 @@ fn build_so_for_c_ffi_tests() -> PathBuf { |
44 | 45 | // This is to avoid automatically adding `malloc`, etc. |
45 | 46 | // Source: https://anadoxin.org/blog/control-over-symbol-exports-in-gcc.html/ |
46 | 47 | "-fPIC", |
47 | | - "-Wl,--version-script=tests/extern-so/libcode.version", |
| 48 | + "-Wl,--version-script=tests/extern-so/libtest.map", |
48 | 49 | ]) |
49 | 50 | .output() |
50 | 51 | .expect("failed to generate shared object file for testing external C function calls"); |
51 | 52 | if !cc_output.status.success() { |
52 | | - panic!("error in generating shared object file for testing external C function calls"); |
| 53 | + panic!( |
| 54 | + "error in generating shared object file for testing external C function calls:\n{}", |
| 55 | + String::from_utf8_lossy(&cc_output.stderr), |
| 56 | + ); |
53 | 57 | } |
54 | 58 | so_file_path |
55 | 59 | } |
@@ -120,10 +124,10 @@ fn run_tests( |
120 | 124 | config.program.args.push("--target".into()); |
121 | 125 | config.program.args.push(target.into()); |
122 | 126 |
|
123 | | - // If we're on linux, and we're testing the extern-so functionality, |
124 | | - // then build the shared object file for testing external C function calls |
125 | | - // and push the relevant compiler flag. |
126 | | - if cfg!(target_os = "linux") && path.starts_with("tests/extern-so/") { |
| 127 | + // If we're testing the extern-so functionality, then build the shared object file for testing |
| 128 | + // external C function calls and push the relevant compiler flag. |
| 129 | + if path.starts_with("tests/extern-so/") { |
| 130 | + assert!(cfg!(target_os = "linux")); |
127 | 131 | let so_file_path = build_so_for_c_ffi_tests(); |
128 | 132 | let mut flag = std::ffi::OsString::from("-Zmiri-extern-so-file="); |
129 | 133 | flag.push(so_file_path.into_os_string()); |
|
0 commit comments