From 4d29ef063ca917d2b43176e456fb3a127a915373 Mon Sep 17 00:00:00 2001 From: Artem Titov Date: Mon, 20 May 2019 10:43:16 +0200 Subject: [PATCH] Add periodic alive message logging to prevent test infra think, that test is dead Bug: webrtc:10138 Change-Id: Ib39ff6df81776a7784687be2dc16ab81c500cc3e Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/137428 Reviewed-by: Mirko Bonadei Commit-Queue: Artem Titov Cr-Commit-Position: refs/heads/master@{#28005} --- test/pc/e2e/peer_connection_quality_test.cc | 26 +++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/test/pc/e2e/peer_connection_quality_test.cc b/test/pc/e2e/peer_connection_quality_test.cc index ecc909b5a6..5541f13bda 100644 --- a/test/pc/e2e/peer_connection_quality_test.cc +++ b/test/pc/e2e/peer_connection_quality_test.cc @@ -52,6 +52,8 @@ constexpr int kMaxVideoAnalyzerThreads = 8; constexpr TimeDelta kStatsUpdateInterval = TimeDelta::Seconds<1>(); constexpr TimeDelta kStatsPollingStopTimeout = TimeDelta::Seconds<1>(); +constexpr TimeDelta kAliveMessageLogInterval = TimeDelta::Seconds<30>(); + std::string VideoConfigSourcePresenceToString(const VideoConfig& video_config) { char buf[1024]; rtc::SimpleStringBuilder builder(buf); @@ -317,6 +319,14 @@ void PeerConnectionE2EQualityTest::Run( webrtc::RtcEventLog::kImmediateOutput); } + // Setup alive logging. It is done to prevent test infra to think that test is + // dead. + RepeatingTaskHandle::DelayedStart(task_queue_->Get(), + kAliveMessageLogInterval, []() { + std::printf("Test is still running...\n"); + return kAliveMessageLogInterval; + }); + // Setup call. signaling_thread->Invoke( RTC_FROM_HERE, @@ -362,10 +372,15 @@ void PeerConnectionE2EQualityTest::Run( // inside. alice_->DetachAecDump(); bob_->DetachAecDump(); - // Destroy |task_queue_|. It is done to stop all running tasks and prevent - // their access to any call related objects after these objects will be - // destroyed during call tear down. - task_queue_.reset(); + // Stop all client started tasks on task queue to prevent their access to any + // call related objects after these objects will be destroyed during call tear + // down. + task_queue_->SendTask([this]() { + rtc::CritScope crit(&lock_); + for (auto& handle : repeating_task_handles_) { + handle.Stop(); + } + }); // Tear down the call. signaling_thread->Invoke( RTC_FROM_HERE, @@ -383,6 +398,9 @@ void PeerConnectionE2EQualityTest::Run( reporter->StopAndReportResults(); } + // Reset |task_queue_| after test to cleanup. + task_queue_.reset(); + // Ensuring that TestPeers have been destroyed in order to correctly close // Audio dumps. RTC_CHECK(!alice_);