Use remove_dir_all crate for more robust Windows CI (#604)

* Use `remove_dir_all` 0.7 in tests only
This commit is contained in:
trevyn 2021-04-08 17:45:52 +04:00 committed by GitHub
parent 5ccca2d231
commit bdc5bd748a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 66 additions and 44 deletions

94
Cargo.lock generated
View file

@ -621,42 +621,39 @@ dependencies = [
] ]
[[package]] [[package]]
name = "crossbeam-deque" name = "crossbeam-channel"
version = "0.7.3" version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775"
dependencies = [ 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-epoch",
"crossbeam-utils", "crossbeam-utils 0.8.3",
"maybe-uninit",
] ]
[[package]] [[package]]
name = "crossbeam-epoch" name = "crossbeam-epoch"
version = "0.8.2" version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" checksum = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12"
dependencies = [ dependencies = [
"autocfg 1.0.0", "cfg-if 1.0.0",
"cfg-if 0.1.10", "crossbeam-utils 0.8.3",
"crossbeam-utils",
"lazy_static", "lazy_static",
"maybe-uninit",
"memoffset", "memoffset",
"scopeguard", "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]] [[package]]
name = "crossbeam-utils" name = "crossbeam-utils"
version = "0.7.2" version = "0.7.2"
@ -668,6 +665,17 @@ dependencies = [
"lazy_static", "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]] [[package]]
name = "crypto-mac" name = "crypto-mac"
version = "0.6.2" version = "0.6.2"
@ -1395,6 +1403,7 @@ dependencies = [
"linefeed", "linefeed",
"log", "log",
"prettytable-rs", "prettytable-rs",
"remove_dir_all 0.7.0",
"rpassword", "rpassword",
"rustyline", "rustyline",
"semver 0.10.0", "semver 0.10.0",
@ -1461,6 +1470,7 @@ dependencies = [
"log", "log",
"prettytable-rs", "prettytable-rs",
"rand 0.7.3", "rand 0.7.3",
"remove_dir_all 0.7.0",
"ring", "ring",
"serde", "serde",
"serde_derive", "serde_derive",
@ -1495,6 +1505,7 @@ dependencies = [
"log", "log",
"rand 0.6.5", "rand 0.6.5",
"regex", "regex",
"remove_dir_all 0.7.0",
"ring", "ring",
"serde", "serde",
"serde_derive", "serde_derive",
@ -2009,12 +2020,6 @@ version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
[[package]]
name = "maybe-uninit"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.3.3" version = "2.3.3"
@ -2033,9 +2038,9 @@ dependencies = [
[[package]] [[package]]
name = "memoffset" name = "memoffset"
version = "0.5.5" version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c198b026e1bbf08a937e94c6c60f9ec4a2267f5b0d2eec9c1b21b061ce2be55f" checksum = "f83fb6581e8ed1f85fd45c116db8405483899489e38406156c25eb743554361d"
dependencies = [ dependencies = [
"autocfg 1.0.0", "autocfg 1.0.0",
] ]
@ -2783,9 +2788,9 @@ dependencies = [
[[package]] [[package]]
name = "rayon" name = "rayon"
version = "1.3.1" version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62f02856753d04e03e26929f820d0a0a337ebe71f849801eea335d464b349080" checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674"
dependencies = [ dependencies = [
"autocfg 1.0.0", "autocfg 1.0.0",
"crossbeam-deque", "crossbeam-deque",
@ -2795,13 +2800,13 @@ dependencies = [
[[package]] [[package]]
name = "rayon-core" name = "rayon-core"
version = "1.7.1" version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e92e15d89083484e11353891f1af602cc661426deb9564c298b270c726973280" checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a"
dependencies = [ dependencies = [
"crossbeam-channel",
"crossbeam-deque", "crossbeam-deque",
"crossbeam-queue", "crossbeam-utils 0.8.3",
"crossbeam-utils",
"lazy_static", "lazy_static",
"num_cpus", "num_cpus",
] ]
@ -2868,6 +2873,19 @@ dependencies = [
"winapi 0.3.9", "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]] [[package]]
name = "ring" name = "ring"
version = "0.16.15" version = "0.16.15"
@ -2913,7 +2931,7 @@ dependencies = [
"base64 0.11.0", "base64 0.11.0",
"blake2b_simd", "blake2b_simd",
"constant_time_eq", "constant_time_eq",
"crossbeam-utils", "crossbeam-utils 0.7.2",
] ]
[[package]] [[package]]
@ -3380,7 +3398,7 @@ dependencies = [
"libc", "libc",
"rand 0.7.3", "rand 0.7.3",
"redox_syscall", "redox_syscall",
"remove_dir_all", "remove_dir_all 0.5.3",
"winapi 0.3.9", "winapi 0.3.9",
] ]

View file

@ -47,4 +47,5 @@ url = "2.1"
serde = "1" serde = "1"
serde_derive = "1" serde_derive = "1"
serde_json = "1" serde_json = "1"
remove_dir_all = "0.7"
easy-jsonrpc-mw = "0.5.4" easy-jsonrpc-mw = "0.5.4"

View file

@ -39,3 +39,4 @@ grin_wallet_config = { path = "../config", version = "5.1.0-alpha.1" }
[dev-dependencies] [dev-dependencies]
ed25519-dalek = "1.0.0-pre.4" ed25519-dalek = "1.0.0-pre.4"
remove_dir_all = "0.7"

View file

@ -26,7 +26,6 @@ use self::keychain::ExtKeychain;
use self::libwallet::WalletInst; use self::libwallet::WalletInst;
use impls::test_framework::{LocalWalletClient, WalletProxy}; use impls::test_framework::{LocalWalletClient, WalletProxy};
use impls::{DefaultLCProvider, DefaultWalletImpl}; use impls::{DefaultLCProvider, DefaultWalletImpl};
use std::fs;
use std::sync::Arc; use std::sync::Arc;
use util::secp::key::SecretKey; use util::secp::key::SecretKey;
use util::{Mutex, ZeroingString}; use util::{Mutex, ZeroingString};
@ -77,7 +76,7 @@ macro_rules! open_wallet_and_add {
pub fn clean_output_dir(test_dir: &str) { pub fn clean_output_dir(test_dir: &str) {
let path = std::path::Path::new(test_dir); let path = std::path::Path::new(test_dir);
if path.is_dir() { if path.is_dir() {
fs::remove_dir_all(test_dir).unwrap(); remove_dir_all::remove_dir_all(test_dir).unwrap();
} }
} }

View file

@ -44,3 +44,6 @@ sysinfo = "0.14"
grin_wallet_util = { path = "../util", version = "5.1.0-alpha.1" } grin_wallet_util = { path = "../util", version = "5.1.0-alpha.1" }
grin_wallet_config = { path = "../config", 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" } grin_wallet_libwallet = { path = "../libwallet", version = "5.1.0-alpha.1" }
[dev-dependencies]
"remove_dir_all" = "0.7"

View file

@ -104,7 +104,7 @@ mod tests {
use grin_wallet_util::grin_core::global; use grin_wallet_util::grin_core::global;
fn clean_output_dir(test_dir: &str) { 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) { fn setup(test_dir: &str) {

View file

@ -264,7 +264,7 @@ mod tests {
use crate::util::{self, secp, static_secp_instance}; use crate::util::{self, secp, static_secp_instance};
pub fn clean_output_dir(test_dir: &str) { 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) { pub fn setup(test_dir: &str) {

View file

@ -37,7 +37,7 @@ use std::{fs, thread, time};
/// Just removes all results from previous runs /// Just removes all results from previous runs
pub fn clean_all_output(test_name_dir: &str) { pub fn clean_all_output(test_name_dir: &str) {
let target_dir = format!("target/tmp/{}", test_name_dir); 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); println!("can't remove output from previous test :{}, may be ok", e);
} }
} }

View file

@ -124,7 +124,7 @@ macro_rules! setup_proxy {
#[allow(dead_code)] #[allow(dead_code)]
pub fn clean_output_dir(test_dir: &str) { 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)] #[allow(dead_code)]