Skip to content

Commit

Permalink
v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsmfm committed Dec 30, 2020
1 parent e3f8813 commit e4b457c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## 0.2.0

- Make --tests-glob required
- Use absolute path
- Improve debug log

## 0.1.0

- init
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "split-test"
version = "0.1.0"
version = "0.2.0"
authors = ["Fumiaki MATSUSHIMA <[email protected]>"]
edition = "2018"

Expand Down
21 changes: 18 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use anyhow::{bail, Result};
use glob::glob;
use log::warn;
use log::Level::Debug;
use log::{debug, log_enabled, warn};
use quick_xml::de::from_reader;
use serde::Deserialize;
use std::collections::HashMap;
use std::collections::HashSet;
use std::fs::canonicalize;
use std::fs::File;
use std::io::BufReader;
use std::iter::FromIterator;
Expand All @@ -16,7 +18,7 @@ use structopt::StructOpt;
struct Opt {
#[structopt(short, long)]
debug: bool,
#[structopt(long)]
#[structopt(long, required = true)]
tests_glob: Vec<String>,
#[structopt(long)]
node_index: usize,
Expand Down Expand Up @@ -55,7 +57,7 @@ fn expand_globs(patterns: &Vec<String>) -> Result<Vec<PathBuf>> {

for pattern in patterns {
for path in glob(&pattern)? {
files.insert(path?);
files.insert(canonicalize(path?)?);
}
}

Expand Down Expand Up @@ -138,6 +140,19 @@ fn main() -> Result<()> {
nodes.get_mut(i % len).unwrap().add(test_file, 0.0);
}

if log_enabled!(Debug) {
for (i, node) in nodes.iter().enumerate() {
debug!(
"node {}: recorded_total_time: {}",
i, node.recorded_total_time
);

for test_file in node.test_files.iter() {
debug!("{}", test_file.to_str().unwrap());
}
}
}

for test_file in nodes.get(args.node_index).unwrap().test_files.iter() {
println!("{}", test_file.to_str().unwrap());
}
Expand Down

0 comments on commit e4b457c

Please sign in to comment.