diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-08-01 03:35:26 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-08-02 01:59:01 +0300 |
| commit | ca0ef0fcf66b0fe913c19a3a00729af4494866e6 (patch) | |
| tree | b736faca89df52ae7e3f93114a79b6ae24ea7112 | |
| parent | 42c5473d005c39e2d0262ba38e4ea6e1e0469455 (diff) | |
| download | rust-ca0ef0fcf66b0fe913c19a3a00729af4494866e6.tar.gz rust-ca0ef0fcf66b0fe913c19a3a00729af4494866e6.zip | |
librustc: Unconfigure tests during normal build
| -rw-r--r-- | src/librustc/lib.rs | 16 | ||||
| -rw-r--r-- | src/librustc/tests.rs | 13 | ||||
| -rw-r--r-- | src/librustc/util/common.rs | 16 | ||||
| -rw-r--r-- | src/librustc/util/common/tests.rs | 14 | ||||
| -rw-r--r-- | src/tools/tidy/src/unit_tests.rs | 1 |
5 files changed, 33 insertions, 27 deletions
diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 4b3fefcd4de..8e0581b41ef 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -80,6 +80,9 @@ extern crate libc; // librustc_driver and libtest. extern crate test as _; +#[cfg(test)] +mod tests; + #[macro_use] mod macros; @@ -138,18 +141,5 @@ pub mod util { // Allows macros to refer to this crate as `::rustc` extern crate self as rustc; -// FIXME(#27438): right now the unit tests of librustc don't refer to any actual -// functions generated in librustc_data_structures (all -// references are through generic functions), but statics are -// referenced from time to time. Due to this bug we won't -// actually correctly link in the statics unless we also -// reference a function, so be sure to reference a dummy -// function. -#[test] -fn noop() { - rustc_data_structures::__noop_fix_for_27438(); -} - - // Build the diagnostics array at the end so that the metadata includes error use sites. __build_diagnostic_array! { librustc, DIAGNOSTICS } diff --git a/src/librustc/tests.rs b/src/librustc/tests.rs new file mode 100644 index 00000000000..cf3ea2ffa93 --- /dev/null +++ b/src/librustc/tests.rs @@ -0,0 +1,13 @@ +use super::*; + +// FIXME(#27438): right now the unit tests of librustc don't refer to any actual +// functions generated in librustc_data_structures (all +// references are through generic functions), but statics are +// referenced from time to time. Due to this bug we won't +// actually correctly link in the statics unless we also +// reference a function, so be sure to reference a dummy +// function. +#[test] +fn noop() { + rustc_data_structures::__noop_fix_for_27438(); +} diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs index 8e7936dae09..7118d05204c 100644 --- a/src/librustc/util/common.rs +++ b/src/librustc/util/common.rs @@ -18,6 +18,9 @@ use crate::dep_graph::{DepNode}; use lazy_static; use crate::session::Session; +#[cfg(test)] +mod tests; + // The name of the associated type for `Fn` return types. pub const FN_OUTPUT_NAME: Symbol = sym::Output; @@ -349,16 +352,3 @@ impl<K, V> MemoizationMap for RefCell<FxHashMap<K,V>> } } } - -#[test] -fn test_to_readable_str() { - assert_eq!("0", to_readable_str(0)); - assert_eq!("1", to_readable_str(1)); - assert_eq!("99", to_readable_str(99)); - assert_eq!("999", to_readable_str(999)); - assert_eq!("1_000", to_readable_str(1_000)); - assert_eq!("1_001", to_readable_str(1_001)); - assert_eq!("999_999", to_readable_str(999_999)); - assert_eq!("1_000_000", to_readable_str(1_000_000)); - assert_eq!("1_234_567", to_readable_str(1_234_567)); -} diff --git a/src/librustc/util/common/tests.rs b/src/librustc/util/common/tests.rs new file mode 100644 index 00000000000..9a9fb203c62 --- /dev/null +++ b/src/librustc/util/common/tests.rs @@ -0,0 +1,14 @@ +use super::*; + +#[test] +fn test_to_readable_str() { + assert_eq!("0", to_readable_str(0)); + assert_eq!("1", to_readable_str(1)); + assert_eq!("99", to_readable_str(99)); + assert_eq!("999", to_readable_str(999)); + assert_eq!("1_000", to_readable_str(1_000)); + assert_eq!("1_001", to_readable_str(1_001)); + assert_eq!("999_999", to_readable_str(999_999)); + assert_eq!("1_000_000", to_readable_str(1_000_000)); + assert_eq!("1_234_567", to_readable_str(1_234_567)); +} diff --git a/src/tools/tidy/src/unit_tests.rs b/src/tools/tidy/src/unit_tests.rs index 79ccc11a69a..d7d47721170 100644 --- a/src/tools/tidy/src/unit_tests.rs +++ b/src/tools/tidy/src/unit_tests.rs @@ -27,7 +27,6 @@ pub fn check(root_path: &Path, bad: &mut bool) { }; let fixme = [ "liballoc", - "librustc", "librustc_data_structures", "librustdoc", "libstd", |
