Reduce flakiness in EndToEnd probing tests.

Reduce the flakiness by retrying up to 3 times.

BUG=webrtc:7403, webrtc:7419

Review-Url: https://codereview.webrtc.org/2777913002
Cr-Commit-Position: refs/heads/master@{#17473}
This commit is contained in:
philipel 2017-03-30 05:06:22 -07:00 committed by Commit bot
parent b13237b9da
commit 8a256525f1
2 changed files with 39 additions and 16 deletions

View File

@ -267,8 +267,8 @@ void CallTest::CreateSendConfig(size_t num_video_streams,
}
void CallTest::CreateMatchingReceiveConfigs(Transport* rtcp_send_transport) {
RTC_DCHECK(video_receive_configs_.empty());
RTC_DCHECK(allocated_decoders_.empty());
video_receive_configs_.clear();
allocated_decoders_.clear();
if (num_video_streams_ > 0) {
RTC_DCHECK(!video_send_config_.rtp.ssrcs.empty());
VideoReceiveStream::Config video_config(rtcp_send_transport);

View File

@ -2248,29 +2248,40 @@ class ProbingTest : public test::EndToEndTest {
TEST_F(EndToEndTest, MAYBE_InitialProbing) {
class InitialProbingTest : public ProbingTest {
public:
InitialProbingTest() : ProbingTest(300000) {}
explicit InitialProbingTest(bool* success)
: ProbingTest(300000), success_(success) {}
void PerformTest() override {
int64_t start_time_ms = clock_->TimeInMilliseconds();
do {
if (clock_->TimeInMilliseconds() - start_time_ms > kTimeoutMs) {
ADD_FAILURE() << "Timed out while waiting for initial probing.";
if (clock_->TimeInMilliseconds() - start_time_ms > kTimeoutMs)
break;
}
Call::Stats stats = sender_call_->GetStats();
// Initial probing is done with a x3 and x6 multiplier of the start
// bitrate, so a x4 multiplier is a high enough threshold.
if (stats.send_bandwidth_bps > 4 * 300000)
if (stats.send_bandwidth_bps > 4 * 300000) {
*success_ = true;
break;
}
} while (!observation_complete_.Wait(20));
}
private:
const int kTimeoutMs = 1000;
} test;
bool* const success_;
};
RunBaseTest(&test);
bool success;
const int kMaxAttempts = 3;
for (int i = 0; i < kMaxAttempts; ++i) {
InitialProbingTest test(&success);
RunBaseTest(&test);
if (success)
return;
}
RTC_DCHECK(success) << "Failed to perform mid initial probing ("
<< kMaxAttempts << " attempts).";
}
// Fails on Linux MSan: bugs.webrtc.org/7428
@ -2282,15 +2293,15 @@ TEST_F(EndToEndTest, TriggerMidCallProbing) {
class TriggerMidCallProbingTest : public ProbingTest {
public:
TriggerMidCallProbingTest() : ProbingTest(300000) {}
explicit TriggerMidCallProbingTest(bool* success)
: ProbingTest(300000), success_(success) {}
void PerformTest() override {
*success_ = false;
int64_t start_time_ms = clock_->TimeInMilliseconds();
do {
if (clock_->TimeInMilliseconds() - start_time_ms > kTimeoutMs) {
ADD_FAILURE() << "Timed out while waiting for mid-call probing.";
if (clock_->TimeInMilliseconds() - start_time_ms > kTimeoutMs)
break;
}
Call::Stats stats = sender_call_->GetStats();
@ -2315,8 +2326,10 @@ TEST_F(EndToEndTest, TriggerMidCallProbing) {
// During high cpu load the pacer will not be able to pace packets
// at the correct speed, but if we go from 110 to 1250 kbps
// in 5 seconds then it is due to probing.
if (stats.send_bandwidth_bps > 1250000)
if (stats.send_bandwidth_bps > 1250000) {
*success_ = true;
observation_complete_.Set();
}
break;
}
} while (!observation_complete_.Wait(20));
@ -2324,9 +2337,19 @@ TEST_F(EndToEndTest, TriggerMidCallProbing) {
private:
const int kTimeoutMs = 5000;
} test;
bool* const success_;
};
RunBaseTest(&test);
bool success;
const int kMaxAttempts = 3;
for (int i = 0; i < kMaxAttempts; ++i) {
TriggerMidCallProbingTest test(&success);
RunBaseTest(&test);
if (success)
return;
}
RTC_DCHECK(success) << "Failed to perform mid call probing (" << kMaxAttempts
<< " attempts).";
}
TEST_F(EndToEndTest, VerifyNackStats) {