Skip to content

Commit ca0ef0f

Browse files
committedAug 1, 2019
librustc: Unconfigure tests during normal build
1 parent 42c5473 commit ca0ef0f

File tree

5 files changed

+33
-27
lines changed

5 files changed

+33
-27
lines changed
 

‎src/librustc/lib.rs

+3-13
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ extern crate libc;
8080
// librustc_driver and libtest.
8181
extern crate test as _;
8282

83+
#[cfg(test)]
84+
mod tests;
85+
8386
#[macro_use]
8487
mod macros;
8588

@@ -138,18 +141,5 @@ pub mod util {
138141
// Allows macros to refer to this crate as `::rustc`
139142
extern crate self as rustc;
140143

141-
// FIXME(#27438): right now the unit tests of librustc don't refer to any actual
142-
// functions generated in librustc_data_structures (all
143-
// references are through generic functions), but statics are
144-
// referenced from time to time. Due to this bug we won't
145-
// actually correctly link in the statics unless we also
146-
// reference a function, so be sure to reference a dummy
147-
// function.
148-
#[test]
149-
fn noop() {
150-
rustc_data_structures::__noop_fix_for_27438();
151-
}
152-
153-
154144
// Build the diagnostics array at the end so that the metadata includes error use sites.
155145
__build_diagnostic_array! { librustc, DIAGNOSTICS }

‎src/librustc/tests.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
use super::*;
2+
3+
// FIXME(#27438): right now the unit tests of librustc don't refer to any actual
4+
// functions generated in librustc_data_structures (all
5+
// references are through generic functions), but statics are
6+
// referenced from time to time. Due to this bug we won't
7+
// actually correctly link in the statics unless we also
8+
// reference a function, so be sure to reference a dummy
9+
// function.
10+
#[test]
11+
fn noop() {
12+
rustc_data_structures::__noop_fix_for_27438();
13+
}

‎src/librustc/util/common.rs

+3-13
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ use crate::dep_graph::{DepNode};
1818
use lazy_static;
1919
use crate::session::Session;
2020

21+
#[cfg(test)]
22+
mod tests;
23+
2124
// The name of the associated type for `Fn` return types.
2225
pub const FN_OUTPUT_NAME: Symbol = sym::Output;
2326

@@ -349,16 +352,3 @@ impl<K, V> MemoizationMap for RefCell<FxHashMap<K,V>>
349352
}
350353
}
351354
}
352-
353-
#[test]
354-
fn test_to_readable_str() {
355-
assert_eq!("0", to_readable_str(0));
356-
assert_eq!("1", to_readable_str(1));
357-
assert_eq!("99", to_readable_str(99));
358-
assert_eq!("999", to_readable_str(999));
359-
assert_eq!("1_000", to_readable_str(1_000));
360-
assert_eq!("1_001", to_readable_str(1_001));
361-
assert_eq!("999_999", to_readable_str(999_999));
362-
assert_eq!("1_000_000", to_readable_str(1_000_000));
363-
assert_eq!("1_234_567", to_readable_str(1_234_567));
364-
}

‎src/librustc/util/common/tests.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
use super::*;
2+
3+
#[test]
4+
fn test_to_readable_str() {
5+
assert_eq!("0", to_readable_str(0));
6+
assert_eq!("1", to_readable_str(1));
7+
assert_eq!("99", to_readable_str(99));
8+
assert_eq!("999", to_readable_str(999));
9+
assert_eq!("1_000", to_readable_str(1_000));
10+
assert_eq!("1_001", to_readable_str(1_001));
11+
assert_eq!("999_999", to_readable_str(999_999));
12+
assert_eq!("1_000_000", to_readable_str(1_000_000));
13+
assert_eq!("1_234_567", to_readable_str(1_234_567));
14+
}

‎src/tools/tidy/src/unit_tests.rs

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ pub fn check(root_path: &Path, bad: &mut bool) {
2727
};
2828
let fixme = [
2929
"liballoc",
30-
"librustc",
3130
"librustc_data_structures",
3231
"librustdoc",
3332
"libstd",

0 commit comments

Comments
 (0)
Please sign in to comment.