From b9700ac9976f6c557f9de98dd1162fc7c1006474 Mon Sep 17 00:00:00 2001 From: Erik Hollensbe Date: Wed, 29 Jun 2022 19:13:18 -0700 Subject: [PATCH] Convert to using cargo workspaces. Signed-off-by: Erik Hollensbe --- .github/workflows/main.yaml | 2 +- Cargo.toml | 13 +++++++++++++ Makefile | 15 --------------- zerotier-core-crypto/Cargo.toml | 6 ------ zerotier-network-hypervisor/Cargo.toml | 6 ------ zerotier-network-hypervisor/src/util/testutil.rs | 8 ++++---- zerotier-system-service/Cargo.toml | 6 ------ zerotier-system-service/src/utils.rs | 8 ++++++-- 8 files changed, 24 insertions(+), 40 deletions(-) create mode 100644 Cargo.toml delete mode 100644 Makefile diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index f868e82b7..bfe4c0640 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -13,4 +13,4 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - run: make test + - run: cargo test diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 000000000..173f6b86f --- /dev/null +++ b/Cargo.toml @@ -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' diff --git a/Makefile b/Makefile deleted file mode 100644 index 932d49a3c..000000000 --- a/Makefile +++ /dev/null @@ -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 diff --git a/zerotier-core-crypto/Cargo.toml b/zerotier-core-crypto/Cargo.toml index d95ab9b62..cbb73e7b3 100644 --- a/zerotier-core-crypto/Cargo.toml +++ b/zerotier-core-crypto/Cargo.toml @@ -5,12 +5,6 @@ edition = "2021" license = "MPL-2.0" authors = ["ZeroTier, Inc. ", "Adam Ierymenko "] -[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" } diff --git a/zerotier-network-hypervisor/Cargo.toml b/zerotier-network-hypervisor/Cargo.toml index 243591eec..51e1642c8 100644 --- a/zerotier-network-hypervisor/Cargo.toml +++ b/zerotier-network-hypervisor/Cargo.toml @@ -5,12 +5,6 @@ edition = "2021" license = "MPL-2.0" authors = ["ZeroTier, Inc. ", "Adam Ierymenko "] -[profile.release] -lto = true -opt-level = 3 -codegen-units = 1 -panic = 'abort' - [features] default = ["debug_events"] debug_events = [] diff --git a/zerotier-network-hypervisor/src/util/testutil.rs b/zerotier-network-hypervisor/src/util/testutil.rs index 15dafffdc..62f94fd33 100644 --- a/zerotier-network-hypervisor/src/util/testutil.rs +++ b/zerotier-network-hypervisor/src/util/testutil.rs @@ -1,4 +1,4 @@ - // from zeronsd - pub fn randstring(len: u8) -> String { - (0..len).map(|_| (rand::random::() % 26) + 'a' as u8).map(|c| if rand::random::() { (c as char).to_ascii_uppercase() } else { c as char }).map(|c| c.to_string()).collect::>().join("") - } +// from zeronsd +pub fn randstring(len: u8) -> String { + (0..len).map(|_| (rand::random::() % 26) + 'a' as u8).map(|c| if rand::random::() { (c as char).to_ascii_uppercase() } else { c as char }).map(|c| c.to_string()).collect::>().join("") +} diff --git a/zerotier-system-service/Cargo.toml b/zerotier-system-service/Cargo.toml index 34da3c029..948152cdc 100644 --- a/zerotier-system-service/Cargo.toml +++ b/zerotier-system-service/Cargo.toml @@ -5,12 +5,6 @@ authors = ["ZeroTier, Inc. ", "Adam Ierymenko 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); } }