Sfoglia il codice sorgente

Clean up our feature story and more aggressively test features.

whitequark 7 anni fa
parent
commit
62fb0fc8cd
5 ha cambiato i file con 29 aggiunte e 18 eliminazioni
  1. 14 12
      .travis.yml
  2. 10 4
      Cargo.toml
  3. 2 2
      README.md
  4. 2 0
      src/iface/ethernet.rs
  5. 1 0
      src/lib.rs

+ 14 - 12
.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' MODE='build'
+      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 std' MODE='build'
+      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 alloc' MODE='build'
+      env: FEATURES='socket-raw socket-udp socket-tcp socket-icmp' MODE='build'
 script:
    - cargo "$MODE" --no-default-features --features "$FEATURES"
 notifications:

+ 10 - 4
Cargo.toml

@@ -48,18 +48,24 @@ default = [
 
 [[example]]
 name = "tcpdump"
+required-features = ["std", "phy-raw_socket"]
 
 [[example]]
-name = "server"
+name = "httpclient"
+required-features = ["std", "phy-tap_interface", "proto-ipv4", "socket-tcp"]
 
 [[example]]
-name = "client"
+name = "ping"
+required-features = ["std", "phy-tap_interface", "proto-ipv4", "socket-icmp"]
 
 [[example]]
-name = "httpclient"
+name = "server"
+required-features = ["std", "phy-tap_interface", "proto-ipv4", "socket-tcp", "socket-udp"]
 
 [[example]]
-name = "ping"
+name = "client"
+required-features = ["std", "phy-tap_interface", "proto-ipv4", "socket-tcp", "socket-udp"]
 
 [[example]]
 name = "loopback"
+required-features = ["alloc", "proto-ipv4"]

+ 2 - 2
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`:

+ 2 - 0
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,

+ 1 - 0
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;