Migrate examples into a subcrate

Fuchsia doesn't support yet mio, and there is unfortunately no
way to run the rustls on Fuchsia as the crate is currently setup.
Unfortunately there is no way to make dev-dependencies optional (see
https://github.com/rust-lang/cargo/issues/1596), so this patch
migrates the examples into a subcrate so we can compile the
rustls tests without mio.
This commit is contained in:
Erick Tryzelaar 2019-03-07 20:29:17 -08:00 committed by Joseph Birr-Pixton
parent 919e4284e3
commit b3a06b9a38
12 changed files with 67 additions and 38 deletions

View File

@ -30,5 +30,6 @@ script:
- ( cd bogo && ./runme )
- cargo build --no-default-features
- cargo test --no-default-features --no-run
- ( cd examples && cargo build --examples --all-features )
- if [[ "$COVERAGE" == "1" ]]; then ./admin/coverage ; fi
- if [[ "$COVERAGE" == "1" ]]; then coveralls-lcov final.info ; fi

View File

@ -25,44 +25,7 @@ dangerous_configuration = []
quic = []
[dev-dependencies]
ct-logs = "0.5"
docopt = "1.0"
env_logger = "0.6.1"
log = "0.4"
mio = "0.6"
regex = "1.0"
serde = "1.0"
serde_derive = "1.0"
tempfile = "3.0"
vecio = "0.1"
webpki-roots = "0.16"
[[example]]
name = "bogo_shim"
path = "examples/internal/bogo_shim.rs"
required-features = ["dangerous_configuration", "quic"]
[[example]]
name = "trytls_shim"
path = "examples/internal/trytls_shim.rs"
[[example]]
name = "bench"
path = "examples/internal/bench.rs"
[[example]]
name = "tlsclient"
path = "examples/tlsclient.rs"
[[example]]
name = "tlsserver"
path = "examples/tlsserver.rs"
[[example]]
name = "simpleclient"
path = "examples/simpleclient.rs"
[[example]]
name = "simple_0rtt_client"
path = "examples/simple_0rtt_client.rs"
required-features = ["logging"]

64
examples/Cargo.toml Normal file
View File

@ -0,0 +1,64 @@
[package]
name = "rustls-examples"
version = "0.15.1"
edition = "2018"
authors = ["Joseph Birr-Pixton <jpixton@gmail.com>"]
license = "Apache-2.0/ISC/MIT"
readme = "README.md"
description = "Rustls is a modern TLS library written in Rust."
homepage = "https://github.com/ctz/rustls"
repository = "https://github.com/ctz/rustls"
categories = ["network-programming", "cryptography"]
[features]
default = ["logging"]
logging = ["log"]
dangerous_configuration = ["rustls/dangerous_configuration"]
quic = ["rustls/quic"]
[dependencies]
base64 = "0.10"
log = { version = "0.4.0", optional = true }
rustls = { path = ".." }
sct = "0.5"
webpki = "0.19"
[dev-dependencies]
ct-logs = "0.5"
docopt = "1.0"
env_logger = "0.6"
mio = "0.6"
serde = "1.0"
serde_derive = "1.0"
vecio = "0.1"
webpki-roots = "0.16"
[[example]]
name = "bogo_shim"
path = "examples/internal/bogo_shim.rs"
required-features = ["dangerous_configuration", "quic"]
[[example]]
name = "trytls_shim"
path = "examples/internal/trytls_shim.rs"
[[example]]
name = "bench"
path = "examples/internal/bench.rs"
[[example]]
name = "tlsclient"
path = "examples/tlsclient.rs"
[[example]]
name = "tlsserver"
path = "examples/tlsserver.rs"
[[example]]
name = "simpleclient"
path = "examples/simpleclient.rs"
[[example]]
name = "simple_0rtt_client"
path = "examples/simple_0rtt_client.rs"
required-features = ["logging"]

View File

@ -27,7 +27,8 @@ fn can_read_safari_client_hello() {
.filter(None, log::LevelFilter::Trace)
.try_init();
let bytes = b"\x16\x03\x01\x00\xeb\x01\x00\x00\xe7\x03\x03\xb6\x1f\xe4\x3a\x55\
let bytes = b"\
\x16\x03\x01\x00\xeb\x01\x00\x00\xe7\x03\x03\xb6\x1f\xe4\x3a\x55\
\x90\x3e\xc0\x28\x9c\x12\xe0\x5c\x84\xea\x90\x1b\xfb\x11\xfc\xbd\
\x25\x55\xda\x9f\x51\x93\x1b\x8d\x92\x66\xfd\x00\x00\x2e\xc0\x2c\
\xc0\x2b\xc0\x24\xc0\x23\xc0\x0a\xc0\x09\xcc\xa9\xc0\x30\xc0\x2f\