Skip to content

Commit 5947db1

Browse files
committed
librustc_target: Unconfigure tests during normal build
1 parent 36d8f86 commit 5947db1

File tree

4 files changed

+31
-28
lines changed

4 files changed

+31
-28
lines changed

src/librustc_target/spec/abi.rs

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
use std::fmt;
22

3+
#[cfg(test)]
4+
mod tests;
5+
36
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable, Clone, Copy, Debug)]
47
pub enum Abi {
58
// N.B., this ordering MUST match the AbiDatas array below.
@@ -100,29 +103,3 @@ impl fmt::Display for Abi {
100103
write!(f, "\"{}\"", self.name())
101104
}
102105
}
103-
104-
#[allow(non_snake_case)]
105-
#[test]
106-
fn lookup_Rust() {
107-
let abi = lookup("Rust");
108-
assert!(abi.is_some() && abi.unwrap().data().name == "Rust");
109-
}
110-
111-
#[test]
112-
fn lookup_cdecl() {
113-
let abi = lookup("cdecl");
114-
assert!(abi.is_some() && abi.unwrap().data().name == "cdecl");
115-
}
116-
117-
#[test]
118-
fn lookup_baz() {
119-
let abi = lookup("baz");
120-
assert!(abi.is_none());
121-
}
122-
123-
#[test]
124-
fn indices_are_correct() {
125-
for (i, abi_data) in AbiDatas.iter().enumerate() {
126-
assert_eq!(i, abi_data.abi.index());
127-
}
128-
}

src/librustc_target/spec/abi/tests.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
use super::*;
2+
3+
#[allow(non_snake_case)]
4+
#[test]
5+
fn lookup_Rust() {
6+
let abi = lookup("Rust");
7+
assert!(abi.is_some() && abi.unwrap().data().name == "Rust");
8+
}
9+
10+
#[test]
11+
fn lookup_cdecl() {
12+
let abi = lookup("cdecl");
13+
assert!(abi.is_some() && abi.unwrap().data().name == "cdecl");
14+
}
15+
16+
#[test]
17+
fn lookup_baz() {
18+
let abi = lookup("baz");
19+
assert!(abi.is_none());
20+
}
21+
22+
#[test]
23+
fn indices_are_correct() {
24+
for (i, abi_data) in AbiDatas.iter().enumerate() {
25+
assert_eq!(i, abi_data.abi.index());
26+
}
27+
}

src/librustc_target/spec/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ macro_rules! supported_targets {
312312
$(use super::$module;)+
313313

314314
$(
315-
#[test]
315+
#[test] // `#[test]` - this is hard to put into a separate file, make an exception
316316
fn $module() {
317317
// Grab the TargetResult struct. If we successfully retrieved
318318
// a Target, then the test JSON encoding/decoding can run for this

src/tools/tidy/src/unit_tests.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ pub fn check(root_path: &Path, bad: &mut bool) {
3030
"librustc",
3131
"librustc_data_structures",
3232
"librustc_incremental/persist",
33-
"librustc_target/spec",
3433
"librustdoc",
3534
"libstd",
3635
"libsyntax",

0 commit comments

Comments
 (0)