Merge pull request #10 from zerotier/cargo-workspaces

Convert to using cargo workspaces.
This commit is contained in:
Erik Hollensbe 2022-06-30 02:07:58 -07:00 committed by GitHub
commit f92e4a165f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 24 additions and 40 deletions

View file

@ -13,4 +13,4 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- run: make test
- run: cargo test

13
Cargo.toml Normal file
View file

@ -0,0 +1,13 @@
[workspace]
members = [
"zerotier-core-crypto",
"zerotier-network-hypervisor",
"zerotier-system-service",
]
[profile.release]
opt-level = 3
lto = true
codegen-units = 1
panic = 'abort'

View file

@ -1,15 +0,0 @@
all:
clean: FORCE
for i in */Cargo.toml; do cd $$(dirname $$i); cargo clean || exit 1; cd ..; done
test:
for i in */Cargo.toml; do cd $$(dirname $$i); cargo test || exit 1; cd ..; done
fmt:
set extglob; for i in */Cargo.toml; do cd $$(dirname $$i); rustfmt **/*.rs || exit 1; cd ..; done
FORCE:
.PHONY: test

View file

@ -5,12 +5,6 @@ edition = "2021"
license = "MPL-2.0"
authors = ["ZeroTier, Inc. <contact@zerotier.com>", "Adam Ierymenko <adam.ierymenko@zerotier.com>"]
[profile.release]
opt-level = 3
lto = true
codegen-units = 1
panic = 'abort'
[dependencies]
rand_core = "0.5.0"
aes-gmac-siv = { path = "../aes-gmac-siv" }

View file

@ -5,12 +5,6 @@ edition = "2021"
license = "MPL-2.0"
authors = ["ZeroTier, Inc. <contact@zerotier.com>", "Adam Ierymenko <adam.ierymenko@zerotier.com>"]
[profile.release]
lto = true
opt-level = 3
codegen-units = 1
panic = 'abort'
[features]
default = ["debug_events"]
debug_events = []

View file

@ -1,4 +1,4 @@
// from zeronsd
pub fn randstring(len: u8) -> String {
(0..len).map(|_| (rand::random::<u8>() % 26) + 'a' as u8).map(|c| if rand::random::<bool>() { (c as char).to_ascii_uppercase() } else { c as char }).map(|c| c.to_string()).collect::<Vec<String>>().join("")
}
// from zeronsd
pub fn randstring(len: u8) -> String {
(0..len).map(|_| (rand::random::<u8>() % 26) + 'a' as u8).map(|c| if rand::random::<bool>() { (c as char).to_ascii_uppercase() } else { c as char }).map(|c| c.to_string()).collect::<Vec<String>>().join("")
}

View file

@ -5,12 +5,6 @@ authors = ["ZeroTier, Inc. <contact@zerotier.com>", "Adam Ierymenko <adam.ieryme
edition = "2021"
license = "MPL-2.0"
[profile.release]
opt-level = 3
lto = true
codegen-units = 1
panic = 'abort'
[dependencies]
zerotier-network-hypervisor = { path = "../zerotier-network-hypervisor" }
zerotier-core-crypto = { path = "../zerotier-core-crypto" }

View file

@ -198,7 +198,11 @@ mod tests {
let start = ms_monotonic();
std::thread::sleep(Duration::from_millis(500));
let end = ms_monotonic();
assert!((end - start).abs() > 450);
assert!((end - start).abs() < 550);
// per docs:
//
// The thread may sleep longer than the duration specified due to scheduling specifics or
// platform-dependent functionality. It will never sleep less.
//
assert!((end - start).abs() >= 500);
}
}