Skip to content
This repository has been archived by the owner on Dec 9, 2018. It is now read-only.

Commit

Permalink
gate on running steed's test suite
Browse files Browse the repository at this point in the history
some unit test currently don't compile. See #115
  • Loading branch information
Jorge Aparicio committed Feb 25, 2017
1 parent c5c424e commit d2ace31
Show file tree
Hide file tree
Showing 19 changed files with 64 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ optional = true
path = "naive_ralloc"

[dependencies.compiler_builtins]
default-features = false
features = ["mem"]
git = "https://github.com/rust-lang-nursery/compiler-builtins"

[features]
default = ["ralloc"]
default = ["compiler-builtins", "ralloc"]
compiler-builtins = ["compiler_builtins/compiler-builtins"]

[profile.release]
lto = true
30 changes: 28 additions & 2 deletions ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,39 @@ main() {
)

for example in ${examples[@]}; do
cross run --target $TARGET --no-default-features --features naive_ralloc --example $example
cross run \
--target $TARGET \
--no-default-features \
--features "compiler-builtins naive_ralloc" \
--example $example
done

for example in ${examples[@]}; do
cross run --target $TARGET --no-default-features --features naive_ralloc --example $example --release
cross run \
--target $TARGET \
--no-default-features \
--features "compiler-builtins naive_ralloc" \
--example $example --release
done

cat >>Xargo.toml <<'EOF'
[dependencies.std]
default-features = false
features = ["compiler-builtins", "naive_ralloc"]
path = "/project"
stage = 1
[dependencies.test]
path = "/project/test"
stage = 2
EOF

cross test \
--target $TARGET \
--no-default-features \
--features "naive_ralloc"

set +x
pushd target/$TARGET/release/examples
size ${examples[@]}
Expand Down
1 change: 1 addition & 0 deletions src/collections/hash/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2232,6 +2232,7 @@ fn assert_covariance() {
}

#[cfg(test)]
#[cfg(issue = "115")]
mod test_map {
use super::HashMap;
use super::Entry::{Occupied, Vacant};
Expand Down
1 change: 1 addition & 0 deletions src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1723,6 +1723,7 @@ impl AsInnerMut<fs_imp::DirBuilder> for DirBuilder {
}

#[cfg(all(test, not(target_os = "emscripten")))]
#[cfg(issue = "115")]
mod tests {
use io::prelude::*;

Expand Down
1 change: 1 addition & 0 deletions src/io/buffered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,7 @@ impl<W: Write> fmt::Debug for LineWriter<W> where W: fmt::Debug {
}

#[cfg(test)]
#[cfg(issue = "115")]
mod tests {
use io::prelude::*;
use io::{self, BufReader, BufWriter, LineWriter, SeekFrom};
Expand Down
11 changes: 9 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,18 @@ extern crate alloc;
#[macro_reexport(vec, format)]
extern crate collections as core_collections;
extern crate compiler_builtins;
#[cfg(not(test))]
#[cfg(feature = "ralloc")]
extern crate ralloc;
#[cfg(not(test))]
#[cfg(feature = "naive_ralloc")]
extern crate naive_ralloc;
#[macro_use]
extern crate sc;
extern crate std_unicode;
extern crate rand as core_rand;
#[cfg(test)]
extern crate test;

// Rust 1.15.0
// The Rust prelude
Expand Down Expand Up @@ -177,6 +181,7 @@ pub mod rt;

mod ctypes;
mod linux;
#[cfg(not(test))]
mod panicking;
mod rand;
mod sys;
Expand All @@ -185,16 +190,18 @@ mod libc;

// NOTE These two are "undefined" symbols that LLVM emits but that, AFAIK, we
// never use
#[unstable(feature = "steed", issue = "0")]
#[cfg(not(test))]
#[doc(hidden)]
#[no_mangle]
#[unstable(feature = "steed", issue = "0")]
pub unsafe extern "C" fn __aeabi_unwind_cpp_pr0() {
intrinsics::unreachable()
}

#[unstable(feature = "steed", issue = "0")]
#[cfg(not(test))]
#[doc(hidden)]
#[no_mangle]
#[unstable(feature = "steed", issue = "0")]
pub unsafe extern "C" fn __aeabi_unwind_cpp_pr1() {
intrinsics::unreachable()
}
1 change: 1 addition & 0 deletions src/net/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,7 @@ impl<'a, T: ToSocketAddrs + ?Sized> ToSocketAddrs for &'a T {
}

#[cfg(all(test, not(target_os = "emscripten")))]
#[cfg(issue = "115")]
mod tests {
use net::*;
use net::test::{tsa, sa6, sa4};
Expand Down
1 change: 1 addition & 0 deletions src/net/ip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,7 @@ impl From<[u8; 16]> for Ipv6Addr {

// Tests for this module
#[cfg(all(test, not(target_os = "emscripten")))]
#[cfg(issue = "115")]
mod tests {
use net::*;
use net::Ipv6MulticastScope::*;
Expand Down
1 change: 1 addition & 0 deletions src/net/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ mod tcp;
mod udp;
mod parser;
#[cfg(test)]
#[cfg(issue = "115")]
mod test;

/// Possible values which can be passed to the [`shutdown`] method of
Expand Down
1 change: 1 addition & 0 deletions src/net/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,7 @@ impl fmt::Debug for TcpListener {
}

#[cfg(all(test, not(target_os = "emscripten")))]
#[cfg(isssue = "115")]
mod tests {
use io::ErrorKind;
use io::prelude::*;
Expand Down
1 change: 1 addition & 0 deletions src/net/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@ impl fmt::Debug for UdpSocket {
}

#[cfg(all(test, not(target_os = "emscripten")))]
#[cfg(issue = "115")]
mod tests {
use io::ErrorKind;
use net::*;
Expand Down
1 change: 1 addition & 0 deletions src/os/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pub enum c_void {
}

#[cfg(test)]
#[cfg(issue = "115")]
#[allow(unused_imports)]
mod tests {
use any::TypeId;
Expand Down
1 change: 1 addition & 0 deletions src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,7 @@ pub fn abort() -> ! {
}

#[cfg(all(test, not(target_os = "emscripten")))]
#[cfg(issue = "115")]
mod tests {
use io::prelude::*;

Expand Down
1 change: 1 addition & 0 deletions src/rand/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ impl Rng for OsRng {


#[cfg(test)]
#[cfg(issue = "115")]
mod tests {
use sync::mpsc::channel;
use rand::Rng;
Expand Down
9 changes: 9 additions & 0 deletions src/rt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ impl Stack {
// Most Rust operations, like using a local/stack variable, will modify the
// register where `$BSP` resides so we have to use assembly to avoid that.

#[cfg(not(test))]
#[cfg(target_arch = "x86_64")]
#[export_name = "_start"]
#[naked]
Expand All @@ -88,6 +89,7 @@ pub extern "C" fn entry() -> ! {
}
}

#[cfg(not(test))]
#[cfg(target_arch = "x86")]
#[export_name = "_start"]
#[naked]
Expand All @@ -107,6 +109,7 @@ pub extern "C" fn entry() -> ! {
}
}

#[cfg(not(test))]
#[cfg(target_arch = "arm")]
#[export_name = "_start"]
#[naked]
Expand All @@ -122,6 +125,7 @@ pub extern "C" fn entry() -> ! {
}
}

#[cfg(not(test))]
#[cfg(target_arch = "aarch64")]
#[export_name = "_start"]
#[naked]
Expand All @@ -137,6 +141,7 @@ pub extern "C" fn entry() -> ! {
}
}

#[cfg(not(test))]
#[cfg(target_arch = "mips")]
#[export_name = "__start"]
#[naked]
Expand All @@ -153,6 +158,7 @@ pub extern "C" fn entry() -> ! {
}

// FIXME
#[cfg(not(test))]
#[cfg(target_arch = "mips64")]
#[export_name = "__start"]
#[naked]
Expand All @@ -168,6 +174,7 @@ pub extern "C" fn entry() -> ! {
}
}

#[cfg(not(test))]
#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))]
#[export_name = "_start"]
#[naked]
Expand All @@ -191,6 +198,7 @@ pub extern "C" fn entry() -> ! {
// guess, is related to the `fn main() { .. }` function one writes in their
// crates. But the relationship is not that simple due to the presence of the
// `start` lang item. The next section explains how that lang item works.
#[cfg(not(test))]
#[inline(never)]
#[export_name = "_start_rust"]
pub extern "C" fn start(sp: &'static Stack) -> ! {
Expand All @@ -216,6 +224,7 @@ pub extern "C" fn start(sp: &'static Stack) -> ! {
//
// Where `start` is *this* `start` lang item and `user_main` is the (mangled)
// `main` function within the executable source code.
#[cfg(not(test))]
#[lang = "start"]
extern "C" fn lang_start(main: *const u8,
_argc: isize,
Expand Down
1 change: 1 addition & 0 deletions src/sys/linux/ext/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,7 @@ impl IntoRawFd for UnixDatagram {
}

#[cfg(all(test, not(target_os = "emscripten")))]
#[cfg(issue = "115")]
mod test {
use thread;
use io;
Expand Down
1 change: 1 addition & 0 deletions src/sys/linux/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,7 @@ impl Process {
}

#[cfg(all(test, not(target_os = "emscripten")))]
#[cfg(issue = "115")]
mod tests {
use super::*;

Expand Down
1 change: 1 addition & 0 deletions src/sys_common/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ pub unsafe fn read_to_end_uninitialized(r: &mut Read, buf: &mut Vec<u8>) -> io::
}

#[cfg(test)]
#[cfg(issue = "115")]
#[allow(dead_code)] // not used on emscripten
pub mod test {
use path::{Path, PathBuf};
Expand Down
1 change: 1 addition & 0 deletions src/sys_common/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,7 @@ impl fmt::Debug for UdpSocket {
}

#[cfg(test)]
#[cfg(issue = "115")]
mod tests {
use super::*;
use collections::HashMap;
Expand Down

0 comments on commit d2ace31

Please sign in to comment.