Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Tests on Travis #3

Merged
merged 3 commits into from
Apr 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
language: rust
rust:
- nightly-2016-04-11
Copy link
Member

@solson solson Apr 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@killercup Can you add plain nightly here as well so we can be notified when new nightlies break Miri?

- nightly
matrix:
allow_failures:
- rust: nightly
before_script:
- |
pip install 'travis-cargo<0.2' --user &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@killercup I glanced at travis-cargo's readme, but I'm still unsure what benefit it provides over running cargo directly in this case. Can you explain?

Copy link
Member Author

@killercup killercup Apr 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, it works! Should I add --nocapture so we can see the actual test
output even if there was no failure?

I'll add nightly as soon as I get to a computer. Do you want to gate the
build on this or should it be an allowed failure?

Tbh, I mostly copied the Travis file from my other projects, which all use
more of travis-cargos's features. travis-cargo is pretty nice, you can e.g.
easily generate an upload documentation (needs a github token with access
to the repo) or run coverage tests.
Scott Olson [email protected] schrieb am Fr., 15. Apr. 2016 um
05:25:

In .travis.yml #3 (comment)
:

@@ -0,0 +1,14 @@
+language: rust
+rust:
+- nightly-2016-04-11
+before_script:
+- |

  • pip install 'travis-cargo<0.2' --user &&

@killercup https://github.com/killercup I glanced at travis-cargo's
readme, but I'm still unsure what benefit it provides over running cargo
directly in this case. Can you explain?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/tsion/miri/pull/3/files/99767e7a293c2ea26725a047fcc870af97d58ee3#r59823208

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I add --nocapture so we can see the actual test output even if there was no failure?

Yeah, that sounds good for now.

So you want to hate the build on this or should it be an allowed failure?

I think allowed failure is fine.

So my understanding is that the script as currently written doesn't benefit from travis-cargo but we could make use of it in the future. I'm fine with that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright!

Oh, and sorry for the typos in that last comment 😄
Scott Olson [email protected] schrieb am Fr., 15. Apr. 2016 um
08:41:

In .travis.yml #3 (comment)
:

@@ -0,0 +1,14 @@
+language: rust
+rust:
+- nightly-2016-04-11
+before_script:
+- |

  • pip install 'travis-cargo<0.2' --user &&

Should I add --nocapture so we can see the actual test output even if
there was no failure?

Yeah, that sounds good for now.

So you want to hate the build on this or should it be an allowed failure?

I think allowed failure is fine.

So my understanding is that the script as currently written doesn't
benefit from travis-cargo but we could make use of it in the future. I'm
fine with that.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/tsion/miri/pull/3/files/99767e7a293c2ea26725a047fcc870af97d58ee3#r59832429

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
37 changes: 37 additions & 0 deletions tests/compile-test.rs
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.