Update ethereum/tests

This commit is contained in:
adria0.eth
2020-09-10 08:04:14 +02:00
committed by GitHub
parent c84d82580a
commit dd38573a28
22 changed files with 495 additions and 76 deletions

View File

@@ -135,10 +135,15 @@ pub fn json_chain_test<H: FnMut(&str, HookType)>(
let mut failed = Vec::new();
for (name, blockchain) in tests.into_iter() {
if !super::debug_include_test(&name) {
continue;
}
let skip_test = test
.skip
.iter()
.any(|block_test| block_test.names.contains(&name));
if skip_test {
info!(" SKIPPED {:?} {:?}", name, blockchain.network);
continue;

View File

@@ -37,6 +37,10 @@ pub fn json_difficulty_test<H: FnMut(&str, HookType)>(
let engine = &spec.engine;
for (name, test) in tests.into_iter() {
if !super::debug_include_test(&name) {
continue;
}
start_stop_hook(&name, HookType::OnStart);
let mut parent_header = Header::new();

View File

@@ -252,6 +252,10 @@ pub fn json_executive_test<H: FnMut(&str, HookType)>(
let mut failed = Vec::new();
for (name, vm) in tests.into_iter() {
if !super::debug_include_test(&name) {
continue;
}
start_stop_hook(&format!("{}", name), HookType::OnStart);
let mut fail = false;

View File

@@ -27,5 +27,5 @@ mod trie;
pub use self::{
executive::json_executive_test,
test_common::{find_json_files_recursive, HookType},
test_common::{debug_include_test, find_json_files_recursive, HookType},
};

View File

@@ -236,7 +236,10 @@ fn ethereum_json_tests() {
let runner =
TestRunner::load(content.as_slice()).expect("cannot load ethereum tests spec file");
println!("----------------------------------------------------");
let result = runner.run();
let result = match std::env::var_os("TEST_DEBUG") {
Some(_) => runner.run_without_par(),
_ => runner.run(),
};
println!("----------------------------------------------------");
flushln!(
"SUCCESS: {} FAILED: {} {:?}",

View File

@@ -56,6 +56,10 @@ pub fn json_chain_test<H: FnMut(&str, HookType)>(
let mut failed = Vec::new();
for (name, test) in tests.into_iter() {
if !super::debug_include_test(&name) {
continue;
}
start_stop_hook(&name, HookType::OnStart);
{

View File

@@ -35,3 +35,14 @@ pub fn find_json_files_recursive(path: &PathBuf) -> Vec<PathBuf> {
.map(DirEntry::into_path)
.collect::<Vec<PathBuf>>()
}
pub fn debug_include_test(name: &str) -> bool {
match std::env::var_os("TEST_DEBUG") {
Some(s) => s.to_string_lossy().split_terminator(",").any(|expr| {
regex::Regex::new(expr)
.expect("invalid regex expression in TEST_DEBUG")
.is_match(name)
}),
_ => true,
}
}

View File

@@ -37,6 +37,10 @@ pub fn json_transaction_test<H: FnMut(&str, HookType)>(
));
let mut failed = Vec::new();
for (name, test) in tests.into_iter() {
if !super::debug_include_test(&name) {
continue;
}
start_stop_hook(&name, HookType::OnStart);
println!(" - tx: {} ", name);

View File

@@ -36,6 +36,10 @@ pub fn json_trie_test<H: FnMut(&str, HookType)>(
let mut failed = vec![];
for (name, test) in tests.into_iter() {
if !super::debug_include_test(&name) {
continue;
}
start_stop_hook(&name, HookType::OnStart);
let mut memdb = journaldb::new_memory_db();