diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 80b8a8b728bb2..c1920dde5b1fe 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -117,6 +117,7 @@ impl CompareMode { } } +/// Configuration for compiletest #[derive(Clone)] pub struct Config { /// `true` to to overwrite stderr/stdout files instead of complaining about changes in output. @@ -254,6 +255,8 @@ pub struct Config { pub linker: Option, pub llvm_components: String, pub llvm_cxxflags: String, + + /// Path to a NodeJS executable. Used for JS doctests, emscripten and WASM tests pub nodejs: Option, } diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 7bf56707478e3..d735d3351e666 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -333,7 +333,10 @@ pub struct TestProps { pub normalize_stdout: Vec<(String, String)>, pub normalize_stderr: Vec<(String, String)>, pub failure_status: i32, + // Whether or not `rustfix` should apply the `CodeSuggestion`s of this test and compile the + // resulting Rust code. pub run_rustfix: bool, + // If true, `rustfix` will only apply `MachineApplicable` suggestions. pub rustfix_only_machine_applicable: bool, pub assembly_output: Option, } diff --git a/src/tools/compiletest/src/json.rs b/src/tools/compiletest/src/json.rs index 12aae303f29aa..15d449260efa0 100644 --- a/src/tools/compiletest/src/json.rs +++ b/src/tools/compiletest/src/json.rs @@ -1,12 +1,12 @@ +//! These structs are a subset of the ones found in `syntax::json`. +//! They are only used for deserialization of JSON output provided by libtest. + use crate::errors::{Error, ErrorKind}; use crate::runtest::ProcRes; use serde_json; use std::path::Path; use std::str::FromStr; -// These structs are a subset of the ones found in -// `syntax::json`. - #[derive(Deserialize)] struct Diagnostic { message: String, diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 86cdadade108f..d91710dda5239 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -598,6 +598,8 @@ fn collect_tests_from_dir( Ok(()) } + +/// Returns true if `file_name` looks like a proper test file name. pub fn is_test(file_name: &OsString) -> bool { let file_name = file_name.to_str().unwrap(); @@ -1048,3 +1050,12 @@ fn test_extract_gdb_version() { 7012050: "GNU gdb (GDB) 7.12.50.20161027-git", } } + +#[test] +fn is_test_test() { + assert_eq!(true, is_test(&OsString::from("a_test.rs"))); + assert_eq!(false, is_test(&OsString::from(".a_test.rs"))); + assert_eq!(false, is_test(&OsString::from("a_cat.gif"))); + assert_eq!(false, is_test(&OsString::from("#a_dog_gif"))); + assert_eq!(false, is_test(&OsString::from("~a_temp_file"))); +}