librustc_target: Unconfigure tests during normal build

This commit is contained in:
Vadim Petrochenkov 2019-08-01 03:20:03 +03:00
parent 36d8f86924
commit 5947db1c53
4 changed files with 31 additions and 28 deletions

View file

@ -1,5 +1,8 @@
use std::fmt;
#[cfg(test)]
mod tests;
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable, Clone, Copy, Debug)]
pub enum Abi {
// N.B., this ordering MUST match the AbiDatas array below.
@ -100,29 +103,3 @@ impl fmt::Display for Abi {
write!(f, "\"{}\"", self.name())
}
}
#[allow(non_snake_case)]
#[test]
fn lookup_Rust() {
let abi = lookup("Rust");
assert!(abi.is_some() && abi.unwrap().data().name == "Rust");
}
#[test]
fn lookup_cdecl() {
let abi = lookup("cdecl");
assert!(abi.is_some() && abi.unwrap().data().name == "cdecl");
}
#[test]
fn lookup_baz() {
let abi = lookup("baz");
assert!(abi.is_none());
}
#[test]
fn indices_are_correct() {
for (i, abi_data) in AbiDatas.iter().enumerate() {
assert_eq!(i, abi_data.abi.index());
}
}

View file

@ -0,0 +1,27 @@
use super::*;
#[allow(non_snake_case)]
#[test]
fn lookup_Rust() {
let abi = lookup("Rust");
assert!(abi.is_some() && abi.unwrap().data().name == "Rust");
}
#[test]
fn lookup_cdecl() {
let abi = lookup("cdecl");
assert!(abi.is_some() && abi.unwrap().data().name == "cdecl");
}
#[test]
fn lookup_baz() {
let abi = lookup("baz");
assert!(abi.is_none());
}
#[test]
fn indices_are_correct() {
for (i, abi_data) in AbiDatas.iter().enumerate() {
assert_eq!(i, abi_data.abi.index());
}
}

View file

@ -312,7 +312,7 @@ macro_rules! supported_targets {
$(use super::$module;)+
$(
#[test]
#[test] // `#[test]` - this is hard to put into a separate file, make an exception
fn $module() {
// Grab the TargetResult struct. If we successfully retrieved
// a Target, then the test JSON encoding/decoding can run for this

View file

@ -30,7 +30,6 @@ pub fn check(root_path: &Path, bad: &mut bool) {
"librustc",
"librustc_data_structures",
"librustc_incremental/persist",
"librustc_target/spec",
"librustdoc",
"libstd",
"libsyntax",