@@ -45,13 +45,30 @@ fn template(me: &str) -> Command {
4545 return m;
4646}
4747
48+ fn expected ( fn_name : & str ) -> String {
49+ // FIXME(#32481)
50+ //
51+ // On windows, we read the function name from debuginfo using some
52+ // system APIs. For whatever reason, these APIs seem to use the
53+ // "name" field, which is only the "relative" name, not the full
54+ // name with namespace info, so we just see `foo` and not
55+ // `backtrace::foo` as we see on linux (which uses the linkage
56+ // name).
57+
58+ if cfg ! ( windows) {
59+ format ! ( " - {}" , fn_name)
60+ } else {
61+ format ! ( " - backtrace::{}" , fn_name)
62+ }
63+ }
64+
4865fn runtest ( me : & str ) {
4966 // Make sure that the stack trace is printed
5067 let p = template ( me) . arg ( "fail" ) . env ( "RUST_BACKTRACE" , "1" ) . spawn ( ) . unwrap ( ) ;
5168 let out = p. wait_with_output ( ) . unwrap ( ) ;
5269 assert ! ( !out. status. success( ) ) ;
5370 let s = str:: from_utf8 ( & out. stderr ) . unwrap ( ) ;
54- assert ! ( s. contains( "stack backtrace" ) && s. contains( " - backtrace:: foo") ,
71+ assert ! ( s. contains( "stack backtrace" ) && s. contains( & expected ( " foo") ) ,
5572 "bad output: {}" , s) ;
5673
5774 // Make sure the stack trace is *not* printed
@@ -61,7 +78,7 @@ fn runtest(me: &str) {
6178 let out = p. wait_with_output ( ) . unwrap ( ) ;
6279 assert ! ( !out. status. success( ) ) ;
6380 let s = str:: from_utf8 ( & out. stderr ) . unwrap ( ) ;
64- assert ! ( !s. contains( "stack backtrace" ) && !s. contains( " - backtrace:: foo") ,
81+ assert ! ( !s. contains( "stack backtrace" ) && !s. contains( & expected ( " foo") ) ,
6582 "bad output2: {}" , s) ;
6683
6784 // Make sure a stack trace is printed
@@ -71,7 +88,7 @@ fn runtest(me: &str) {
7188 let s = str:: from_utf8 ( & out. stderr ) . unwrap ( ) ;
7289 // loosened the following from double::h to double:: due to
7390 // spurious failures on mac, 32bit, optimized
74- assert ! ( s. contains( "stack backtrace" ) && s. contains( " - backtrace:: double") ,
91+ assert ! ( s. contains( "stack backtrace" ) && s. contains( & expected ( " double") ) ,
7592 "bad output3: {}" , s) ;
7693
7794 // Make sure a stack trace isn't printed too many times
0 commit comments