File tree Expand file tree Collapse file tree 4 files changed +40
-34
lines changed
tests/run-make/debug-assertions Expand file tree Collapse file tree 4 files changed +40
-34
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ run-make/cross-lang-lto-clang/Makefile
1818run-make/cross-lang-lto-pgo-smoketest/Makefile
1919run-make/cross-lang-lto-upstream-rlibs/Makefile
2020run-make/cross-lang-lto/Makefile
21- run-make/debug-assertions/Makefile
2221run-make/dep-info-doesnt-run-much/Makefile
2322run-make/dep-info-spaces/Makefile
2423run-make/dep-info/Makefile
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11#![ feature( rustc_attrs) ]
22#![ deny( warnings) ]
33
4- use std:: env;
54use std:: thread;
65
76fn 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( ) ) ;
1310}
1411
1512fn 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