diff --git a/Cargo.toml b/Cargo.toml index 2aefba8..59f6b40 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,8 +5,8 @@ name = "compiler_builtins" version = "0.1.0" [build-dependencies] -cast = "0.2.0" -rand = "0.3.15" +cast = { version = "0.2.0", optional = true } +rand = { version = "0.3.15", optional = true } [build-dependencies.gcc] optional = true @@ -18,21 +18,14 @@ compiler-builtins = [] default = ["compiler-builtins"] mem = [] rustbuild = ["compiler-builtins"] +# generate tests +gen-tests = ["cast", "rand"] -[target] +[target.'cfg(all(target_arch = "arm", not(any(target_env = "gnu", target_env = "musl")), target_os = "linux"))'.dev-dependencies] +test = { git = "https://github.com/japaric/utest" } +utest-cortex-m-qemu = { default-features = false, git = "https://github.com/japaric/utest" } +utest-macros = { git = "https://github.com/japaric/utest" } -[target."cfg(all(target_arch = \"arm\", not(any(target_env = \"gnu\", target_env = \"musl\")), target_os = \"linux\"))"] -[target."cfg(all(target_arch = \"arm\", not(any(target_env = \"gnu\", target_env = \"musl\")), target_os = \"linux\"))".dev-dependencies] - -[target."cfg(all(target_arch = \"arm\", not(any(target_env = \"gnu\", target_env = \"musl\")), target_os = \"linux\"))".dev-dependencies.test] -git = "https://github.com/japaric/utest" - -[target."cfg(all(target_arch = \"arm\", not(any(target_env = \"gnu\", target_env = \"musl\")), target_os = \"linux\"))".dev-dependencies.utest-cortex-m-qemu] -default-features = false -git = "https://github.com/japaric/utest" - -[target."cfg(all(target_arch = \"arm\", not(any(target_env = \"gnu\", target_env = \"musl\")), target_os = \"linux\"))".dev-dependencies.utest-macros] -git = "https://github.com/japaric/utest" [workspace] diff --git a/build.rs b/build.rs index 2c8cff7..ac75e6e 100644 --- a/build.rs +++ b/build.rs @@ -18,6 +18,7 @@ fn main() { let llvm_target = target.split('-').collect::>(); // Build test files + #[cfg(feature = "gen-tests")] tests::generate(); // Build missing intrinsics from compiler-rt C source code @@ -36,6 +37,7 @@ fn main() { } } +#[cfg(feature = "gen-tests")] mod tests { extern crate cast; extern crate rand; diff --git a/ci/run.sh b/ci/run.sh index 17c54ef..771f881 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -25,16 +25,16 @@ case $1 in ;; esac - xargo test --test $t --target $1 --features mem --no-run + xargo test --test $t --target $1 --features 'mem gen-tests' --no-run qemu-arm-static target/${1}/debug/$t-* - xargo test --test $t --target $1 --features mem --no-run --release + xargo test --test $t --target $1 --features 'mem gen-tests' --no-run --release qemu-arm-static target/${1}/release/$t-* done ;; *) - cargo test --no-default-features --target $1 - cargo test --no-default-features --target $1 --release + cargo test --no-default-features --features gen-tests --target $1 + cargo test --no-default-features --features gen-tests --target $1 --release ;; esac