33// successfully remapped to "/the/aux" in the rmeta files.
44// See https://github.com/rust-lang/rust/pull/85344
55
6- // FIXME(Oneirical): check if works without ignore-windows
7-
8- use run_make_support:: { invalid_utf8_contains, invalid_utf8_not_contains, is_darwin, rustc} ;
6+ use run_make_support:: bstr:: ByteSlice ;
7+ use run_make_support:: { bstr, fs_wrapper, is_darwin, rustc} ;
98
109fn main ( ) {
1110 let mut out_simple = rustc ( ) ;
@@ -34,8 +33,8 @@ fn main() {
3433 . input ( "auxiliary/lib.rs" ) ;
3534
3635 out_simple. run ( ) ;
37- invalid_utf8_contains ( "liblib.rmeta" , "/the/aux/lib.rs" ) ;
38- invalid_utf8_not_contains ( "liblib.rmeta" , "auxiliary" ) ;
36+ rmeta_contains ( "/the/aux/lib.rs" ) ;
37+ rmeta_not_contains ( "auxiliary" ) ;
3938
4039 out_object. arg ( "-Zremap-path-scope=object" ) ;
4140 out_macro. arg ( "-Zremap-path-scope=macro" ) ;
@@ -47,12 +46,42 @@ fn main() {
4746 }
4847
4948 out_object. run ( ) ;
50- invalid_utf8_contains ( "liblib.rmeta" , "/the/aux/lib.rs" ) ;
51- invalid_utf8_not_contains ( "liblib.rmeta" , "auxiliary" ) ;
49+ rmeta_contains ( "/the/aux/lib.rs" ) ;
50+ rmeta_not_contains ( "auxiliary" ) ;
5251 out_macro. run ( ) ;
53- invalid_utf8_contains ( "liblib.rmeta" , "/the/aux/lib.rs" ) ;
54- invalid_utf8_not_contains ( "liblib.rmeta" , "auxiliary" ) ;
52+ rmeta_contains ( "/the/aux/lib.rs" ) ;
53+ rmeta_not_contains ( "auxiliary" ) ;
5554 out_diagobj. run ( ) ;
56- invalid_utf8_contains ( "liblib.rmeta" , "/the/aux/lib.rs" ) ;
57- invalid_utf8_not_contains ( "liblib.rmeta" , "auxiliary" ) ;
55+ rmeta_contains ( "/the/aux/lib.rs" ) ;
56+ rmeta_not_contains ( "auxiliary" ) ;
57+ }
58+
59+ //FIXME(Oneirical): These could be generalized into run_make_support
60+ // helper functions.
61+ fn rmeta_contains ( expected : & str ) {
62+ // Normalize to account for path differences in Windows.
63+ if !bstr:: BString :: from ( fs_wrapper:: read ( "liblib.rmeta" ) )
64+ . replace ( b"\\ " , b"/" )
65+ . contains_str ( expected)
66+ {
67+ eprintln ! ( "=== FILE CONTENTS (LOSSY) ===" ) ;
68+ eprintln ! ( "{}" , String :: from_utf8_lossy( & fs_wrapper:: read( "liblib.rmeta" ) ) ) ;
69+ eprintln ! ( "=== SPECIFIED TEXT ===" ) ;
70+ eprintln ! ( "{}" , expected) ;
71+ panic ! ( "specified text was not found in file" ) ;
72+ }
73+ }
74+
75+ fn rmeta_not_contains ( expected : & str ) {
76+ // Normalize to account for path differences in Windows.
77+ if bstr:: BString :: from ( fs_wrapper:: read ( "liblib.rmeta" ) )
78+ . replace ( b"\\ " , b"/" )
79+ . contains_str ( expected)
80+ {
81+ eprintln ! ( "=== FILE CONTENTS (LOSSY) ===" ) ;
82+ eprintln ! ( "{}" , String :: from_utf8_lossy( & fs_wrapper:: read( "liblib.rmeta" ) ) ) ;
83+ eprintln ! ( "=== SPECIFIED TEXT ===" ) ;
84+ eprintln ! ( "{}" , expected) ;
85+ panic ! ( "specified text was not found in file" ) ;
86+ }
5887}
0 commit comments