@@ -4,7 +4,7 @@ use crate::common::{
4
4
expected_output_path, UI_EXTENSIONS , UI_FIXED , UI_STDERR , UI_STDOUT , UI_SVG , UI_WINDOWS_SVG ,
5
5
} ;
6
6
use crate :: common:: { incremental_dir, output_base_dir, output_base_name, output_testname_unique} ;
7
- use crate :: common:: { Assembly , Incremental , JsDocTest , MirOpt , RunMake , RustdocJson , Ui } ;
7
+ use crate :: common:: { Assembly , Crashes , Incremental , JsDocTest , MirOpt , RunMake , RustdocJson , Ui } ;
8
8
use crate :: common:: { Codegen , CodegenUnits , DebugInfo , Debugger , Rustdoc } ;
9
9
use crate :: common:: { CompareMode , FailMode , PassMode } ;
10
10
use crate :: common:: { Config , TestPaths } ;
@@ -244,7 +244,7 @@ impl<'test> TestCx<'test> {
244
244
/// Code executed for each revision in turn (or, if there are no
245
245
/// revisions, exactly once, with revision == None).
246
246
fn run_revision ( & self ) {
247
- if self . props . should_ice && self . config . mode != Incremental {
247
+ if self . props . should_ice && self . config . mode != Incremental && self . config . mode != Crashes {
248
248
self . fatal ( "cannot use should-ice in a test that is not cfail" ) ;
249
249
}
250
250
match self . config . mode {
@@ -263,6 +263,7 @@ impl<'test> TestCx<'test> {
263
263
JsDocTest => self . run_js_doc_test ( ) ,
264
264
CoverageMap => self . run_coverage_map_test ( ) ,
265
265
CoverageRun => self . run_coverage_run_test ( ) ,
266
+ Crashes => self . run_crash_test ( ) ,
266
267
}
267
268
}
268
269
@@ -295,6 +296,7 @@ impl<'test> TestCx<'test> {
295
296
match self . config . mode {
296
297
JsDocTest => true ,
297
298
Ui => pm. is_some ( ) || self . props . fail_mode > Some ( FailMode :: Build ) ,
299
+ Crashes => false ,
298
300
Incremental => {
299
301
let revision =
300
302
self . revision . expect ( "incremental tests require a list of revisions" ) ;
@@ -359,6 +361,17 @@ impl<'test> TestCx<'test> {
359
361
self . check_forbid_output ( & output_to_check, & proc_res) ;
360
362
}
361
363
364
+ fn run_crash_test ( & self ) {
365
+ let pm = self . pass_mode ( ) ;
366
+ let proc_res = self . compile_test ( WillExecute :: No , self . should_emit_metadata ( pm) ) ;
367
+
368
+ // if a test does not crash, consider it an error
369
+ match proc_res. status . code ( ) {
370
+ Some ( 101 ) => ( ) ,
371
+ _ => self . fatal ( "expected ICE" ) ,
372
+ }
373
+ }
374
+
362
375
fn run_rfail_test ( & self ) {
363
376
let pm = self . pass_mode ( ) ;
364
377
let should_run = self . run_if_enabled ( ) ;
@@ -2499,7 +2512,7 @@ impl<'test> TestCx<'test> {
2499
2512
rustc. arg ( "-Cdebug-assertions=no" ) ;
2500
2513
}
2501
2514
RunPassValgrind | Pretty | DebugInfo | Rustdoc | RustdocJson | RunMake
2502
- | CodegenUnits | JsDocTest => {
2515
+ | CodegenUnits | JsDocTest | Crashes => {
2503
2516
// do not use JSON output
2504
2517
}
2505
2518
}
0 commit comments