/// Runs the test component using `suite` and collects logs and results.
Runs the test component using `suite` and collects logs and results.
Runs the test component using ` suite ` and collects logs and results .
pub async fn run_and_collect_results_for_invocations(
    suite: fidl_fuchsia_test::SuiteProxy,
    mut sender: mpsc::Sender<TestEvent>,
    test_url: String,
    invocations: Vec<Invocation>,
) -> Result<(), anyhow::Error> {
    log::debug!("running tests");
    let mut successful_completion = true; // will remain true, if there are no tests to run.
    let mut invocations_iter = invocations.into_iter();
    loop {
        const INVOCATIONS_CHUNK: usize = 50;
        let chunk = invocations_iter.by_ref().take(INVOCATIONS_CHUNK).collect::<Vec<_>>();
        if chunk.is_empty() {
            break;
        }
        successful_completion &= run_invocations(&suite, chunk, &mut sender)
            .map_err(|e| format_err!("Error running tests in '{}': {}", test_url, e))
            .await?;
    }
    if successful_completion {
        sender
            .send(TestEvent::test_finished())
            .map_err(|e| format_err!("Error while sending TestFinished event: {}", e))
            .await?;
    }
    Ok(())
}
pub async fn run_and_collect_results_for_invocations ( suite : fidl_fuchsia_test :: SuiteProxy , mut sender : mpsc :: Sender < TestEvent > , test_url : String , invocations : Vec < Invocation > , ) -> Result < ( ) , anyhow :: Error > { log :: debug ! ( " " ) ; let mut successful_completion = true ; // will remain true, if there are no tests to run. let mut invocations_iter = invocations . into_iter ( ) ; loop { const INVOCATIONS_CHUNK : usize = 50 ; let chunk = invocations_iter . by_ref ( ) . take ( INVOCATIONS_CHUNK ) . collect :: < Vec < _ > > ( ) ; if chunk . is_empty ( ) { break ; } successful_completion &= run_invocations ( & suite , chunk , & mut sender ) . map_err ( | e | format_err ! ( " " test_url e ) ) . await ? ; } if successful_completion { sender . send ( TestEvent :: test_finished ( ) ) . map_err ( | e | format_err ! ( " " e ) ) . await ? ; } Ok ( ( ) ) }
Runs the test component using `suite` and collects logs and results.
Runs the test component using ` suite ` and collects logs and results .
suite
fidl_fuchsia_test::SuiteProxy
sender
mpsc::Sender<TestEvent>
test_url
String
invocations
Vec<Invocation>