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

cli: add program logs for genesis programs in tests #594

Merged
merged 2 commits into from
Aug 10, 2021
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ incremented for features.

## [Unreleased]

### Features

* cli: Programs embedded into genesis during tests will produce program logs.

## [0.13.0] - 2021-08-08

### Features
Expand Down
15 changes: 15 additions & 0 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1457,6 +1457,21 @@ fn stream_logs(config: &WithPath<Config>) -> Result<Vec<std::process::Child>> {
.spawn()?;
handles.push(child);
}
if let Some(test) = config.test.as_ref() {
for entry in &test.genesis {
let log_file = File::create(format!("{}/{}.log", program_logs_dir, entry.address))?;
let stdio = std::process::Stdio::from(log_file);
let child = std::process::Command::new("solana")
.arg("logs")
.arg(entry.address.clone())
.arg("--url")
.arg(config.provider.cluster.url())
.stdout(stdio)
.spawn()?;
handles.push(child);
}
}

Ok(handles)
}

Expand Down