]> git.lizzy.rs Git - rust.git/blob - tests/compiletest.rs
various testing improvements
[rust.git] / tests / compiletest.rs
1 extern crate compiletest_rs as compiletest;
2
3 use std::path::PathBuf;
4
5 fn run_mode(mode: &'static str) {
6     let mut config = compiletest::default_config();
7     config.rustc_path = "target/debug/miri".into();
8     let path = std::env::var("RUST_SYSROOT").expect("env variable `RUST_SYSROOT` not set");
9     config.target_rustcflags = Some(format!("--sysroot {}", path));
10     config.host_rustcflags = Some(format!("--sysroot {}", path));
11     let cfg_mode = mode.parse().ok().expect("Invalid mode");
12
13     config.mode = cfg_mode;
14     config.src_base = PathBuf::from(format!("tests/{}", mode));
15
16     compiletest::run_tests(&config);
17 }
18
19 #[test]
20 fn compile_test() {
21     run_mode("compile-fail");
22     run_mode("run-pass");
23     run_mode("run-fail");
24 }