rewrite debug-assertions to rmake
This commit is contained in:
parent
acb6078d91
commit
cb1281b76d
@ -18,7 +18,6 @@ run-make/cross-lang-lto-clang/Makefile
|
||||
run-make/cross-lang-lto-pgo-smoketest/Makefile
|
||||
run-make/cross-lang-lto-upstream-rlibs/Makefile
|
||||
run-make/cross-lang-lto/Makefile
|
||||
run-make/debug-assertions/Makefile
|
||||
run-make/dep-info-doesnt-run-much/Makefile
|
||||
run-make/dep-info-spaces/Makefile
|
||||
run-make/dep-info/Makefile
|
||||
|
@ -1,27 +0,0 @@
|
||||
# ignore-cross-compile
|
||||
# needs-unwind
|
||||
include ../tools.mk
|
||||
|
||||
all:
|
||||
$(RUSTC) debug.rs -C debug-assertions=no
|
||||
$(call RUN,debug) good
|
||||
$(RUSTC) debug.rs -C opt-level=0
|
||||
$(call RUN,debug) bad
|
||||
$(RUSTC) debug.rs -C opt-level=1
|
||||
$(call RUN,debug) good
|
||||
$(RUSTC) debug.rs -C opt-level=2
|
||||
$(call RUN,debug) good
|
||||
$(RUSTC) debug.rs -C opt-level=3
|
||||
$(call RUN,debug) good
|
||||
$(RUSTC) debug.rs -C opt-level=s
|
||||
$(call RUN,debug) good
|
||||
$(RUSTC) debug.rs -C opt-level=z
|
||||
$(call RUN,debug) good
|
||||
$(RUSTC) debug.rs -O
|
||||
$(call RUN,debug) good
|
||||
$(RUSTC) debug.rs
|
||||
$(call RUN,debug) bad
|
||||
$(RUSTC) debug.rs -C debug-assertions=yes -O
|
||||
$(call RUN,debug) bad
|
||||
$(RUSTC) debug.rs -C debug-assertions=yes -C opt-level=1
|
||||
$(call RUN,debug) bad
|
@ -1,15 +1,12 @@
|
||||
#![feature(rustc_attrs)]
|
||||
#![deny(warnings)]
|
||||
|
||||
use std::env;
|
||||
use std::thread;
|
||||
|
||||
fn main() {
|
||||
let should_fail = env::args().nth(1) == Some("bad".to_string());
|
||||
|
||||
assert_eq!(thread::spawn(debug_assert_eq).join().is_err(), should_fail);
|
||||
assert_eq!(thread::spawn(debug_assert).join().is_err(), should_fail);
|
||||
assert_eq!(thread::spawn(overflow).join().is_err(), should_fail);
|
||||
assert!(thread::spawn(debug_assert_eq).join().is_ok());
|
||||
assert!(thread::spawn(debug_assert).join().is_ok());
|
||||
assert!(thread::spawn(overflow).join().is_ok());
|
||||
}
|
||||
|
||||
fn debug_assert_eq() {
|
||||
|
37
tests/run-make/debug-assertions/rmake.rs
Normal file
37
tests/run-make/debug-assertions/rmake.rs
Normal file
@ -0,0 +1,37 @@
|
||||
// debug.rs contains some "debug assertion" statements which
|
||||
// should only be enabled in either non-optimized builds or when
|
||||
// `-C debug-assertions` is set to yes. These debug assertions
|
||||
// are guaranteed to fail, so this test checks that the run command
|
||||
// fails where debug assertions should be activated, and succeeds where
|
||||
// debug assertions should be disabled.
|
||||
// See https://github.com/rust-lang/rust/pull/22980
|
||||
|
||||
//@ ignore-cross-compile
|
||||
//@ needs-unwind
|
||||
|
||||
use run_make_support::{run, run_fail, rustc};
|
||||
|
||||
fn main() {
|
||||
rustc().input("debug.rs").arg("-Cdebug-assertions=no").run();
|
||||
run("debug");
|
||||
rustc().input("debug.rs").opt_level("0").run();
|
||||
run_fail("debug");
|
||||
rustc().input("debug.rs").opt_level("1").run();
|
||||
run("debug");
|
||||
rustc().input("debug.rs").opt_level("2").run();
|
||||
run("debug");
|
||||
rustc().input("debug.rs").opt_level("3").run();
|
||||
run("debug");
|
||||
rustc().input("debug.rs").opt_level("s").run();
|
||||
run("debug");
|
||||
rustc().input("debug.rs").opt_level("z").run();
|
||||
run("debug");
|
||||
rustc().input("debug.rs").opt().run();
|
||||
run("debug");
|
||||
rustc().input("debug.rs").run();
|
||||
run_fail("debug");
|
||||
rustc().input("debug.rs").opt().arg("-Cdebug-assertions=yes").run();
|
||||
run_fail("debug");
|
||||
rustc().input("debug.rs").opt_level("1").arg("-Cdebug-assertions=yes").run();
|
||||
run_fail("debug");
|
||||
}
|
Loading…
Reference in New Issue
Block a user