3
3
// successfully remapped to "/the/aux" in the rmeta files.
4
4
// See https://github.com/rust-lang/rust/pull/85344
5
5
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} ;
9
8
10
9
fn main ( ) {
11
10
let mut out_simple = rustc ( ) ;
@@ -34,8 +33,8 @@ fn main() {
34
33
. input ( "auxiliary/lib.rs" ) ;
35
34
36
35
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" ) ;
39
38
40
39
out_object. arg ( "-Zremap-path-scope=object" ) ;
41
40
out_macro. arg ( "-Zremap-path-scope=macro" ) ;
@@ -47,12 +46,42 @@ fn main() {
47
46
}
48
47
49
48
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" ) ;
52
51
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" ) ;
55
54
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
+ }
58
87
}
0 commit comments