Skip to content

Commit

Permalink
Use remove_dir_all crate for more robust Windows CI (mimblewimble#604)
Browse files Browse the repository at this point in the history
* Use `remove_dir_all` 0.7 in tests only
  • Loading branch information
trevyn authored and GeneFerneau committed Apr 21, 2021
1 parent 5ccca2d commit 8567429
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 40 deletions.
86 changes: 52 additions & 34 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
1 change: 1 addition & 0 deletions controller/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
3 changes: 1 addition & 2 deletions controller/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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();
}
}

Expand Down
3 changes: 3 additions & 0 deletions impls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion impls/src/adapters/slatepack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion impls/src/tor/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion integration/tests/framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down

0 comments on commit 8567429

Please sign in to comment.