@@ -6,6 +6,11 @@ use std::env;
6
6
use std:: ffi:: OsStr ;
7
7
use std:: process:: Command ;
8
8
9
+ #[ cfg( not( windows) ) ]
10
+ const CARGO_CLIPPY : & str = "cargo-clippy" ;
11
+ #[ cfg( windows) ]
12
+ const CARGO_CLIPPY : & str = "cargo-clippy.exe" ;
13
+
9
14
#[ cfg_attr( feature = "integration" , test) ]
10
15
fn integration_test ( ) {
11
16
let repo_name = env:: var ( "INTEGRATION" ) . expect ( "`INTEGRATION` var not set" ) ;
@@ -31,7 +36,7 @@ fn integration_test() {
31
36
32
37
let root_dir = std:: path:: PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) ) ;
33
38
let target_dir = std:: path:: Path :: new ( & root_dir) . join ( "target" ) ;
34
- let clippy_binary = target_dir. join ( env ! ( "PROFILE" ) ) . join ( "cargo-clippy" ) ;
39
+ let clippy_binary = target_dir. join ( env ! ( "PROFILE" ) ) . join ( CARGO_CLIPPY ) ;
35
40
36
41
let output = Command :: new ( clippy_binary)
37
42
. current_dir ( repo_dir)
@@ -51,17 +56,15 @@ fn integration_test() {
51
56
. expect ( "unable to run clippy" ) ;
52
57
53
58
let stderr = String :: from_utf8_lossy ( & output. stderr ) ;
54
- if stderr. contains ( "internal compiler error" ) {
55
- let backtrace_start = stderr
56
- . find ( "thread 'rustc' panicked at" )
57
- . expect ( "start of backtrace not found" ) ;
58
- let backtrace_end = stderr
59
- . rfind ( "error: internal compiler error" )
59
+ if let Some ( backtrace_start) = stderr. find ( "error: internal compiler error" ) {
60
+ static BACKTRACE_END_MSG : & str = "end of query stack" ;
61
+ let backtrace_end = stderr[ backtrace_start..]
62
+ . find ( BACKTRACE_END_MSG )
60
63
. expect ( "end of backtrace not found" ) ;
61
64
62
65
panic ! (
63
66
"internal compiler error\n Backtrace:\n \n {}" ,
64
- & stderr[ backtrace_start..backtrace_end]
67
+ & stderr[ backtrace_start..backtrace_start + backtrace_end + BACKTRACE_END_MSG . len ( ) ]
65
68
) ;
66
69
} else if stderr. contains ( "query stack during panic" ) {
67
70
panic ! ( "query stack during panic in the output" ) ;
0 commit comments