diff --git a/.travis.yml b/.travis.yml index fb3568b..1e89c1e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,35 +1,37 @@ language: rust matrix: include: - # litmus check that we work on stable/beta - # we don't, not until slice_rotate lands + ### Litmus check that we work on stable/beta + # (we don't, not until slice_rotate lands) # - rust: stable # env: FEATURES='default' MODE='test' # - rust: beta # env: FEATURES='default' MODE='test' - # actually test everything + ### Test default configurations - rust: nightly env: FEATURES='default' MODE='test' - rust: nightly env: FEATURES='default proto-ipv6' MODE='test' + ### Test select feature permutations, chosen to be as orthogonal as possible - rust: nightly - env: FEATURES='phy-raw_socket socket-udp' MODE='build' + env: FEATURES='std phy-raw_socket socket-udp' MODE='test' - rust: nightly - env: FEATURES='phy-tap_interface socket-udp' MODE='build' + env: FEATURES='std phy-tap_interface socket-udp' MODE='test' - rust: nightly - env: FEATURES='socket-raw' MODE='build' + env: FEATURES='std socket-raw' MODE='test' - rust: nightly - env: FEATURES='socket-udp' MODE='build' + env: FEATURES='std socket-udp' MODE='test' - rust: nightly - env: FEATURES='socket-tcp' MODE='build' + env: FEATURES='std socket-tcp' MODE='test' - rust: nightly - env: FEATURES='socket-icmp' MODE='build' + env: FEATURES='std socket-icmp' MODE='test' + ### Test select feature permutations, chosen to be as aggressive as possible + - rust: nightly + env: FEATURES='socket-raw socket-udp socket-tcp socket-icmp std' MODE='test' + - rust: nightly + env: FEATURES='socket-raw socket-udp socket-tcp socket-icmp alloc' MODE='test' - rust: nightly env: FEATURES='socket-raw socket-udp socket-tcp socket-icmp' MODE='build' - - rust: nightly - env: FEATURES='socket-raw socket-udp socket-tcp socket-icmp std' MODE='build' - - rust: nightly - env: FEATURES='socket-raw socket-udp socket-tcp socket-icmp alloc' MODE='build' script: - cargo "$MODE" --no-default-features --features "$FEATURES" notifications: diff --git a/Cargo.toml b/Cargo.toml index 8bb7309..9eb8734 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,18 +48,24 @@ default = [ [[example]] name = "tcpdump" - -[[example]] -name = "server" - -[[example]] -name = "client" +required-features = ["std", "phy-raw_socket"] [[example]] name = "httpclient" +required-features = ["std", "phy-tap_interface", "proto-ipv4", "socket-tcp"] [[example]] name = "ping" +required-features = ["std", "phy-tap_interface", "proto-ipv4", "socket-icmp"] + +[[example]] +name = "server" +required-features = ["std", "phy-tap_interface", "proto-ipv4", "socket-tcp", "socket-udp"] + +[[example]] +name = "client" +required-features = ["std", "phy-tap_interface", "proto-ipv4", "socket-tcp", "socket-udp"] [[example]] name = "loopback" +required-features = ["alloc", "proto-ipv4"] diff --git a/README.md b/README.md index 65591ca..1b16f89 100644 --- a/README.md +++ b/README.md @@ -303,12 +303,12 @@ that do. Because of this, only one such example is provided. ### examples/loopback.rs _examples/loopback.rs_ sets up _smoltcp_ to talk with itself via a loopback interface. -Although it does not require `std`, this example still requires the `collections` feature to run. +Although it does not require `std`, this example still requires the `alloc` feature to run. Read its [source code](/examples/loopback.rs), then run it without `std`: ```sh -cargo run --example loopback --no-default-features --features collections +cargo run --example loopback --no-default-features --features alloc ``` ... or with `std`: diff --git a/src/iface/ethernet.rs b/src/iface/ethernet.rs index e9b67d2..0290dc4 100644 --- a/src/iface/ethernet.rs +++ b/src/iface/ethernet.rs @@ -912,6 +912,7 @@ mod test { use wire::{IpAddress, IpCidr, IpProtocol, IpRepr}; use wire::{Ipv4Address, Ipv4Repr}; use wire::{Icmpv4Repr, Icmpv4DstUnreachable}; + #[cfg(feature = "socket-udp")] use wire::{UdpPacket, UdpRepr}; use super::Packet; @@ -1039,6 +1040,7 @@ mod test { } #[test] + #[cfg(feature = "socket-udp")] fn test_icmp_error_port_unreachable() { static UDP_PAYLOAD: [u8; 12] = [ 0x48, 0x65, 0x6c, 0x6c, diff --git a/src/lib.rs b/src/lib.rs index 62773d8..8227604 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -84,6 +84,7 @@ extern crate libc; #[cfg(feature = "alloc")] extern crate alloc; #[cfg(any(test, feature = "log"))] +#[allow(unused_imports)] #[macro_use(log, trace, debug)] extern crate log;