From cdda76d1c88e2967494cdf65f20e77ecdf47827a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20H=C3=B6glund?= Date: Thu, 20 Feb 2020 12:07:29 +0100 Subject: [PATCH] Make scenario unittests faster. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit They now run in 3 seconds rather than 45 or whatever it was before. The tests still pass (and I tried with gtest_repeat=25), so I think the shorter time is sufficient to prove the code works and doesn't crash. Unit tests need to be fast. I think it's unlikely a longer runtime would make this test a better correctness test, but let me know if there's something in particular with this code that needs the longer runtime. Bug: None Change-Id: I3f4213718870a1772f7a19e3c418634031c46de3 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168884 Reviewed-by: Sebastian Jansson Commit-Queue: Patrik Höglund Cr-Commit-Position: refs/heads/master@{#30569} --- test/scenario/scenario_unittest.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/scenario/scenario_unittest.cc b/test/scenario/scenario_unittest.cc index 1ee7484f81..42fce7a7a0 100644 --- a/test/scenario/scenario_unittest.cc +++ b/test/scenario/scenario_unittest.cc @@ -101,7 +101,7 @@ TEST(ScenarioTest, MAYBE_SimTimeEncoding) { { Scenario s("scenario/encode_sim", false); SetupVideoCall(s, &analyzer); - s.RunFor(TimeDelta::Seconds(60)); + s.RunFor(TimeDelta::Seconds(2)); } // Regression tests based on previous runs. EXPECT_EQ(analyzer.stats().lost_count, 0); @@ -121,7 +121,7 @@ TEST(ScenarioTest, MAYBE_RealTimeEncoding) { { Scenario s("scenario/encode_real", true); SetupVideoCall(s, &analyzer); - s.RunFor(TimeDelta::Seconds(10)); + s.RunFor(TimeDelta::Seconds(2)); } // Regression tests based on previous runs. EXPECT_LT(analyzer.stats().lost_count, 2); @@ -131,7 +131,7 @@ TEST(ScenarioTest, MAYBE_RealTimeEncoding) { TEST(ScenarioTest, SimTimeFakeing) { Scenario s("scenario/encode_sim", false); SetupVideoCall(s, nullptr); - s.RunFor(TimeDelta::Seconds(10)); + s.RunFor(TimeDelta::Seconds(2)); } TEST(ScenarioTest, WritesToRtcEventLog) {