Enable logging automatically when passing a SEED env variable

This commit is contained in:
Antonio Scandurra 2021-04-19 13:01:13 +02:00
parent 2c72f9c14f
commit 06858c023c

View file

@ -1194,10 +1194,6 @@ mod tests {
#[test] #[test]
fn test_random() { fn test_random() {
if let Ok(true) = env::var("LOG").map(|l| l.parse().unwrap()) {
SimpleLogger::init(LevelFilter::Info, Default::default()).unwrap();
}
let iterations = env::var("ITERATIONS") let iterations = env::var("ITERATIONS")
.map(|i| i.parse().unwrap()) .map(|i| i.parse().unwrap())
.unwrap_or(100); .unwrap_or(100);
@ -1208,6 +1204,8 @@ mod tests {
.map(|o| o.parse().unwrap()) .map(|o| o.parse().unwrap())
.unwrap_or(20); .unwrap_or(20);
let seeds = if let Ok(seed) = env::var("SEED").map(|s| s.parse().unwrap()) { let seeds = if let Ok(seed) = env::var("SEED").map(|s| s.parse().unwrap()) {
// Init logging so that we can debug the operations for this seed.
SimpleLogger::init(LevelFilter::Info, Default::default()).unwrap();
seed..seed + 1 seed..seed + 1
} else { } else {
0..iterations 0..iterations