Replace lexical Rust fragments with real modules
This commit is contained in:
parent
f8849cdb5f
commit
247819250b
1 changed files with 3302 additions and 2671 deletions
|
|
@ -1,15 +1,24 @@
|
|||
fn run_handoff_matrix() -> Result<(), MatrixError> {
|
||||
use super::{
|
||||
AttachedRunscSignal, CoordinatorId, Duration, Fixture, GenerationId, HOST_COORDINATOR_DRIVER,
|
||||
HostProcessOwnershipSlot, MatrixError, ParticipantState, Path, PathBuf, PidfsProcessIdentityV1,
|
||||
PlatformObservation, ProcessOwnershipCommitAck, ProcessOwnershipContext, RetainedProcess,
|
||||
SandboxCoordinator, Signal, TargetCommand, UnixListener, check_platform, child_broker,
|
||||
current_process_identity, failed_probe_blocks_sandbox_start, fs, host_path,
|
||||
networked_sandbox_view_isolated, read_start_time, sandbox_participant, thread,
|
||||
};
|
||||
|
||||
pub(super) fn run_handoff_matrix() -> Result<(), MatrixError> {
|
||||
require_matrix_prerequisites()?;
|
||||
replaced_handoff_authority_refuses_target_work()?;
|
||||
cross_bundle_handoff_refuses_target_work()
|
||||
}
|
||||
|
||||
fn run_network_cases() -> Result<(), MatrixError> {
|
||||
pub(super) fn run_network_cases() -> Result<(), MatrixError> {
|
||||
failed_probe_blocks_sandbox_start()?;
|
||||
networked_sandbox_view_isolated()
|
||||
}
|
||||
|
||||
fn require_matrix_prerequisites() -> Result<(), MatrixError> {
|
||||
pub(super) fn require_matrix_prerequisites() -> Result<(), MatrixError> {
|
||||
let release = fs::read_to_string("/proc/sys/kernel/osrelease")?;
|
||||
check_platform(&PlatformObservation {
|
||||
operating_system: std::env::consts::OS,
|
||||
|
|
@ -58,7 +67,7 @@ fn require_runtime_prerequisites() -> Result<(), MatrixError> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn lost_acknowledgment_refuses_target_work() -> Result<(), MatrixError> {
|
||||
pub(super) fn lost_acknowledgment_refuses_target_work() -> Result<(), MatrixError> {
|
||||
let fixture = Fixture::new()?;
|
||||
let mut pending = fixture.launch_pending()?;
|
||||
let staged = pending
|
||||
|
|
@ -82,7 +91,7 @@ fn lost_acknowledgment_refuses_target_work() -> Result<(), MatrixError> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn replaced_handoff_authority_refuses_target_work() -> Result<(), MatrixError> {
|
||||
pub(super) fn replaced_handoff_authority_refuses_target_work() -> Result<(), MatrixError> {
|
||||
let fixture = Fixture::new()?;
|
||||
let handoff = fixture
|
||||
.bundle
|
||||
|
|
@ -130,7 +139,7 @@ fn cross_bundle_handoff_refuses_target_work() -> Result<(), MatrixError> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn normal_stop_and_stop_resume() -> Result<(), MatrixError> {
|
||||
pub(super) fn normal_stop_and_stop_resume() -> Result<(), MatrixError> {
|
||||
let fixture = Fixture::new()?;
|
||||
let mut runtime = fixture.launch_committed()?;
|
||||
wait_for_activity(&fixture.activity)?;
|
||||
|
|
@ -166,7 +175,7 @@ fn normal_stop_and_stop_resume() -> Result<(), MatrixError> {
|
|||
assert_activity_stable(&fixture.activity)
|
||||
}
|
||||
|
||||
fn attached_runsc_loss_stops_guest() -> Result<(), MatrixError> {
|
||||
pub(super) fn attached_runsc_loss_stops_guest() -> Result<(), MatrixError> {
|
||||
let fixture = Fixture::new()?;
|
||||
let mut runtime = fixture.launch_committed()?;
|
||||
wait_for_activity(&fixture.activity)?;
|
||||
|
|
@ -181,7 +190,7 @@ fn attached_runsc_loss_stops_guest() -> Result<(), MatrixError> {
|
|||
assert_activity_stable(&fixture.activity)
|
||||
}
|
||||
|
||||
fn runtime_supervisor_loss_stops_guest() -> Result<(), MatrixError> {
|
||||
pub(super) fn runtime_supervisor_loss_stops_guest() -> Result<(), MatrixError> {
|
||||
let fixture = Fixture::new()?;
|
||||
let runtime = fixture.launch_committed()?;
|
||||
wait_for_activity(&fixture.activity)?;
|
||||
|
|
@ -198,7 +207,7 @@ fn runtime_supervisor_loss_stops_guest() -> Result<(), MatrixError> {
|
|||
assert_activity_stable(&fixture.activity)
|
||||
}
|
||||
|
||||
fn host_coordinator_loss_stops_guest() -> Result<(), MatrixError> {
|
||||
pub(super) fn host_coordinator_loss_stops_guest() -> Result<(), MatrixError> {
|
||||
let tree = tempfile::tempdir()?;
|
||||
let ready = tree.path().join("host-coordinator-ready");
|
||||
let activity = tree.path().join("workspace/activity");
|
||||
|
|
@ -275,7 +284,7 @@ impl Drop for ExactChild {
|
|||
}
|
||||
}
|
||||
|
||||
fn run_host_coordinator_driver(arguments: &[std::ffi::OsString]) -> std::io::Result<()> {
|
||||
pub(super) fn run_host_coordinator_driver(arguments: &[std::ffi::OsString]) -> std::io::Result<()> {
|
||||
let tree = arguments
|
||||
.first()
|
||||
.map(PathBuf::from)
|
||||
|
|
@ -298,13 +307,13 @@ fn run_host_coordinator_driver(arguments: &[std::ffi::OsString]) -> std::io::Res
|
|||
}
|
||||
}
|
||||
|
||||
fn matrix_io(error: MatrixError) -> std::io::Error {
|
||||
pub(super) fn matrix_io(error: MatrixError) -> std::io::Error {
|
||||
match error {
|
||||
MatrixError::Skip(detail) | MatrixError::Failure(detail) => std::io::Error::other(detail),
|
||||
}
|
||||
}
|
||||
|
||||
fn failure(error: impl std::fmt::Display) -> MatrixError {
|
||||
pub(super) fn failure(error: impl std::fmt::Display) -> MatrixError {
|
||||
MatrixError::Failure(error.to_string())
|
||||
}
|
||||
|
||||
|
|
@ -364,4 +373,3 @@ fn assert_activity_stable(path: &Path) -> Result<(), MatrixError> {
|
|||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue