Clean up our feature story and more aggressively test features.

This commit is contained in:
whitequark 2017-12-22 08:54:58 +00:00
parent 3029341d5a
commit 8b6050f711
5 changed files with 32 additions and 21 deletions

View File

@ -1,35 +1,37 @@
language: rust language: rust
matrix: matrix:
include: include:
# litmus check that we work on stable/beta ### Litmus check that we work on stable/beta
# we don't, not until slice_rotate lands # (we don't, not until slice_rotate lands)
# - rust: stable # - rust: stable
# env: FEATURES='default' MODE='test' # env: FEATURES='default' MODE='test'
# - rust: beta # - rust: beta
# env: FEATURES='default' MODE='test' # env: FEATURES='default' MODE='test'
# actually test everything ### Test default configurations
- rust: nightly - rust: nightly
env: FEATURES='default' MODE='test' env: FEATURES='default' MODE='test'
- rust: nightly - rust: nightly
env: FEATURES='default proto-ipv6' MODE='test' env: FEATURES='default proto-ipv6' MODE='test'
### Test select feature permutations, chosen to be as orthogonal as possible
- rust: nightly - rust: nightly
env: FEATURES='phy-raw_socket socket-udp' MODE='build' env: FEATURES='std phy-raw_socket socket-udp' MODE='test'
- rust: nightly - rust: nightly
env: FEATURES='phy-tap_interface socket-udp' MODE='build' env: FEATURES='std phy-tap_interface socket-udp' MODE='test'
- rust: nightly - rust: nightly
env: FEATURES='socket-raw' MODE='build' env: FEATURES='std socket-raw' MODE='test'
- rust: nightly - rust: nightly
env: FEATURES='socket-udp' MODE='build' env: FEATURES='std socket-udp' MODE='test'
- rust: nightly - rust: nightly
env: FEATURES='socket-tcp' MODE='build' env: FEATURES='std socket-tcp' MODE='test'
- rust: nightly - 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 - rust: nightly
env: FEATURES='socket-raw socket-udp socket-tcp socket-icmp' MODE='build' 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: script:
- cargo "$MODE" --no-default-features --features "$FEATURES" - cargo "$MODE" --no-default-features --features "$FEATURES"
notifications: notifications:

View File

@ -48,18 +48,24 @@ default = [
[[example]] [[example]]
name = "tcpdump" name = "tcpdump"
required-features = ["std", "phy-raw_socket"]
[[example]]
name = "server"
[[example]]
name = "client"
[[example]] [[example]]
name = "httpclient" name = "httpclient"
required-features = ["std", "phy-tap_interface", "proto-ipv4", "socket-tcp"]
[[example]] [[example]]
name = "ping" 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]] [[example]]
name = "loopback" name = "loopback"
required-features = ["alloc", "proto-ipv4"]

View File

@ -303,12 +303,12 @@ that do. Because of this, only one such example is provided.
### examples/loopback.rs ### examples/loopback.rs
_examples/loopback.rs_ sets up _smoltcp_ to talk with itself via a loopback interface. _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`: Read its [source code](/examples/loopback.rs), then run it without `std`:
```sh ```sh
cargo run --example loopback --no-default-features --features collections cargo run --example loopback --no-default-features --features alloc
``` ```
... or with `std`: ... or with `std`:

View File

@ -912,6 +912,7 @@ mod test {
use wire::{IpAddress, IpCidr, IpProtocol, IpRepr}; use wire::{IpAddress, IpCidr, IpProtocol, IpRepr};
use wire::{Ipv4Address, Ipv4Repr}; use wire::{Ipv4Address, Ipv4Repr};
use wire::{Icmpv4Repr, Icmpv4DstUnreachable}; use wire::{Icmpv4Repr, Icmpv4DstUnreachable};
#[cfg(feature = "socket-udp")]
use wire::{UdpPacket, UdpRepr}; use wire::{UdpPacket, UdpRepr};
use super::Packet; use super::Packet;
@ -1039,6 +1040,7 @@ mod test {
} }
#[test] #[test]
#[cfg(feature = "socket-udp")]
fn test_icmp_error_port_unreachable() { fn test_icmp_error_port_unreachable() {
static UDP_PAYLOAD: [u8; 12] = [ static UDP_PAYLOAD: [u8; 12] = [
0x48, 0x65, 0x6c, 0x6c, 0x48, 0x65, 0x6c, 0x6c,

View File

@ -84,6 +84,7 @@ extern crate libc;
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
extern crate alloc; extern crate alloc;
#[cfg(any(test, feature = "log"))] #[cfg(any(test, feature = "log"))]
#[allow(unused_imports)]
#[macro_use(log, trace, debug)] #[macro_use(log, trace, debug)]
extern crate log; extern crate log;