-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use new bidirectional pipe logic in oracle tests
- Loading branch information
Showing
8 changed files
with
69 additions
and
96 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//! Test utilities for the `kona-preimage` crate. | ||
use anyhow::{anyhow, Result}; | ||
use os_pipe::{PipeReader, PipeWriter}; | ||
|
||
/// A bidirectional pipe, with a client and host end. | ||
#[derive(Debug)] | ||
pub(crate) struct BidirectionalPipe { | ||
pub(crate) client: Pipe, | ||
pub(crate) host: Pipe, | ||
} | ||
|
||
/// A single-direction pipe, with a read and write end. | ||
#[derive(Debug)] | ||
pub(crate) struct Pipe { | ||
pub(crate) read: PipeReader, | ||
pub(crate) write: PipeWriter, | ||
} | ||
|
||
/// Creates a [BidirectionalPipe] instance. | ||
pub(crate) fn bidirectional_pipe() -> Result<BidirectionalPipe> { | ||
let (ar, bw) = os_pipe::pipe().map_err(|e| anyhow!("Failed to create pipe: {e}"))?; | ||
let (br, aw) = os_pipe::pipe().map_err(|e| anyhow!("Failed to create pipe: {e}"))?; | ||
|
||
Ok(BidirectionalPipe { | ||
client: Pipe { read: ar, write: aw }, | ||
host: Pipe { read: br, write: bw }, | ||
}) | ||
} |