Skip to content

Commit 62fb0fc

Browse files
committed
Clean up our feature story and more aggressively test features.
1 parent d1e2292 commit 62fb0fc

File tree

5 files changed

+29
-18
lines changed

5 files changed

+29
-18
lines changed

.travis.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
11
language: rust
22
matrix:
33
include:
4-
# litmus check that we work on stable/beta
5-
# we don't, not until slice_rotate lands
4+
### Litmus check that we work on stable/beta
5+
# (we don't, not until slice_rotate lands)
66
# - rust: stable
77
# env: FEATURES='default' MODE='test'
88
# - rust: beta
99
# env: FEATURES='default' MODE='test'
10-
# actually test everything
10+
### Test default configurations
1111
- rust: nightly
1212
env: FEATURES='default' MODE='test'
1313
- rust: nightly
1414
env: FEATURES='default proto-ipv6' MODE='test'
15+
### Test select feature permutations, chosen to be as orthogonal as possible
1516
- rust: nightly
16-
env: FEATURES='phy-raw_socket socket-udp' MODE='build'
17+
env: FEATURES='std phy-raw_socket socket-udp' MODE='test'
1718
- rust: nightly
18-
env: FEATURES='phy-tap_interface socket-udp' MODE='build'
19+
env: FEATURES='std phy-tap_interface socket-udp' MODE='test'
1920
- rust: nightly
20-
env: FEATURES='socket-raw' MODE='build'
21+
env: FEATURES='std socket-raw' MODE='test'
2122
- rust: nightly
22-
env: FEATURES='socket-udp' MODE='build'
23+
env: FEATURES='std socket-udp' MODE='test'
2324
- rust: nightly
24-
env: FEATURES='socket-tcp' MODE='build'
25+
env: FEATURES='std socket-tcp' MODE='test'
2526
- rust: nightly
26-
env: FEATURES='socket-icmp' MODE='build'
27+
env: FEATURES='std socket-icmp' MODE='test'
28+
### Test select feature permutations, chosen to be as aggressive as possible
2729
- rust: nightly
28-
env: FEATURES='socket-raw socket-udp socket-tcp socket-icmp' MODE='build'
30+
env: FEATURES='socket-raw socket-udp socket-tcp socket-icmp std' MODE='test'
2931
- rust: nightly
30-
env: FEATURES='socket-raw socket-udp socket-tcp socket-icmp std' MODE='build'
32+
env: FEATURES='socket-raw socket-udp socket-tcp socket-icmp alloc' MODE='test'
3133
- rust: nightly
32-
env: FEATURES='socket-raw socket-udp socket-tcp socket-icmp alloc' MODE='build'
34+
env: FEATURES='socket-raw socket-udp socket-tcp socket-icmp' MODE='build'
3335
script:
3436
- cargo "$MODE" --no-default-features --features "$FEATURES"
3537
notifications:

Cargo.toml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,24 @@ default = [
4848

4949
[[example]]
5050
name = "tcpdump"
51+
required-features = ["std", "phy-raw_socket"]
5152

5253
[[example]]
53-
name = "server"
54+
name = "httpclient"
55+
required-features = ["std", "phy-tap_interface", "proto-ipv4", "socket-tcp"]
5456

5557
[[example]]
56-
name = "client"
58+
name = "ping"
59+
required-features = ["std", "phy-tap_interface", "proto-ipv4", "socket-icmp"]
5760

5861
[[example]]
59-
name = "httpclient"
62+
name = "server"
63+
required-features = ["std", "phy-tap_interface", "proto-ipv4", "socket-tcp", "socket-udp"]
6064

6165
[[example]]
62-
name = "ping"
66+
name = "client"
67+
required-features = ["std", "phy-tap_interface", "proto-ipv4", "socket-tcp", "socket-udp"]
6368

6469
[[example]]
6570
name = "loopback"
71+
required-features = ["alloc", "proto-ipv4"]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,12 @@ that do. Because of this, only one such example is provided.
303303
### examples/loopback.rs
304304

305305
_examples/loopback.rs_ sets up _smoltcp_ to talk with itself via a loopback interface.
306-
Although it does not require `std`, this example still requires the `collections` feature to run.
306+
Although it does not require `std`, this example still requires the `alloc` feature to run.
307307

308308
Read its [source code](/examples/loopback.rs), then run it without `std`:
309309

310310
```sh
311-
cargo run --example loopback --no-default-features --features collections
311+
cargo run --example loopback --no-default-features --features alloc
312312
```
313313

314314
... or with `std`:

src/iface/ethernet.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,7 @@ mod test {
912912
use wire::{IpAddress, IpCidr, IpProtocol, IpRepr};
913913
use wire::{Ipv4Address, Ipv4Repr};
914914
use wire::{Icmpv4Repr, Icmpv4DstUnreachable};
915+
#[cfg(feature = "socket-udp")]
915916
use wire::{UdpPacket, UdpRepr};
916917

917918
use super::Packet;
@@ -1039,6 +1040,7 @@ mod test {
10391040
}
10401041

10411042
#[test]
1043+
#[cfg(feature = "socket-udp")]
10421044
fn test_icmp_error_port_unreachable() {
10431045
static UDP_PAYLOAD: [u8; 12] = [
10441046
0x48, 0x65, 0x6c, 0x6c,

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ extern crate libc;
8484
#[cfg(feature = "alloc")]
8585
extern crate alloc;
8686
#[cfg(any(test, feature = "log"))]
87+
#[allow(unused_imports)]
8788
#[macro_use(log, trace, debug)]
8889
extern crate log;
8990

0 commit comments

Comments
 (0)