-
Notifications
You must be signed in to change notification settings - Fork 61
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
Use stable libtest #165
base: master
Are you sure you want to change the base?
Use stable libtest #165
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "compiletest_rs" | ||
version = "0.3.20" | ||
version = "0.4.0" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please don't do version bumps in this commit, I do that separately. |
||
authors = [ "The Rust Project Developers" | ||
, "Thomas Bracht Laumann Jespersen <laumann.thomas@gmail.com>" | ||
, "Manish Goregaokar <manishsmail@gmail.com>" | ||
|
@@ -25,8 +25,7 @@ serde = "1.0" | |
serde_json = "1.0" | ||
serde_derive = "1.0" | ||
rustfix = "0.4.1" | ||
tester = { version = "0.5", optional = true } | ||
libtest = "0.0.1" | ||
libtest = { git = "/~https://github.com/gnzlbg/libtest", branch = "clippy_ci" } | ||
|
||
[target."cfg(unix)".dependencies] | ||
libc = "0.2" | ||
|
@@ -37,5 +36,4 @@ winapi = { version = "0.3", features = ["winerror"] } | |
|
||
[features] | ||
tmp = ["tempfile"] | ||
norustc = [] | ||
stable = ["norustc", "tester"] | ||
unstable = [ "libtest/unstable" ] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,18 +9,15 @@ | |
// except according to those terms. | ||
|
||
#![crate_type = "lib"] | ||
|
||
#![cfg_attr(not(feature = "norustc"), feature(rustc_private))] | ||
#![cfg_attr(not(feature = "stable"), feature(test))] | ||
|
||
#![deny(unused_imports)] | ||
#![cfg_attr(feature = "unstable", feature(rustc_private))] | ||
|
||
#[cfg(not(feature = "norustc"))] | ||
#[cfg(feature = "unstable")] | ||
extern crate rustc; | ||
|
||
#[cfg(unix)] | ||
extern crate libc; | ||
extern crate libtest as test; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the rename to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't want it to try and link with the local There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But an |
||
extern crate libtest; | ||
|
||
#[cfg(feature = "tmp")] extern crate tempfile; | ||
|
||
|
@@ -84,7 +81,7 @@ pub fn run_tests(config: &Config) { | |
// Prevent issue #21352 UAC blocking .exe containing 'patch' etc. on Windows | ||
// If #11207 is resolved (adding manifest to .exe) this becomes unnecessary | ||
env::set_var("__COMPAT_LAYER", "RunAsInvoker"); | ||
let res = test::run_tests_console(&opts, tests.into_iter().collect()); | ||
let res = libtest::run_tests_console(&opts, tests.into_iter().collect()); | ||
match res { | ||
Ok(true) => {} | ||
Ok(false) => panic!("Some tests failed"), | ||
|
@@ -94,30 +91,30 @@ pub fn run_tests(config: &Config) { | |
} | ||
} | ||
|
||
pub fn test_opts(config: &Config) -> test::TestOpts { | ||
test::TestOpts { | ||
pub fn test_opts(config: &Config) -> libtest::TestOpts { | ||
libtest::TestOpts { | ||
filter: config.filter.clone(), | ||
filter_exact: config.filter_exact, | ||
#[cfg(not(feature = "stable"))] | ||
exclude_should_panic: false, | ||
run_ignored: if config.run_ignored { test::RunIgnored::Yes } else { test::RunIgnored::No }, | ||
format: if config.quiet { test::OutputFormat::Terse } else { test::OutputFormat::Pretty }, | ||
run_ignored: if config.run_ignored { libtest::RunIgnored::Yes } else { libtest::RunIgnored::No }, | ||
format: if config.quiet { libtest::OutputFormat::Terse } else { libtest::OutputFormat::Pretty }, | ||
logfile: config.logfile.clone(), | ||
run_tests: true, | ||
bench_benchmarks: true, | ||
nocapture: match env::var("RUST_TEST_NOCAPTURE") { | ||
Ok(val) => &val != "0", | ||
Err(_) => false | ||
}, | ||
color: test::AutoColor, | ||
color: libtest::ColorChoice::Auto, | ||
test_threads: None, | ||
skip: vec![], | ||
list: false, | ||
options: test::Options::new(), | ||
options: libtest::Options::new(), | ||
} | ||
} | ||
|
||
pub fn make_tests(config: &Config) -> Vec<test::TestDescAndFn> { | ||
pub fn make_tests(config: &Config) -> Vec<libtest::TestDescAndFn> { | ||
debug!("making tests from {:?}", | ||
config.src_base.display()); | ||
let mut tests = Vec::new(); | ||
|
@@ -134,7 +131,7 @@ fn collect_tests_from_dir(config: &Config, | |
base: &Path, | ||
dir: &Path, | ||
relative_dir_path: &Path, | ||
tests: &mut Vec<test::TestDescAndFn>) | ||
tests: &mut Vec<libtest::TestDescAndFn>) | ||
-> io::Result<()> { | ||
// Ignore directories that contain a file | ||
// `compiletest-ignore-dir`. | ||
|
@@ -224,23 +221,23 @@ pub fn is_test(file_name: &OsString) -> bool { | |
!invalid_prefixes.iter().any(|p| file_name.starts_with(p)) | ||
} | ||
|
||
pub fn make_test(config: &Config, testpaths: &TestPaths) -> test::TestDescAndFn { | ||
pub fn make_test(config: &Config, testpaths: &TestPaths) -> libtest::TestDescAndFn { | ||
let early_props = EarlyProps::from_file(config, &testpaths.file); | ||
|
||
// The `should-fail` annotation doesn't apply to pretty tests, | ||
// since we run the pretty printer across all tests by default. | ||
// If desired, we could add a `should-fail-pretty` annotation. | ||
let should_panic = match config.mode { | ||
Pretty => test::ShouldPanic::No, | ||
Pretty => libtest::ShouldPanic::No, | ||
_ => if early_props.should_fail { | ||
test::ShouldPanic::Yes | ||
libtest::ShouldPanic::Yes | ||
} else { | ||
test::ShouldPanic::No | ||
libtest::ShouldPanic::No | ||
} | ||
}; | ||
|
||
test::TestDescAndFn { | ||
desc: test::TestDesc { | ||
libtest::TestDescAndFn { | ||
desc: libtest::TestDesc { | ||
name: make_test_name(config, testpaths), | ||
ignore: early_props.ignore, | ||
should_panic: should_panic, | ||
|
@@ -260,23 +257,22 @@ fn stamp(config: &Config, testpaths: &TestPaths) -> PathBuf { | |
.join(stamp_name) | ||
} | ||
|
||
pub fn make_test_name(config: &Config, testpaths: &TestPaths) -> test::TestName { | ||
pub fn make_test_name(config: &Config, testpaths: &TestPaths) -> libtest::TestName { | ||
// Convert a complete path to something like | ||
// | ||
// run-pass/foo/bar/baz.rs | ||
let path = | ||
PathBuf::from(config.src_base.file_name().unwrap()) | ||
.join(&testpaths.relative_dir) | ||
.join(&testpaths.file.file_name().unwrap()); | ||
test::DynTestName(format!("[{}] {}", config.mode, path.display())) | ||
libtest::TestName::DynTestName(format!("[{}] {}", config.mode, path.display())) | ||
} | ||
|
||
pub fn make_test_closure(config: &Config, testpaths: &TestPaths) -> test::TestFn { | ||
pub fn make_test_closure(config: &Config, testpaths: &TestPaths) -> libtest::TestFn { | ||
let config = config.clone(); | ||
let testpaths = testpaths.clone(); | ||
test::DynTestFn(Box::new(move || { | ||
#[cfg(feature = "stable")] | ||
let config = config.clone(); // FIXME: why is this needed? | ||
libtest::TestFn::DynTestFn(Box::new(move || { | ||
let config = config.clone(); | ||
runtest::run(config, &testpaths) | ||
})) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about
nightly
for the feature name?