55
66// FIXME(Oneirical): check if works without ignore-windows
77
8- use run_make_support:: { invalid_utf8_contains, invalid_utf8_not_contains, is_darwin, rustc} ;
8+ use run_make_support:: bstr:: ByteSlice ;
9+ use run_make_support:: { bstr, fs_wrapper, is_darwin, rustc} ;
910
1011fn main ( ) {
1112 let mut out_simple = rustc ( ) ;
@@ -34,8 +35,8 @@ fn main() {
3435 . input ( "auxiliary/lib.rs" ) ;
3536
3637 out_simple. run ( ) ;
37- invalid_utf8_contains ( "liblib.rmeta" , "/the/aux/lib.rs" ) ;
38- invalid_utf8_not_contains ( "liblib.rmeta" , "auxiliary" ) ;
38+ rmeta_contains ( "/the/aux/lib.rs" ) ;
39+ rmeta_not_contains ( "auxiliary" ) ;
3940
4041 out_object. arg ( "-Zremap-path-scope=object" ) ;
4142 out_macro. arg ( "-Zremap-path-scope=macro" ) ;
@@ -47,12 +48,42 @@ fn main() {
4748 }
4849
4950 out_object. run ( ) ;
50- invalid_utf8_contains ( "liblib.rmeta" , "/the/aux/lib.rs" ) ;
51- invalid_utf8_not_contains ( "liblib.rmeta" , "auxiliary" ) ;
51+ rmeta_contains ( "/the/aux/lib.rs" ) ;
52+ rmeta_not_contains ( "auxiliary" ) ;
5253 out_macro. run ( ) ;
53- invalid_utf8_contains ( "liblib.rmeta" , "/the/aux/lib.rs" ) ;
54- invalid_utf8_not_contains ( "liblib.rmeta" , "auxiliary" ) ;
54+ rmeta_contains ( "/the/aux/lib.rs" ) ;
55+ rmeta_not_contains ( "auxiliary" ) ;
5556 out_diagobj. run ( ) ;
56- invalid_utf8_contains ( "liblib.rmeta" , "/the/aux/lib.rs" ) ;
57- invalid_utf8_not_contains ( "liblib.rmeta" , "auxiliary" ) ;
57+ rmeta_contains ( "/the/aux/lib.rs" ) ;
58+ rmeta_not_contains ( "auxiliary" ) ;
59+ }
60+
61+ //FIXME(Oneirical): These could be generalized into run_make_support
62+ // helper functions.
63+ fn rmeta_contains ( expected : & str ) {
64+ // Normalize to account for path differences in Windows.
65+ if !bstr:: BString :: from ( fs_wrapper:: read ( "liblib.rmeta" ) )
66+ . replace ( b"\\ " , b"/" )
67+ . contains_str ( expected)
68+ {
69+ eprintln ! ( "=== FILE CONTENTS (LOSSY) ===" ) ;
70+ eprintln ! ( "{}" , String :: from_utf8_lossy( & fs_wrapper:: read( "liblib.rmeta" ) ) ) ;
71+ eprintln ! ( "=== SPECIFIED TEXT ===" ) ;
72+ eprintln ! ( "{}" , expected) ;
73+ panic ! ( "specified text was not found in file" ) ;
74+ }
75+ }
76+
77+ fn rmeta_not_contains ( expected : & str ) {
78+ // Normalize to account for path differences in Windows.
79+ if bstr:: BString :: from ( fs_wrapper:: read ( "liblib.rmeta" ) )
80+ . replace ( b"\\ " , b"/" )
81+ . contains_str ( expected)
82+ {
83+ eprintln ! ( "=== FILE CONTENTS (LOSSY) ===" ) ;
84+ eprintln ! ( "{}" , String :: from_utf8_lossy( & fs_wrapper:: read( "liblib.rmeta" ) ) ) ;
85+ eprintln ! ( "=== SPECIFIED TEXT ===" ) ;
86+ eprintln ! ( "{}" , expected) ;
87+ panic ! ( "specified text was not found in file" ) ;
88+ }
5889}
0 commit comments