diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..3c1f41bdcc --- /dev/null +++ b/.editorconfig @@ -0,0 +1,25 @@ +# EditorConfig helps developers define and maintain consistent +# coding styles between different editors and IDEs +# editorconfig.org + +root = true + + +[*] +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +indent_style = space +indent_size = 4 + +[*.rs] +indent_style = space +indent_size = 4 + +[*.toml] +indent_style = space +indent_size = 4 + +[*.md] +trim_trailing_whitespace = false diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..8a35c59bfa --- /dev/null +++ b/.travis.yml @@ -0,0 +1,18 @@ +language: rust +rust: +- nightly-2016-04-11 +- nightly +matrix: + allow_failures: + - rust: nightly +before_script: +- | + pip install 'travis-cargo<0.2' --user && + export PATH=$HOME/.local/bin:$PATH +script: +- | + travis-cargo build && + env RUST_SYSROOT=$HOME/rust RUST_TEST_NOCAPTURE=1 travis-cargo test +notifications: + email: + on_success: never diff --git a/tests/compile-test.rs b/tests/compile-test.rs new file mode 100644 index 0000000000..c7cdb974ca --- /dev/null +++ b/tests/compile-test.rs @@ -0,0 +1,37 @@ +use std::{env, fs}; +use std::process::{Command, Output}; + +fn run_miri(file: &str, sysroot: &str) -> Output { + Command::new("cargo") + .args(&["run", "--", "--sysroot", sysroot, file]) + .output() + .unwrap_or_else(|e| panic!("failed to execute process: {}", e)) +} + +#[test] +fn run_pass() { + let sysroot = env::var("RUST_SYSROOT").expect("env variable `RUST_SYSROOT` not set"); + + let test_files = fs::read_dir("./tests/run-pass/") + .expect("Can't read `run-pass` directory") + .filter_map(|entry| entry.ok()) + .filter(|entry| { + entry.clone() + .file_type() + .map(|x| x.is_file()) + .unwrap_or(false) + }) + .filter_map(|entry| entry.path().to_str().map(|x| x.to_string())); + + for file in test_files { + println!("{}: compile test running", file); + + let test_run = run_miri(&file, &sysroot); + + if test_run.status.code().unwrap_or(-1) != 0 { + println!("{}: error {:?}", file, test_run); + } else { + println!("{}: ok", file); + } + } +} diff --git a/test/arrays.rs b/tests/run-pass/arrays.rs similarity index 100% rename from test/arrays.rs rename to tests/run-pass/arrays.rs diff --git a/test/bools.rs b/tests/run-pass/bools.rs similarity index 100% rename from test/bools.rs rename to tests/run-pass/bools.rs diff --git a/test/c_enums.rs b/tests/run-pass/c_enums.rs similarity index 100% rename from test/c_enums.rs rename to tests/run-pass/c_enums.rs diff --git a/test/calls.rs b/tests/run-pass/calls.rs similarity index 100% rename from test/calls.rs rename to tests/run-pass/calls.rs diff --git a/test/closures.rs b/tests/run-pass/closures.rs similarity index 100% rename from test/closures.rs rename to tests/run-pass/closures.rs diff --git a/test/errors.rs b/tests/run-pass/errors.rs similarity index 100% rename from test/errors.rs rename to tests/run-pass/errors.rs diff --git a/test/heap.rs b/tests/run-pass/heap.rs similarity index 100% rename from test/heap.rs rename to tests/run-pass/heap.rs diff --git a/test/ints.rs b/tests/run-pass/ints.rs similarity index 100% rename from test/ints.rs rename to tests/run-pass/ints.rs diff --git a/test/loops.rs b/tests/run-pass/loops.rs similarity index 100% rename from test/loops.rs rename to tests/run-pass/loops.rs diff --git a/test/pointers.rs b/tests/run-pass/pointers.rs similarity index 100% rename from test/pointers.rs rename to tests/run-pass/pointers.rs diff --git a/test/products.rs b/tests/run-pass/products.rs similarity index 100% rename from test/products.rs rename to tests/run-pass/products.rs diff --git a/test/specialization.rs b/tests/run-pass/specialization.rs similarity index 100% rename from test/specialization.rs rename to tests/run-pass/specialization.rs diff --git a/test/std.rs b/tests/run-pass/std.rs similarity index 100% rename from test/std.rs rename to tests/run-pass/std.rs diff --git a/test/strings.rs b/tests/run-pass/strings.rs similarity index 100% rename from test/strings.rs rename to tests/run-pass/strings.rs diff --git a/test/sums.rs b/tests/run-pass/sums.rs similarity index 100% rename from test/sums.rs rename to tests/run-pass/sums.rs diff --git a/test/trivial.rs b/tests/run-pass/trivial.rs similarity index 100% rename from test/trivial.rs rename to tests/run-pass/trivial.rs diff --git a/test/vecs.rs b/tests/run-pass/vecs.rs similarity index 100% rename from test/vecs.rs rename to tests/run-pass/vecs.rs