Skip to content

Commit

Permalink
dcou: mod banking_trace::for_test
Browse files Browse the repository at this point in the history
  • Loading branch information
ryoqun committed Jul 13, 2023
1 parent 40249cd commit 03e38bc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ matches = { workspace = true }
raptorq = { workspace = true }
serde_json = { workspace = true }
serial_test = { workspace = true }
solana-core = { workspace = true, features = ["dev-context-only-utils"] }
solana-logger = { workspace = true }
solana-program-runtime = { workspace = true }
solana-stake-program = { workspace = true }
Expand All @@ -93,6 +94,9 @@ sysctl = { workspace = true }
[build-dependencies]
rustc_version = { workspace = true }

[features]
dev-context-only-utils = []

[[bench]]
name = "banking_stage"

Expand Down
14 changes: 8 additions & 6 deletions core/src/banking_trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ use {
chrono::{DateTime, Local},
crossbeam_channel::{unbounded, Receiver, SendError, Sender, TryRecvError},
rolling_file::{RollingCondition, RollingConditionBasic, RollingFileAppender},
solana_perf::{
packet::{to_packet_batches, PacketBatch},
test_tx::test_tx,
},
solana_perf::packet::PacketBatch,
solana_sdk::{hash::Hash, slot_history::Slot},
std::{
fs::{create_dir_all, remove_dir_all},
Expand All @@ -20,7 +17,6 @@ use {
thread::{self, sleep, JoinHandle},
time::{Duration, SystemTime},
},
tempfile::TempDir,
thiserror::Error,
};

Expand Down Expand Up @@ -358,8 +354,13 @@ impl TracedSender {
}
}

#[cfg(any(test, feature = "dev-context-only-utils"))]
pub mod for_test {
use super::*;
use {
super::*,
solana_perf::{packet::to_packet_batches, test_tx::test_tx},
tempfile::TempDir,
};

pub fn sample_packet_batch() -> BankingPacketBatch {
BankingPacketBatch::new((to_packet_batches(&vec![test_tx(); 4], 10), None))
Expand Down Expand Up @@ -400,6 +401,7 @@ mod tests {
io::{BufReader, ErrorKind::UnexpectedEof},
str::FromStr,
},
tempfile::TempDir,
};

#[test]
Expand Down

0 comments on commit 03e38bc

Please sign in to comment.