Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dcou: mod banking_trace::for_test #32428

Merged
merged 3 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

5 changes: 5 additions & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ matches = { workspace = true }
raptorq = { workspace = true }
serde_json = { workspace = true }
serial_test = { workspace = true }
# See order-crates-for-publishing.py for using this unusual `path = "."`
solana-core = { path = ".", features = ["dev-context-only-utils"] }
solana-logger = { workspace = true }
solana-program-runtime = { workspace = true }
solana-stake-program = { workspace = true }
Expand All @@ -93,6 +95,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,
},
Comment on lines -7 to -10
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels so good these dev related uses are removed from root use. :)

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