rmeta_contains functions for remap-path-prefix
This commit is contained in:
parent
133b47ab38
commit
1795082842
@ -3401,6 +3401,7 @@ name = "run_make_support"
|
|||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ar",
|
"ar",
|
||||||
|
"bstr",
|
||||||
"gimli 0.28.1",
|
"gimli 0.28.1",
|
||||||
"object 0.34.0",
|
"object 0.34.0",
|
||||||
"regex",
|
"regex",
|
||||||
|
@ -4,6 +4,7 @@ version = "0.2.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
bstr = "1.6.0"
|
||||||
object = "0.34.0"
|
object = "0.34.0"
|
||||||
similar = "2.5.0"
|
similar = "2.5.0"
|
||||||
wasmparser = "0.118.2"
|
wasmparser = "0.118.2"
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
use std::panic;
|
use std::panic;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
|
pub use bstr;
|
||||||
pub use gimli;
|
pub use gimli;
|
||||||
pub use object;
|
pub use object;
|
||||||
pub use regex;
|
pub use regex;
|
||||||
|
@ -3,9 +3,8 @@
|
|||||||
// successfully remapped to "/the/aux" in the rmeta files.
|
// successfully remapped to "/the/aux" in the rmeta files.
|
||||||
// See https://github.com/rust-lang/rust/pull/85344
|
// See https://github.com/rust-lang/rust/pull/85344
|
||||||
|
|
||||||
// FIXME(Oneirical): check if works without ignore-windows
|
use run_make_support::bstr::ByteSlice;
|
||||||
|
use run_make_support::{bstr, fs_wrapper, is_darwin, rustc};
|
||||||
use run_make_support::{invalid_utf8_contains, invalid_utf8_not_contains, is_darwin, rustc};
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut out_simple = rustc();
|
let mut out_simple = rustc();
|
||||||
@ -34,8 +33,8 @@ fn main() {
|
|||||||
.input("auxiliary/lib.rs");
|
.input("auxiliary/lib.rs");
|
||||||
|
|
||||||
out_simple.run();
|
out_simple.run();
|
||||||
invalid_utf8_contains("liblib.rmeta", "/the/aux/lib.rs");
|
rmeta_contains("/the/aux/lib.rs");
|
||||||
invalid_utf8_not_contains("liblib.rmeta", "auxiliary");
|
rmeta_not_contains("auxiliary");
|
||||||
|
|
||||||
out_object.arg("-Zremap-path-scope=object");
|
out_object.arg("-Zremap-path-scope=object");
|
||||||
out_macro.arg("-Zremap-path-scope=macro");
|
out_macro.arg("-Zremap-path-scope=macro");
|
||||||
@ -47,12 +46,42 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
out_object.run();
|
out_object.run();
|
||||||
invalid_utf8_contains("liblib.rmeta", "/the/aux/lib.rs");
|
rmeta_contains("/the/aux/lib.rs");
|
||||||
invalid_utf8_not_contains("liblib.rmeta", "auxiliary");
|
rmeta_not_contains("auxiliary");
|
||||||
out_macro.run();
|
out_macro.run();
|
||||||
invalid_utf8_contains("liblib.rmeta", "/the/aux/lib.rs");
|
rmeta_contains("/the/aux/lib.rs");
|
||||||
invalid_utf8_not_contains("liblib.rmeta", "auxiliary");
|
rmeta_not_contains("auxiliary");
|
||||||
out_diagobj.run();
|
out_diagobj.run();
|
||||||
invalid_utf8_contains("liblib.rmeta", "/the/aux/lib.rs");
|
rmeta_contains("/the/aux/lib.rs");
|
||||||
invalid_utf8_not_contains("liblib.rmeta", "auxiliary");
|
rmeta_not_contains("auxiliary");
|
||||||
|
}
|
||||||
|
|
||||||
|
//FIXME(Oneirical): These could be generalized into run_make_support
|
||||||
|
// helper functions.
|
||||||
|
fn rmeta_contains(expected: &str) {
|
||||||
|
// Normalize to account for path differences in Windows.
|
||||||
|
if !bstr::BString::from(fs_wrapper::read("liblib.rmeta"))
|
||||||
|
.replace(b"\\", b"/")
|
||||||
|
.contains_str(expected)
|
||||||
|
{
|
||||||
|
eprintln!("=== FILE CONTENTS (LOSSY) ===");
|
||||||
|
eprintln!("{}", String::from_utf8_lossy(&fs_wrapper::read("liblib.rmeta")));
|
||||||
|
eprintln!("=== SPECIFIED TEXT ===");
|
||||||
|
eprintln!("{}", expected);
|
||||||
|
panic!("specified text was not found in file");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn rmeta_not_contains(expected: &str) {
|
||||||
|
// Normalize to account for path differences in Windows.
|
||||||
|
if bstr::BString::from(fs_wrapper::read("liblib.rmeta"))
|
||||||
|
.replace(b"\\", b"/")
|
||||||
|
.contains_str(expected)
|
||||||
|
{
|
||||||
|
eprintln!("=== FILE CONTENTS (LOSSY) ===");
|
||||||
|
eprintln!("{}", String::from_utf8_lossy(&fs_wrapper::read("liblib.rmeta")));
|
||||||
|
eprintln!("=== SPECIFIED TEXT ===");
|
||||||
|
eprintln!("{}", expected);
|
||||||
|
panic!("specified text was not found in file");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user