@@ -51,13 +51,30 @@ fn template(me: &str) -> Command {
5151 return m;
5252}
5353
54+ fn expected ( fn_name : & str ) -> String {
55+ // FIXME(#32481)
56+ //
57+ // On windows, we read the function name from debuginfo using some
58+ // system APIs. For whatever reason, these APIs seem to use the
59+ // "name" field, which is only the "relative" name, not the full
60+ // name with namespace info, so we just see `foo` and not
61+ // `backtrace::foo` as we see on linux (which uses the linkage
62+ // name).
63+
64+ if cfg ! ( windows) {
65+ format ! ( " - {}" , fn_name)
66+ } else {
67+ format ! ( " - backtrace::{}" , fn_name)
68+ }
69+ }
70+
5471fn runtest ( me : & str ) {
5572 // Make sure that the stack trace is printed
5673 let p = template ( me) . arg ( "fail" ) . env ( "RUST_BACKTRACE" , "1" ) . spawn ( ) . unwrap ( ) ;
5774 let out = p. wait_with_output ( ) . unwrap ( ) ;
5875 assert ! ( !out. status. success( ) ) ;
5976 let s = str:: from_utf8 ( & out. stderr ) . unwrap ( ) ;
60- assert ! ( s. contains( "stack backtrace" ) && s. contains( " - backtrace:: foo") ,
77+ assert ! ( s. contains( "stack backtrace" ) && s. contains( & expected ( " foo") ) ,
6178 "bad output: {}" , s) ;
6279
6380 // Make sure the stack trace is *not* printed
@@ -67,7 +84,7 @@ fn runtest(me: &str) {
6784 let out = p. wait_with_output ( ) . unwrap ( ) ;
6885 assert ! ( !out. status. success( ) ) ;
6986 let s = str:: from_utf8 ( & out. stderr ) . unwrap ( ) ;
70- assert ! ( !s. contains( "stack backtrace" ) && !s. contains( " - backtrace:: foo") ,
87+ assert ! ( !s. contains( "stack backtrace" ) && !s. contains( & expected ( " foo") ) ,
7188 "bad output2: {}" , s) ;
7289
7390 // Make sure a stack trace is printed
@@ -77,7 +94,7 @@ fn runtest(me: &str) {
7794 let s = str:: from_utf8 ( & out. stderr ) . unwrap ( ) ;
7895 // loosened the following from double::h to double:: due to
7996 // spurious failures on mac, 32bit, optimized
80- assert ! ( s. contains( "stack backtrace" ) && s. contains( " - backtrace:: double") ,
97+ assert ! ( s. contains( "stack backtrace" ) && s. contains( & expected ( " double") ) ,
8198 "bad output3: {}" , s) ;
8299
83100 // Make sure a stack trace isn't printed too many times
0 commit comments