From bdc5bd748a4e399e6febc5e3c4974e569ee39638 Mon Sep 17 00:00:00 2001 From: trevyn Date: Thu, 8 Apr 2021 17:45:52 +0400 Subject: [PATCH] Use `remove_dir_all` crate for more robust Windows CI (#604) * Use `remove_dir_all` 0.7 in tests only --- Cargo.lock | 94 ++++++++++++++++++++------------- Cargo.toml | 1 + controller/Cargo.toml | 1 + controller/tests/common/mod.rs | 3 +- impls/Cargo.toml | 3 ++ impls/src/adapters/slatepack.rs | 2 +- impls/src/tor/config.rs | 2 +- integration/tests/framework.rs | 2 +- tests/common/mod.rs | 2 +- 9 files changed, 66 insertions(+), 44 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 40eaa379..cf6dbf34 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -621,42 +621,39 @@ dependencies = [ ] [[package]] -name = "crossbeam-deque" -version = "0.7.3" +name = "crossbeam-channel" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" +checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils 0.8.3", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" +dependencies = [ + "cfg-if 1.0.0", "crossbeam-epoch", - "crossbeam-utils", - "maybe-uninit", + "crossbeam-utils 0.8.3", ] [[package]] name = "crossbeam-epoch" -version = "0.8.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" +checksum = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" dependencies = [ - "autocfg 1.0.0", - "cfg-if 0.1.10", - "crossbeam-utils", + "cfg-if 1.0.0", + "crossbeam-utils 0.8.3", "lazy_static", - "maybe-uninit", "memoffset", "scopeguard", ] -[[package]] -name = "crossbeam-queue" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" -dependencies = [ - "cfg-if 0.1.10", - "crossbeam-utils", - "maybe-uninit", -] - [[package]] name = "crossbeam-utils" version = "0.7.2" @@ -668,6 +665,17 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "crossbeam-utils" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" +dependencies = [ + "autocfg 1.0.0", + "cfg-if 1.0.0", + "lazy_static", +] + [[package]] name = "crypto-mac" version = "0.6.2" @@ -1395,6 +1403,7 @@ dependencies = [ "linefeed", "log", "prettytable-rs", + "remove_dir_all 0.7.0", "rpassword", "rustyline", "semver 0.10.0", @@ -1461,6 +1470,7 @@ dependencies = [ "log", "prettytable-rs", "rand 0.7.3", + "remove_dir_all 0.7.0", "ring", "serde", "serde_derive", @@ -1495,6 +1505,7 @@ dependencies = [ "log", "rand 0.6.5", "regex", + "remove_dir_all 0.7.0", "ring", "serde", "serde_derive", @@ -2009,12 +2020,6 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - [[package]] name = "memchr" version = "2.3.3" @@ -2033,9 +2038,9 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.5.5" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c198b026e1bbf08a937e94c6c60f9ec4a2267f5b0d2eec9c1b21b061ce2be55f" +checksum = "f83fb6581e8ed1f85fd45c116db8405483899489e38406156c25eb743554361d" dependencies = [ "autocfg 1.0.0", ] @@ -2783,9 +2788,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.3.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f02856753d04e03e26929f820d0a0a337ebe71f849801eea335d464b349080" +checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" dependencies = [ "autocfg 1.0.0", "crossbeam-deque", @@ -2795,13 +2800,13 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.7.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e92e15d89083484e11353891f1af602cc661426deb9564c298b270c726973280" +checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" dependencies = [ + "crossbeam-channel", "crossbeam-deque", - "crossbeam-queue", - "crossbeam-utils", + "crossbeam-utils 0.8.3", "lazy_static", "num_cpus", ] @@ -2868,6 +2873,19 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "remove_dir_all" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "882f368737489ea543bc5c340e6f3d34a28c39980bd9a979e47322b26f60ac40" +dependencies = [ + "libc", + "log", + "num_cpus", + "rayon", + "winapi 0.3.9", +] + [[package]] name = "ring" version = "0.16.15" @@ -2913,7 +2931,7 @@ dependencies = [ "base64 0.11.0", "blake2b_simd", "constant_time_eq", - "crossbeam-utils", + "crossbeam-utils 0.7.2", ] [[package]] @@ -3380,7 +3398,7 @@ dependencies = [ "libc", "rand 0.7.3", "redox_syscall", - "remove_dir_all", + "remove_dir_all 0.5.3", "winapi 0.3.9", ] diff --git a/Cargo.toml b/Cargo.toml index 84628513..29a23798 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,4 +47,5 @@ url = "2.1" serde = "1" serde_derive = "1" serde_json = "1" +remove_dir_all = "0.7" easy-jsonrpc-mw = "0.5.4" diff --git a/controller/Cargo.toml b/controller/Cargo.toml index 59a7607d..35796a97 100644 --- a/controller/Cargo.toml +++ b/controller/Cargo.toml @@ -39,3 +39,4 @@ grin_wallet_config = { path = "../config", version = "5.1.0-alpha.1" } [dev-dependencies] ed25519-dalek = "1.0.0-pre.4" +remove_dir_all = "0.7" \ No newline at end of file diff --git a/controller/tests/common/mod.rs b/controller/tests/common/mod.rs index 5d1f0b2f..7fc5e014 100644 --- a/controller/tests/common/mod.rs +++ b/controller/tests/common/mod.rs @@ -26,7 +26,6 @@ use self::keychain::ExtKeychain; use self::libwallet::WalletInst; use impls::test_framework::{LocalWalletClient, WalletProxy}; use impls::{DefaultLCProvider, DefaultWalletImpl}; -use std::fs; use std::sync::Arc; use util::secp::key::SecretKey; use util::{Mutex, ZeroingString}; @@ -77,7 +76,7 @@ macro_rules! open_wallet_and_add { pub fn clean_output_dir(test_dir: &str) { let path = std::path::Path::new(test_dir); if path.is_dir() { - fs::remove_dir_all(test_dir).unwrap(); + remove_dir_all::remove_dir_all(test_dir).unwrap(); } } diff --git a/impls/Cargo.toml b/impls/Cargo.toml index d9996005..28a940cd 100644 --- a/impls/Cargo.toml +++ b/impls/Cargo.toml @@ -44,3 +44,6 @@ sysinfo = "0.14" grin_wallet_util = { path = "../util", version = "5.1.0-alpha.1" } grin_wallet_config = { path = "../config", version = "5.1.0-alpha.1" } grin_wallet_libwallet = { path = "../libwallet", version = "5.1.0-alpha.1" } + +[dev-dependencies] +"remove_dir_all" = "0.7" \ No newline at end of file diff --git a/impls/src/adapters/slatepack.rs b/impls/src/adapters/slatepack.rs index 8846273b..cf451b06 100644 --- a/impls/src/adapters/slatepack.rs +++ b/impls/src/adapters/slatepack.rs @@ -104,7 +104,7 @@ mod tests { use grin_wallet_util::grin_core::global; fn clean_output_dir(test_dir: &str) { - let _ = fs::remove_dir_all(test_dir); + let _ = remove_dir_all::remove_dir_all(test_dir); } fn setup(test_dir: &str) { diff --git a/impls/src/tor/config.rs b/impls/src/tor/config.rs index 5960704a..6e2d3785 100644 --- a/impls/src/tor/config.rs +++ b/impls/src/tor/config.rs @@ -264,7 +264,7 @@ mod tests { use crate::util::{self, secp, static_secp_instance}; pub fn clean_output_dir(test_dir: &str) { - let _ = fs::remove_dir_all(test_dir); + let _ = remove_dir_all::remove_dir_all(test_dir); } pub fn setup(test_dir: &str) { diff --git a/integration/tests/framework.rs b/integration/tests/framework.rs index b692c8a2..ffade00c 100644 --- a/integration/tests/framework.rs +++ b/integration/tests/framework.rs @@ -37,7 +37,7 @@ use std::{fs, thread, time}; /// Just removes all results from previous runs pub fn clean_all_output(test_name_dir: &str) { let target_dir = format!("target/tmp/{}", test_name_dir); - if let Err(e) = fs::remove_dir_all(target_dir) { + if let Err(e) = remove_dir_all::remove_dir_all(target_dir) { println!("can't remove output from previous test :{}, may be ok", e); } } diff --git a/tests/common/mod.rs b/tests/common/mod.rs index d2b6c624..ed0a0048 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -124,7 +124,7 @@ macro_rules! setup_proxy { #[allow(dead_code)] pub fn clean_output_dir(test_dir: &str) { - let _ = fs::remove_dir_all(test_dir); + let _ = remove_dir_all::remove_dir_all(test_dir); } #[allow(dead_code)]