From 370ca9c52cac61aceb836501ea935cc9519a4593 Mon Sep 17 00:00:00 2001 From: Jeremy Leconte Date: Mon, 28 Nov 2022 18:42:30 +0100 Subject: [PATCH] Enable sharding for fuchsia bots. * Add '--quick' argument to 'low_bandwidth_audio_test' even though it doesn't look like it makes much timing difference. * Add sharding for 'svc_tests' and 'video_engine_tests'. Change-Id: I6e3357954d18ad03ea9f62912dd77e0e1a74b97d Bug: webrtc:14713 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/285100 Reviewed-by: Mirko Bonadei Commit-Queue: Jeremy Leconte Cr-Commit-Position: refs/heads/main@{#38748} --- infra/specs/client.webrtc.json | 9 +++++++-- infra/specs/test_suites.pyl | 12 +++++++++--- infra/specs/tryserver.webrtc.json | 9 +++++++-- test/test_main_lib.cc | 24 ++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 7 deletions(-) diff --git a/infra/specs/client.webrtc.json b/infra/specs/client.webrtc.json index f2de73addc..2425d39457 100644 --- a/infra/specs/client.webrtc.json +++ b/infra/specs/client.webrtc.json @@ -2185,6 +2185,9 @@ "test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/" }, { + "args": [ + "--quick" + ], "isolate_name": "low_bandwidth_audio_test", "merge": { "args": [], @@ -2268,7 +2271,8 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ] + ], + "shards": 4 }, "test_id_prefix": "ninja://pc:svc_tests/" }, @@ -2312,7 +2316,8 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ] + ], + "shards": 4 }, "test_id_prefix": "ninja://:video_engine_tests/" }, diff --git a/infra/specs/test_suites.pyl b/infra/specs/test_suites.pyl index 6a0add629d..0769355409 100644 --- a/infra/specs/test_suites.pyl +++ b/infra/specs/test_suites.pyl @@ -121,17 +121,23 @@ 'common_audio_unittests': {}, 'common_video_unittests': {}, 'dcsctp_unittests': {}, - 'low_bandwidth_audio_test': {}, + 'low_bandwidth_audio_test': { + 'args': ['--quick'] + }, 'rtc_media_unittests': {}, # TODO(bugs.webrtc.org/14705): Enable when NonGlobalFieldTrialsInstanceDoesNotModifyGlobalString is fixed. # TODO(bugs.webrtc.org/14700): Enable when NetworkTest tests are fixed. # 'rtc_unittests': {}, 'rtc_pc_unittests': {}, - 'svc_tests': {}, + 'svc_tests': { + 'mixins': ['shards-4'], + }, 'system_wrappers_unittests': {}, # TODO(bugs.webrtc.org/14712): Enable once network issue is fixed. # 'peerconnection_unittests': {}, - 'video_engine_tests': {}, + 'video_engine_tests': { + 'mixins': ['shards-4'], + }, 'voip_unittests': {}, # TODO(bugs.fuchsia.dev/115601): Enable when cpu time API's are implemented in Fuchsia # 'test_support_unittests': {}, diff --git a/infra/specs/tryserver.webrtc.json b/infra/specs/tryserver.webrtc.json index c7a2273e71..be9a0f1fda 100644 --- a/infra/specs/tryserver.webrtc.json +++ b/infra/specs/tryserver.webrtc.json @@ -2296,6 +2296,9 @@ "test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/" }, { + "args": [ + "--quick" + ], "isolate_name": "low_bandwidth_audio_test", "merge": { "args": [], @@ -2379,7 +2382,8 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ] + ], + "shards": 4 }, "test_id_prefix": "ninja://pc:svc_tests/" }, @@ -2423,7 +2427,8 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ] + ], + "shards": 4 }, "test_id_prefix": "ninja://:video_engine_tests/" }, diff --git a/test/test_main_lib.cc b/test/test_main_lib.cc index e0d710b8f8..991d73e538 100644 --- a/test/test_main_lib.cc +++ b/test/test_main_lib.cc @@ -100,6 +100,17 @@ ABSL_FLAG(std::string, "Path to collect trace events (json file) for chrome://tracing. " "If not set, events aren't captured."); +ABSL_FLAG(std::string, + test_launcher_shard_index, + "", + "Index of the test shard to run, from 0 to " + "the value specified with --test_launcher_total_shards."); + +ABSL_FLAG(std::string, + test_launcher_total_shards, + "", + "Total number of shards."); + namespace webrtc { namespace { @@ -127,6 +138,19 @@ class TestMainImpl : public TestMain { rtc::LogMessage::SetLogToStderr(absl::GetFlag(FLAGS_logs) || absl::GetFlag(FLAGS_verbose)); + // The sharding arguments take precedence over the sharding environment + // variables. + if (!absl::GetFlag(FLAGS_test_launcher_shard_index).empty() && + !absl::GetFlag(FLAGS_test_launcher_total_shards).empty()) { + std::string shard_index = + "GTEST_SHARD_INDEX=" + absl::GetFlag(FLAGS_test_launcher_shard_index); + std::string total_shards = + "GTEST_TOTAL_SHARDS=" + + absl::GetFlag(FLAGS_test_launcher_total_shards); + putenv(shard_index.data()); + putenv(total_shards.data()); + } + // InitFieldTrialsFromString stores the char*, so the char array must // outlive the application. field_trials_ = absl::GetFlag(FLAGS_force_fieldtrials);