async fn run_invocations(
    suite: &fidl_fuchsia_test::SuiteProxy,
    invocations: Vec<Invocation>,
    sender: &mut mpsc::Sender<TestEvent>,
) -> Result<bool, anyhow::Error> {
    let (run_listener_client, mut run_listener) =
        fidl::endpoints::create_request_stream::<fidl_fuchsia_test::RunListenerMarker>()
            .map_err(|e| format_err!("Error creating request stream: {}", e))?;
    suite.run(
        &mut invocations.into_iter().map(|i| i.into()),
        fidl_fuchsia_test::RunOptions {},
        run_listener_client,
    )?;

    let mut test_case_processors = Vec::new();
    let mut successful_completion = false;

    while let Some(result_event) = run_listener
        .try_next()
        .await
        .map_err(|e| format_err!("Error waiting for listener: {}", e))?
    {
        match result_event {
            OnTestCaseStarted { invocation, primary_log, listener, control_handle: _ } => {
                let name = invocation.name.ok_or(format_err!("cannot find name in invocation"))?;
                sender.send(TestEvent::TestCaseStarted { test_case_name: name.clone() }).await?;
                let test_case_processor = TestCaseProcessor::new(
                    name,
                    listener.into_stream()?,
                    primary_log,
                    sender.clone(),
                );
                test_case_processors.push(test_case_processor);
            }
            OnFinished { .. } => {
                successful_completion = true;
                break;
            }
        }
    }

    // await for all invocations to complete for which test case never completed.
    join_all(test_case_processors.iter_mut().map(|i| i.wait_for_finish()))
        .await
        .into_iter()
        .fold(Ok(()), |acc, r| acc.and_then(|_| r))?;
    Ok(successful_completion)
}
/// 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 .
async fn run_invocations(
    suite: &fidl_fuchsia_test::SuiteProxy,
    invocations: Vec<Invocation>,
    sender: &mut mpsc::Sender<TestEvent>,
) -> Result<bool, anyhow::Error> {
    let (run_listener_client, mut run_listener) =
        fidl::endpoints::create_request_stream::<fidl_fuchsia_test::RunListenerMarker>()
            .map_err(|e| format_err!("Error creating request stream: {}", e))?;
    suite.run(
        &mut invocations.into_iter().map(|i| i.into()),
        fidl_fuchsia_test::RunOptions {},
        run_listener_client,
    )?;
    let mut test_case_processors = Vec::new();
    let mut successful_completion = false;
    while let Some(result_event) = run_listener
        .try_next()
        .await
        .map_err(|e| format_err!("Error waiting for listener: {}", e))?
    {
        match result_event {
            OnTestCaseStarted { invocation, primary_log, listener, control_handle: _ } => {
                let name = invocation.name.ok_or(format_err!("cannot find name in invocation"))?;
                sender.send(TestEvent::TestCaseStarted { test_case_name: name.clone() }).await?;
                let test_case_processor = TestCaseProcessor::new(
                    name,
                    listener.into_stream()?,
                    primary_log,
                    sender.clone(),
                );
                test_case_processors.push(test_case_processor);
            }
            OnFinished { .. } => {
                successful_completion = true;
                break;
            }
        }
    }
    // await for all invocations to complete for which test case never completed.
    join_all(test_case_processors.iter_mut().map(|i| i.wait_for_finish()))
        .await
        .into_iter()
        .fold(Ok(()), |acc, r| acc.and_then(|_| r))?;
    Ok(successful_completion)
}
async fn run_invocations ( suite : & fidl_fuchsia_test :: SuiteProxy , invocations : Vec < Invocation > , sender : & mut mpsc :: Sender < TestEvent > , ) -> Result < bool , anyhow :: Error > { let ( run_listener_client , mut run_listener ) = fidl :: endpoints :: create_request_stream :: < fidl_fuchsia_test :: RunListenerMarker > ( ) . map_err ( | e | format_err ! ( " " e ) ) ? ; suite . run ( & mut invocations . into_iter ( ) . map ( | i | i . into ( ) ) , fidl_fuchsia_test :: RunOptions { } , run_listener_client , ) ? ; let mut test_case_processors = Vec :: new ( ) ; let mut successful_completion = false ; while let Some ( result_event ) = run_listener . try_next ( ) . await . map_err ( | e | format_err ! ( " " e ) ) ? { match result_event { OnTestCaseStarted { invocation , primary_log , listener , control_handle : _ } => { let name = invocation . name . ok_or ( format_err ! ( " " ) ) ? ; sender . send ( TestEvent :: TestCaseStarted { test_case_name : name . clone ( ) } ) . await ? ; let test_case_processor = TestCaseProcessor :: new ( name , listener . into_stream ( ) ? , primary_log , sender . clone ( ) , ) ; test_case_processors . push ( test_case_processor ) ; } OnFinished { .. } => { successful_completion = true ; break ; } } } // await for all invocations to complete for which test case never completed. join_all ( test_case_processors . iter_mut ( ) . map ( | i | i . wait_for_finish ( ) ) ) . await . into_iter ( ) . fold ( Ok ( ( ) ) , | acc , r | acc . and_then ( | _ | r ) ) ? ; Ok ( successful_completion ) }
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
invocations
Vec<Invocation>
sender
&mut mpsc::Sender<TestEvent>
suite
&fidl_fuchsia_test::SuiteProxy
invocations
Vec<Invocation>
sender
&mut mpsc::Sender<TestEvent>