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 <mbonadei@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28005}
This commit is contained in:
Artem Titov 2019-05-20 10:43:16 +02:00 committed by Commit Bot
parent 97716c0132
commit 4d29ef063c

View File

@ -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<void>(
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<void>(
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_);