@@ -298,6 +298,12 @@ impl<'test> TestCx<'test> {
298
298
/// Code executed for each revision in turn (or, if there are no
299
299
/// revisions, exactly once, with revision == None).
300
300
fn run_revision ( & self ) {
301
+ if self . props . should_ice {
302
+ if self . config . mode != CompileFail &&
303
+ self . config . mode != Incremental {
304
+ self . fatal ( "cannot use should-ice in a test that is not cfail" ) ;
305
+ }
306
+ }
301
307
match self . config . mode {
302
308
CompileFail => self . run_cfail_test ( ) ,
303
309
RunFail => self . run_rfail_test ( ) ,
@@ -383,7 +389,7 @@ impl<'test> TestCx<'test> {
383
389
fn run_cfail_test ( & self ) {
384
390
let proc_res = self . compile_test ( ) ;
385
391
self . check_if_test_should_compile ( & proc_res) ;
386
- self . check_no_compiler_crash ( & proc_res) ;
392
+ self . check_no_compiler_crash ( & proc_res, self . props . should_ice ) ;
387
393
388
394
let output_to_check = self . get_output ( & proc_res) ;
389
395
let expected_errors = errors:: load_errors ( & self . testpaths . file , self . revision ) ;
@@ -395,6 +401,12 @@ impl<'test> TestCx<'test> {
395
401
} else {
396
402
self . check_error_patterns ( & output_to_check, & proc_res) ;
397
403
}
404
+ if self . props . should_ice {
405
+ match proc_res. status . code ( ) {
406
+ Some ( 101 ) => ( ) ,
407
+ _ => self . fatal ( "expected ICE" ) ,
408
+ }
409
+ }
398
410
399
411
self . check_forbid_output ( & output_to_check, & proc_res) ;
400
412
}
@@ -1402,9 +1414,11 @@ impl<'test> TestCx<'test> {
1402
1414
}
1403
1415
}
1404
1416
1405
- fn check_no_compiler_crash ( & self , proc_res : & ProcRes ) {
1417
+ fn check_no_compiler_crash ( & self , proc_res : & ProcRes , should_ice : bool ) {
1406
1418
match proc_res. status . code ( ) {
1407
- Some ( 101 ) => self . fatal_proc_rec ( "compiler encountered internal error" , proc_res) ,
1419
+ Some ( 101 ) if !should_ice => {
1420
+ self . fatal_proc_rec ( "compiler encountered internal error" , proc_res)
1421
+ }
1408
1422
None => self . fatal_proc_rec ( "compiler terminated by signal" , proc_res) ,
1409
1423
_ => ( ) ,
1410
1424
}
@@ -2518,7 +2532,7 @@ impl<'test> TestCx<'test> {
2518
2532
self . fatal_proc_rec ( "compilation failed!" , & proc_res) ;
2519
2533
}
2520
2534
2521
- self . check_no_compiler_crash ( & proc_res) ;
2535
+ self . check_no_compiler_crash ( & proc_res, self . props . should_ice ) ;
2522
2536
2523
2537
const PREFIX : & ' static str = "MONO_ITEM " ;
2524
2538
const CGU_MARKER : & ' static str = "@@" ;
@@ -2774,8 +2788,14 @@ impl<'test> TestCx<'test> {
2774
2788
}
2775
2789
2776
2790
if revision. starts_with ( "rpass" ) {
2791
+ if revision_cx. props . should_ice {
2792
+ revision_cx. fatal ( "can only use should-ice in cfail tests" ) ;
2793
+ }
2777
2794
revision_cx. run_rpass_test ( ) ;
2778
2795
} else if revision. starts_with ( "rfail" ) {
2796
+ if revision_cx. props . should_ice {
2797
+ revision_cx. fatal ( "can only use should-ice in cfail tests" ) ;
2798
+ }
2779
2799
revision_cx. run_rfail_test ( ) ;
2780
2800
} else if revision. starts_with ( "cfail" ) {
2781
2801
revision_cx. run_cfail_test ( ) ;
0 commit comments