/// This will start processing of stdout logs and events in the background. The owner of this
/// object should call `wait_for_finish` method  to make sure all the background task completed.
This will start processing of stdout logs and events in the background. The owner of this
object should call `wait_for_finish` method  to make sure all the background task completed.
This will start processing of stdout logs and events in the background . The owner of this object should call ` wait_for_finish ` method to make sure all the background task completed .
pub fn new(
        test_case_name: String,
        listener: CaseListenerRequestStream,
        stdout_socket: fidl::Socket,
        mut sender: mpsc::Sender<TestEvent>,
    ) -> Self {
        let stdout_fut = Self::collect_and_send_stdout(LogOpt {
            name: test_case_name.to_string(),
            stdout_socket,
            sender: sender.clone(),
            buffering_duration: LOG_BUFFERING_DURATION,
            buffer_size: LOG_BUFFER_SIZE,
        });
        let test_complete_fut = Self::listen_for_completion(listener);
        let fut = async move {
            let mut sender_clone = sender.clone();
            let test_case_name_clone = test_case_name.clone();
            let excessive_time_task = fasync::Task::spawn(async move {
                fasync::Timer::new(EXCESSIVE_DURATION).await;
                sender_clone
                    .send(TestEvent::excessive_duration(&test_case_name_clone, EXCESSIVE_DURATION))
                    .await
                    .context("Failed to send excessive duration event")
            });
            let ((), result) = try_join(stdout_fut, test_complete_fut).await?;
            excessive_time_task.cancel().await.unwrap_or(Ok(()))?;
            if let Some(result) = result {
                sender
                    .send(TestEvent::test_case_finished(&test_case_name, result))
                    .await
                    .context("Failed to send TestCaseFinished Event")
            } else {
                Ok(())
            }
        };
        TestCaseProcessor { f: fuchsia_async::Task::spawn(fut) }
    }
pub fn new ( test_case_name : String , listener : CaseListenerRequestStream , stdout_socket : fidl :: Socket , mut sender : mpsc :: Sender < TestEvent > , ) -> Self { let stdout_fut = Self :: collect_and_send_stdout ( LogOpt { name : test_case_name . to_string ( ) , stdout_socket , sender : sender . clone ( ) , buffering_duration : LOG_BUFFERING_DURATION , buffer_size : LOG_BUFFER_SIZE , } ) ; let test_complete_fut = Self :: listen_for_completion ( listener ) ; let fut = async move { let mut sender_clone = sender . clone ( ) ; let test_case_name_clone = test_case_name . clone ( ) ; let excessive_time_task = fasync :: Task :: spawn ( async move { fasync :: Timer :: new ( EXCESSIVE_DURATION ) . await ; sender_clone . send ( TestEvent :: excessive_duration ( & test_case_name_clone , EXCESSIVE_DURATION ) ) . await . context ( " " ) } ) ; let ( ( ) , result ) = try_join ( stdout_fut , test_complete_fut ) . await ? ; excessive_time_task . cancel ( ) . await . unwrap_or ( Ok ( ( ) ) ) ? ; if let Some ( result ) = result { sender . send ( TestEvent :: test_case_finished ( & test_case_name , result ) ) . await . context ( " " ) } else { Ok ( ( ) ) } } ; TestCaseProcessor { f : fuchsia_async :: Task :: spawn ( fut ) } }
This will start processing of stdout logs and events in the background.
This will start processing of stdout logs and events in the background .
test_case_name
String
listener
CaseListenerRequestStream
stdout_socket
fidl::Socket
sender
mpsc::Sender<TestEvent>