mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-12 21:30:45 +01:00
Migrate test_main_lib on new global metrics API
Bug: b/246095034 Change-Id: I99cd631cdae49ad1e0812f1204a6be4d6f43bc34 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/276604 Commit-Queue: Artem Titov <titovartem@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/main@{#38184}
This commit is contained in:
parent
5baa5b6278
commit
f863182ce5
4 changed files with 12 additions and 15 deletions
|
@ -29,7 +29,7 @@ CreatePeerConnectionE2EQualityTestFixture(
|
|||
return std::make_unique<PeerConnectionE2EQualityTest>(
|
||||
std::move(test_case_name), time_controller,
|
||||
std::move(audio_quality_analyzer), std::move(video_quality_analyzer),
|
||||
test::GetGlobalMetricsLoggerAndExporter());
|
||||
test::GetGlobalMetricsLogger());
|
||||
}
|
||||
|
||||
} // namespace webrtc_pc_e2e
|
||||
|
|
|
@ -93,6 +93,8 @@ static absl::optional<std::vector<std::string>> g_metrics_to_plot;
|
|||
- (int)runGoogleTests {
|
||||
rtc::test::ConfigureCoverageReportPath();
|
||||
|
||||
int exitStatus = g_test_suite();
|
||||
|
||||
std::vector<std::unique_ptr<webrtc::test::MetricsExporter>> exporters;
|
||||
if (g_export_perf_results_new_api) {
|
||||
exporters.push_back(std::make_unique<webrtc::test::StdoutMetricsExporter>());
|
||||
|
@ -111,11 +113,7 @@ static absl::optional<std::vector<std::string>> g_metrics_to_plot;
|
|||
} else {
|
||||
exporters.push_back(std::make_unique<webrtc::test::PrintResultProxyMetricsExporter>());
|
||||
}
|
||||
webrtc::test::SetupGlobalMetricsLoggerAndExporter(std::move(exporters));
|
||||
|
||||
int exitStatus = g_test_suite();
|
||||
|
||||
webrtc::test::ExportAndDestroyGlobalMetricsLoggerAndExporter();
|
||||
webrtc::test::ExportPerfMetric(*webrtc::test::GetGlobalMetricsLogger(), std::move(exporters));
|
||||
if (!g_export_perf_results_new_api) {
|
||||
if (g_write_perf_output) {
|
||||
// Stores data into a proto file under the app's document directory.
|
||||
|
|
|
@ -58,7 +58,7 @@ class PeerConnectionE2EQualityTestSmokeTest : public ::testing::Test {
|
|||
network_emulation_ = CreateNetworkEmulationManager();
|
||||
auto video_quality_analyzer = std::make_unique<DefaultVideoQualityAnalyzer>(
|
||||
network_emulation_->time_controller()->GetClock(),
|
||||
test::GetGlobalMetricsLoggerAndExporter());
|
||||
test::GetGlobalMetricsLogger());
|
||||
video_quality_analyzer_ = video_quality_analyzer.get();
|
||||
fixture_ = CreatePeerConnectionE2EQualityTestFixture(
|
||||
testing::UnitTest::GetInstance()->current_test_info()->name(),
|
||||
|
@ -185,7 +185,7 @@ TEST_F(PeerConnectionE2EQualityTestSmokeTest, MAYBE_Smoke) {
|
|||
std::map<std::string, std::vector<EmulatedEndpoint*>>(
|
||||
{{"alice", network_links.first->endpoints()},
|
||||
{"charlie", network_links.second->endpoints()}}),
|
||||
network_emulation(), test::GetGlobalMetricsLoggerAndExporter()));
|
||||
network_emulation(), test::GetGlobalMetricsLogger()));
|
||||
RunParams run_params(TimeDelta::Seconds(2));
|
||||
run_params.enable_flex_fec_support = true;
|
||||
RunAndCheckEachVideoStreamReceivedFrames(run_params);
|
||||
|
@ -237,7 +237,7 @@ TEST_F(PeerConnectionE2EQualityTestSmokeTest, SmokeH264) {
|
|||
std::map<std::string, std::vector<EmulatedEndpoint*>>(
|
||||
{{"alice", network_links.first->endpoints()},
|
||||
{"charlie", network_links.second->endpoints()}}),
|
||||
network_emulation(), test::GetGlobalMetricsLoggerAndExporter()));
|
||||
network_emulation(), test::GetGlobalMetricsLogger()));
|
||||
RunParams run_params(TimeDelta::Seconds(2));
|
||||
run_params.enable_flex_fec_support = true;
|
||||
RunAndCheckEachVideoStreamReceivedFrames(run_params);
|
||||
|
@ -304,7 +304,7 @@ TEST_F(PeerConnectionE2EQualityTestSmokeTest, MAYBE_ChangeNetworkConditions) {
|
|||
std::map<std::string, std::vector<EmulatedEndpoint*>>(
|
||||
{{"alice", alice_network->endpoints()},
|
||||
{"bob", bob_network->endpoints()}}),
|
||||
network_emulation(), test::GetGlobalMetricsLoggerAndExporter()));
|
||||
network_emulation(), test::GetGlobalMetricsLogger()));
|
||||
|
||||
fixture()->ExecuteAt(TimeDelta::Seconds(1), [alice_node](TimeDelta) {
|
||||
BuiltInNetworkBehaviorConfig config;
|
||||
|
|
|
@ -157,6 +157,8 @@ class TestMainImpl : public TestMain {
|
|||
rtc::test::RunTestsFromIOSApp();
|
||||
int exit_code = 0;
|
||||
#else
|
||||
int exit_code = RUN_ALL_TESTS();
|
||||
|
||||
std::vector<std::unique_ptr<test::MetricsExporter>> exporters;
|
||||
if (absl::GetFlag(FLAGS_export_perf_results_new_api)) {
|
||||
exporters.push_back(std::make_unique<test::StdoutMetricsExporter>());
|
||||
|
@ -169,11 +171,8 @@ class TestMainImpl : public TestMain {
|
|||
exporters.push_back(
|
||||
std::make_unique<test::PrintResultProxyMetricsExporter>());
|
||||
}
|
||||
test::SetupGlobalMetricsLoggerAndExporter(std::move(exporters));
|
||||
|
||||
int exit_code = RUN_ALL_TESTS();
|
||||
|
||||
test::ExportAndDestroyGlobalMetricsLoggerAndExporter();
|
||||
test::ExportPerfMetric(*test::GetGlobalMetricsLogger(),
|
||||
std::move(exporters));
|
||||
if (!absl::GetFlag(FLAGS_export_perf_results_new_api)) {
|
||||
std::string perf_output_file =
|
||||
absl::GetFlag(FLAGS_isolated_script_test_perf_output);
|
||||
|
|
Loading…
Reference in a new issue