Move to using cargo workspaces

- rustls (the library) now lives in rustls/
- the mio examples/tests continue to live in rustls-mio, but
  are built by (eg) `cargo test` in the root of the repo.
This commit is contained in:
Joseph Birr-Pixton 2019-08-24 18:20:14 +01:00
parent b8eca0ec4c
commit 1d70e45af6
104 changed files with 84 additions and 72 deletions

View File

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

View File

@ -1,49 +1,7 @@
[package]
name = "rustls"
version = "0.16.0"
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"]
[dependencies]
base64 = "0.10"
log = { version = "0.4.4", optional = true }
ring = "0.16.5"
sct = "0.6.0"
webpki = "0.21.0"
[features]
default = ["logging"]
logging = ["log"]
dangerous_configuration = []
quic = []
[dev-dependencies]
env_logger = "0.6.1"
log = "0.4.4"
tempfile = "3.0"
webpki-roots = "0.17.0"
criterion = "0.2.11"
[[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"
[[bench]]
name = "benchmarks"
path = "tests/benchmarks.rs"
harness = false
[workspace]
members = [
# the main library and tests
"rustls",
# tests and example code that depend on mio
"rustls-mio",
]

View File

@ -53,7 +53,7 @@ def remove(outfile, infile, pattern):
subprocess.check_call(lcov_exe('--remove', infile, os.getcwd() + pattern, '-o', outfile))
def extract(outfile, infile):
subprocess.check_call(lcov_exe('--extract', infile, os.getcwd() + '/src/*', '-o', outfile))
subprocess.check_call(lcov_exe('--extract', infile, os.getcwd() + '/rustls/src/*', '-o', outfile))
def genhtml(outdir, infile):
subprocess.check_call(['genhtml', '--branch-coverage', '--demangle-cpp', '--legend',
@ -63,17 +63,17 @@ all_infos = []
# unit tests
cleanup()
rustc('--profile', 'test', '--lib')
rustc('--package', 'rustls', '--profile', 'test', '--lib')
run('rustls')
all_infos.append(lcov('rustls.info'))
cleanup()
for example in 'bench bogo_shim trytls_shim'.split():
rustc('--profile', 'dev', '--example', example)
rustc('--package', 'rustls', '--profile', 'dev', '--example', example)
# tests
# crate-level tests
for test in 'api'.split():
rustc('--profile', 'dev', '--test', test)
rustc('--package', 'rustls', '--profile', 'dev', '--test', test)
run(test)
# trytls/bogo
@ -82,6 +82,6 @@ sh('cd bogo && ./runme')
all_infos.append(lcov('tests.info'))
merge('merged.info', all_infos)
remove('coverage.info', 'merged.info', '/src/msgs/macros.rs')
remove('coverage.info', 'merged.info', '/rustls/src/msgs/macros.rs')
extract('final.info', 'coverage.info')
genhtml('target/coverage/', 'final.info')

View File

@ -13,6 +13,3 @@ steps:
displayName: "cargo test (debug; no default features; no run)"
- script: cargo test --release --no-run
displayName: "cargo test (release; no run)"
- script: cargo test --all-features
displayName: "rustls-mio cargo test (debug; all features)"
workingDirectory: rustls-mio

View File

@ -1,6 +1,3 @@
steps:
- script: cargo -Z minimal-versions test --all-features
displayName: "rustls cargo test (debug; all features)"
- script: cargo -Z minimal-versions test --all-features
displayName: "rustls-mio cargo test (debug; all features)"
workingDirectory: rustls-mio

View File

@ -19,7 +19,7 @@ quic = ["rustls/quic"]
[dependencies]
base64 = "0.10"
log = { version = "0.4.4", optional = true }
rustls = { path = ".." }
rustls = { path = "../rustls" }
sct = "0.6"
webpki = "0.21.0"

View File

@ -131,11 +131,11 @@ pub fn skipped(why: &str) {
}
pub fn tlsserver_find() -> &'static str {
"target/debug/examples/tlsserver"
"../target/debug/examples/tlsserver"
}
pub fn tlsclient_find() -> &'static str {
"target/debug/examples/tlsclient"
"../target/debug/examples/tlsclient"
}
pub fn openssl_find() -> String {

View File

@ -235,7 +235,7 @@ fn client_resumes() {
.go();
}
let cache_filename = "target/debug/session.cache";
let cache_filename = "../target/debug/session.cache";
let _ = fs::remove_file(cache_filename);
server.client()
@ -265,8 +265,8 @@ fn server_resumes() {
.http_mode()
.run();
let sess1 = "target/debug/session1.ssl";
let sess2 = "target/debug/session2.ssl";
let sess1 = "../target/debug/session1.ssl";
let sess2 = "../target/debug/session2.ssl";
server.client()
.arg("-sess_out")
@ -310,7 +310,7 @@ fn server_resumes_with_tickets() {
.http_mode()
.run();
let sess = "target/debug/ticket.ssl";
let sess = "../target/debug/ticket.ssl";
server.client()
.arg("-sess_out")

50
rustls/Cargo.toml Normal file
View File

@ -0,0 +1,50 @@
[package]
name = "rustls"
version = "0.16.0"
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"]
autobenches = false
[dependencies]
base64 = "0.10"
log = { version = "0.4.4", optional = true }
ring = "0.16.5"
sct = "0.6.0"
webpki = "0.21.0"
[features]
default = ["logging"]
logging = ["log"]
dangerous_configuration = []
quic = []
[dev-dependencies]
env_logger = "0.6.1"
log = "0.4.4"
tempfile = "3.0"
webpki-roots = "0.17.0"
criterion = "0.2.11"
[[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"
[[bench]]
name = "benchmarks"
path = "tests/benchmarks.rs"
harness = false

View File

@ -4,11 +4,22 @@ use super::message::Message;
use std::fs;
use std::io::Read;
use std::path::{Path, PathBuf};
#[test]
fn test_read_fuzz_corpus() {
let prefix = "fuzz/corpus/message/";
for file in fs::read_dir(prefix).unwrap() {
fn corpus_dir() -> PathBuf {
let from_subcrate = Path::new("../fuzz/corpus/message");
let from_root = Path::new("fuzz/corpus/message");
if from_root.is_dir() {
from_root.to_path_buf()
} else {
from_subcrate.to_path_buf()
}
}
for file in fs::read_dir(corpus_dir()).unwrap() {
let mut f = fs::File::open(file.unwrap().path()).unwrap();
let mut bytes = Vec::new();
f.read_to_end(&mut bytes).unwrap();

Some files were not shown because too many files have changed in this diff Show More