/// Runs the test component using `suite` and collects stdout logs and results.
Runs the test component using `suite` and collects stdout logs and results.
Runs the test component using ` suite ` and collects stdout logs and results .
async fn run_invocations(
        &self,
        invocations: Vec<Invocation>,
        run_options: fidl_fuchsia_test::RunOptions,
        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>()
                .context("creating request stream")?;
        self.suite.run(
            &mut invocations.into_iter().map(|i| i.into()),
            run_options,
            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.context("waiting for listener")?
        {
            match result_event {
                OnTestCaseStarted { invocation, primary_log, listener, control_handle: _ } => {
                    let name =
                        invocation.name.ok_or(anyhow::anyhow!("cannot find name in invocation"))?;
                    sender
                        .send(TestEvent::test_case_started(&name))
                        .await
                        .context("Failed to send TestCaseStart event")?;
                    let test_case_processor = TestCaseProcessor::new(
                        name,
                        listener.into_stream().context("Cannot convert listener to 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.into_iter().map(|i| i.wait_for_finish()))
            .await
            .into_iter()
            .collect::<Result<Vec<()>, Error>>()
            .context("Error waiting for all invocations to finish")?;
        Ok(successful_completion)
    }
async fn run_invocations ( & self , invocations : Vec < Invocation > , run_options : fidl_fuchsia_test :: RunOptions , 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 > ( ) . context ( " " ) ? ; self . suite . run ( & mut invocations . into_iter ( ) . map ( | i | i . into ( ) ) , run_options , 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 . context ( " " ) ? { match result_event { OnTestCaseStarted { invocation , primary_log , listener , control_handle : _ } => { let name = invocation . name . ok_or ( anyhow :: anyhow ! ( " " ) ) ? ; sender . send ( TestEvent :: test_case_started ( & name ) ) . await . context ( " " ) ? ; let test_case_processor = TestCaseProcessor :: new ( name , listener . into_stream ( ) . context ( " " ) ? , 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 . into_iter ( ) . map ( | i | i . wait_for_finish ( ) ) ) . await . into_iter ( ) . collect :: < Result < Vec < ( ) > , Error > > ( ) . context ( " " ) ? ; Ok ( successful_completion ) }
Runs the test component using `suite` and collects stdout logs and results.
Runs the test component using ` suite ` and collects stdout logs and results .
&self
invocations
Vec<Invocation>
run_options
fidl_fuchsia_test::RunOptions
sender
&mut mpsc::Sender<TestEvent>