File tree 4 files changed +40
-34
lines changed
tests/run-make/debug-assertions
4 files changed +40
-34
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ run-make/cross-lang-lto-clang/Makefile
19
19
run-make/cross-lang-lto-pgo-smoketest/Makefile
20
20
run-make/cross-lang-lto-upstream-rlibs/Makefile
21
21
run-make/cross-lang-lto/Makefile
22
- run-make/debug-assertions/Makefile
23
22
run-make/dep-info-doesnt-run-much/Makefile
24
23
run-make/dep-info-spaces/Makefile
25
24
run-make/dep-info/Makefile
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
#![ feature( rustc_attrs) ]
2
2
#![ deny( warnings) ]
3
3
4
- use std:: env;
5
4
use std:: thread;
6
5
7
6
fn main ( ) {
8
- let should_fail = env:: args ( ) . nth ( 1 ) == Some ( "bad" . to_string ( ) ) ;
9
-
10
- assert_eq ! ( thread:: spawn( debug_assert_eq) . join( ) . is_err( ) , should_fail) ;
11
- assert_eq ! ( thread:: spawn( debug_assert) . join( ) . is_err( ) , should_fail) ;
12
- assert_eq ! ( thread:: spawn( overflow) . join( ) . is_err( ) , should_fail) ;
7
+ assert ! ( thread:: spawn( debug_assert_eq) . join( ) . is_ok( ) ) ;
8
+ assert ! ( thread:: spawn( debug_assert) . join( ) . is_ok( ) ) ;
9
+ assert ! ( thread:: spawn( overflow) . join( ) . is_ok( ) ) ;
13
10
}
14
11
15
12
fn debug_assert_eq ( ) {
Original file line number Diff line number Diff line change
1
+ // debug.rs contains some "debug assertion" statements which
2
+ // should only be enabled in either non-optimized builds or when
3
+ // `-C debug-assertions` is set to yes. These debug assertions
4
+ // are guaranteed to fail, so this test checks that the run command
5
+ // fails where debug assertions should be activated, and succeeds where
6
+ // debug assertions should be disabled.
7
+ // See https://github.com/rust-lang/rust/pull/22980
8
+
9
+ //@ ignore-cross-compile
10
+ //@ needs-unwind
11
+
12
+ use run_make_support:: { run, run_fail, rustc} ;
13
+
14
+ fn main ( ) {
15
+ rustc ( ) . input ( "debug.rs" ) . arg ( "-Cdebug-assertions=no" ) . run ( ) ;
16
+ run ( "debug" ) ;
17
+ rustc ( ) . input ( "debug.rs" ) . opt_level ( "0" ) . run ( ) ;
18
+ run_fail ( "debug" ) ;
19
+ rustc ( ) . input ( "debug.rs" ) . opt_level ( "1" ) . run ( ) ;
20
+ run ( "debug" ) ;
21
+ rustc ( ) . input ( "debug.rs" ) . opt_level ( "2" ) . run ( ) ;
22
+ run ( "debug" ) ;
23
+ rustc ( ) . input ( "debug.rs" ) . opt_level ( "3" ) . run ( ) ;
24
+ run ( "debug" ) ;
25
+ rustc ( ) . input ( "debug.rs" ) . opt_level ( "s" ) . run ( ) ;
26
+ run ( "debug" ) ;
27
+ rustc ( ) . input ( "debug.rs" ) . opt_level ( "z" ) . run ( ) ;
28
+ run ( "debug" ) ;
29
+ rustc ( ) . input ( "debug.rs" ) . opt ( ) . run ( ) ;
30
+ run ( "debug" ) ;
31
+ rustc ( ) . input ( "debug.rs" ) . run ( ) ;
32
+ run_fail ( "debug" ) ;
33
+ rustc ( ) . input ( "debug.rs" ) . opt ( ) . arg ( "-Cdebug-assertions=yes" ) . run ( ) ;
34
+ run_fail ( "debug" ) ;
35
+ rustc ( ) . input ( "debug.rs" ) . opt_level ( "1" ) . arg ( "-Cdebug-assertions=yes" ) . run ( ) ;
36
+ run_fail ( "debug" ) ;
37
+ }
You can’t perform that action at this time.
0 commit comments