bail!("no password input mechanism available");
}
+#[cfg(test)]
+fn create_testdir(name: &str) -> Result<String, Error> {
+ let mut testdir: PathBuf = String::from("./target/testout").into();
+ testdir.push(std::module_path!());
+ testdir.push(name);
+
+ let _ = std::fs::remove_dir_all(&testdir);
+ let _ = std::fs::create_dir_all(&testdir);
+
+ Ok(testdir.to_str().unwrap().to_string())
+}
+
#[test]
// WARNING: there must only be one test for crypto_parameters as the default key handling is not
// safe w.r.t. concurrency
let some_master_key = vec![3;1];
let default_master_key = vec![4;1];
- let keypath = "./target/testout/keyfile.test";
- let master_keypath = "./target/testout/masterkeyfile.test";
- let invalid_keypath = "./target/testout/invalid_keyfile.test";
+ let testdir = create_testdir("key_source")?;
+
+ let keypath = format!("{}/keyfile.test", testdir);
+ let master_keypath = format!("{}/masterkeyfile.test", testdir);
+ let invalid_keypath = format!("{}/invalid_keyfile.test", testdir);
let no_key_res = CryptoParams {
enc_key: None,
proxmox = { version = "0.11.5", default-features = false, features = [ "tokio" ] }
pbs-buildcfg = { path = "../pbs-buildcfg" }
+
+[dev-dependencies]
+tokio = { version = "1.6", features = [ "macros" ] }
#[test]
fn test_fsetxattr_fgetxattr() {
- let path = "./tests/xattrs.txt";
+ let path = "./test-xattrs.txt";
let file = OpenOptions::new()
.write(true)
.create(true)
/// 'add_entry'. To Finish the file, call 'finish'
/// Example:
/// ```no_run
-/// use proxmox_backup::tools::zip::*;
-/// use tokio::fs::File;
/// use anyhow::{Error, Result};
+/// use tokio::fs::File;
+///
+/// use pbs_tools::zip::{ZipEncoder, ZipEntry};
///
/// #[tokio::main]
/// async fn main() -> Result<(), Error> {
Some(covariance/(len_x as f64))
}
-/// Returns the factors (a,b) of a linear regression y = a + bx
-/// for the variables [x,y] or None if the lists are not the same length
+/// Returns the factors `(a,b)` of a linear regression `y = a + bx`
+/// for the variables `[x,y]` or `None` if the lists are not the same length
/// ```
/// # use proxmox_backup::tools::statistics::linear_regression;
///