From 607cc6c78215355ea086613dca27297eb8fbe87f Mon Sep 17 00:00:00 2001 From: debris Date: Tue, 17 Oct 2017 10:40:45 +0200 Subject: [PATCH] fixed compiling util tests --- Cargo.lock | 3 +++ util/journaldb/Cargo.toml | 15 ++++++++++----- util/journaldb/src/archivedb.rs | 3 +-- util/journaldb/src/lib.rs | 19 ++++++++++++++----- util/journaldb/src/overlayrecentdb.rs | 5 ++--- util/journaldb/src/refcounteddb.rs | 3 +-- 6 files changed, 31 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0e5cd4abe..895c837ca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1260,9 +1260,12 @@ version = "0.1.0" dependencies = [ "ethcore-bigint 0.1.3", "ethcore-bytes 0.1.0", + "ethcore-logger 1.9.0", + "hash 0.1.0", "hashdb 0.1.0", "heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "kvdb 0.1.0", + "kvdb-memorydb 0.1.0", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "memorydb 0.1.0", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/util/journaldb/Cargo.toml b/util/journaldb/Cargo.toml index 0b537be41..a70631836 100644 --- a/util/journaldb/Cargo.toml +++ b/util/journaldb/Cargo.toml @@ -6,13 +6,18 @@ description = "A `HashDB` which can manage a short-term journal potentially cont license = "GPL3" [dependencies] -hashdb = { path = "../hashdb" } -kvdb = { path = "../kvdb" } ethcore-bigint = { path = "../bigint", features = ["heapsizeof"] } ethcore-bytes = { path = "../bytes" } -rlp = { path = "../rlp" } +hashdb = { path = "../hashdb" } +heapsize = "0.4" +kvdb = { path = "../kvdb" } +log = "0.3" memorydb = { path = "../memorydb" } parking_lot = "0.4" -heapsize = "0.4" +rlp = { path = "../rlp" } util-error = { path = "../error" } -log = "0.3" + +[dev-dependencies] +ethcore-logger = { path = "../../logger" } +hash = { path = "../hash" } +kvdb-memorydb = { path = "../kvdb-memorydb" } diff --git a/util/journaldb/src/archivedb.rs b/util/journaldb/src/archivedb.rs index 4a3225f1f..5fa1277e4 100644 --- a/util/journaldb/src/archivedb.rs +++ b/util/journaldb/src/archivedb.rs @@ -202,8 +202,7 @@ mod tests { use keccak::keccak; use hashdb::{HashDB, DBValue}; use super::*; - use journaldb::traits::JournalDB; - use kvdb_memorydb; + use {kvdb_memorydb, JournalDB}; #[test] fn insert_same_in_fork() { diff --git a/util/journaldb/src/lib.rs b/util/journaldb/src/lib.rs index d21679242..ef26cb8d6 100644 --- a/util/journaldb/src/lib.rs +++ b/util/journaldb/src/lib.rs @@ -16,16 +16,25 @@ //! `JournalDB` interface and implementation. +extern crate heapsize; +#[macro_use] +extern crate log; + extern crate ethcore_bigint as bigint; extern crate ethcore_bytes as bytes; +extern crate hashdb; +extern crate kvdb; +extern crate memorydb; extern crate parking_lot; extern crate rlp; -extern crate hashdb; -extern crate memorydb; -extern crate kvdb; extern crate util_error as error; -extern crate heapsize; -#[macro_use] extern crate log; + +#[cfg(test)] +extern crate ethcore_logger; +#[cfg(test)] +extern crate hash as keccak; +#[cfg(test)] +extern crate kvdb_memorydb; use std::{fmt, str}; use std::sync::Arc; diff --git a/util/journaldb/src/overlayrecentdb.rs b/util/journaldb/src/overlayrecentdb.rs index 71ce05696..b74e3adb6 100644 --- a/util/journaldb/src/overlayrecentdb.rs +++ b/util/journaldb/src/overlayrecentdb.rs @@ -324,7 +324,7 @@ impl JournalDB for OverlayRecentDB { trace!(target: "journaldb", "Delete journal for time #{}.{}: {}, (canon was {}): +{} -{} entries", end_era, index, journal.id, canon_id, journal.insertions.len(), journal.deletions.len()); { if *canon_id == journal.id { - for h in &journal.insertions { + for h in &journal.insertions { if let Some((d, rc)) = journal_overlay.backing_overlay.raw(&to_short_key(h)) { if rc > 0 { canon_insertions.push((h.clone(), d)); //TODO: optimize this to avoid data copy @@ -459,8 +459,7 @@ mod tests { use super::*; use hashdb::{HashDB, DBValue}; use ethcore_logger::init_log; - use journaldb::JournalDB; - use kvdb_memorydb; + use {kvdb_memorydb, JournalDB}; fn new_db() -> OverlayRecentDB { let backing = Arc::new(kvdb_memorydb::create(0)); diff --git a/util/journaldb/src/refcounteddb.rs b/util/journaldb/src/refcounteddb.rs index b97940321..6e114e476 100644 --- a/util/journaldb/src/refcounteddb.rs +++ b/util/journaldb/src/refcounteddb.rs @@ -210,9 +210,8 @@ mod tests { use keccak::keccak; use hashdb::{HashDB, DBValue}; - use kvdb_memorydb; use super::*; - use super::super::traits::JournalDB; + use {JournalDB, kvdb_memorydb}; fn new_db() -> RefCountedDB { let backing = Arc::new(kvdb_memorydb::create(0));