Initial commit
This commit is contained in:
66
examples/test.rs
Normal file
66
examples/test.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
extern crate benchmark_repository;
|
||||
extern crate pretty_env_logger;
|
||||
extern crate yaml_rust;
|
||||
|
||||
use benchmark_repository::{BenchmarkRepository, TargetPath};
|
||||
|
||||
use std::io::{self, copy, Read};
|
||||
use std::path::Path;
|
||||
use yaml_rust::{YamlLoader, YamlEmitter};
|
||||
|
||||
use std::{thread, time};
|
||||
|
||||
fn main()
|
||||
{
|
||||
pretty_env_logger::init();
|
||||
|
||||
let mut benchmark_repository = BenchmarkRepository::new("git@git.luehne.de:patrick/tplp-planning-benchmark.git", Path::new("storage"), "git", "Potassco Bot", "bot@potassco.org");
|
||||
|
||||
/*let files = vec!
|
||||
[
|
||||
TargetPath{source: &Path::new("/tmp/test"), destination: &Path::new("foobar/test")},
|
||||
TargetPath{source: &Path::new("/tmp/test2"), destination: &Path::new("foobar/test-2")},
|
||||
];
|
||||
|
||||
benchmark_repository.commit_files(&files[..], "test-results");*/
|
||||
|
||||
let content = benchmark_repository.read_file(Path::new("configurations.yml"), "test-config").unwrap();
|
||||
let configurations = &YamlLoader::load_from_str(&content).unwrap()[0]["configurations"];
|
||||
|
||||
let content = benchmark_repository.read_file(Path::new("instances.yml"), "test-config").unwrap();
|
||||
let instances = &YamlLoader::load_from_str(&content).unwrap()[0];
|
||||
|
||||
for configuration in configurations.as_vec().unwrap()
|
||||
{
|
||||
for (instance_set_id, instance_set) in instances.as_hash().unwrap()
|
||||
{
|
||||
for instance in instance_set.as_vec().unwrap()
|
||||
{
|
||||
let configuration_id = configuration["id"].as_str().unwrap();
|
||||
let instance_set_id = instance_set_id.as_str().unwrap();
|
||||
let instance_ipc = instance["ipc"].as_str().unwrap();
|
||||
let instance_domain = instance["domain"].as_str().unwrap();
|
||||
let instance_number = instance["instance"].as_i64().unwrap();
|
||||
|
||||
let file_name_base = format!("{}/{}/{}/{}", configuration_id, instance_ipc, instance_domain, instance_number);
|
||||
let file_name_output = format!("{}.out", file_name_base);
|
||||
|
||||
if (benchmark_repository.file_exists(Path::new(&file_name_output), "test-results"))
|
||||
{
|
||||
println!("done: [{}, {}, {}/{}/{}]", configuration_id, instance_set_id, instance_ipc, instance_domain, instance_number);
|
||||
continue;
|
||||
}
|
||||
|
||||
let test = benchmark_repository.create_autocommit_directory(Path::new(&file_name_base), "test-results").unwrap();
|
||||
//println!("{}", test.display());
|
||||
|
||||
//println!("to do: [{}, {}, {}/{}/{}]", configuration_id, instance_set_id, instance_ipc, instance_domain, instance_number);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let duration = time::Duration::from_secs(20);
|
||||
thread::sleep(duration);
|
||||
|
||||
benchmark_repository.wait_for_autocommit_thread();
|
||||
}
|
Reference in New Issue
Block a user