Make iOS tests read --webrtc_test_metrics_output_path.

Differently from the ChromePerfDashboardMetricsExporter, this new flag
doesn't default to storing the output file to NSDocumentDirectory (and
with a default name, for example perftest-output.pb) but instead
just stores the file at the location specified by --webrtc_test_metrics_output_path.

Bug: b/237982523
Change-Id: Ibb504fdbc94ca5179f4b3da5b06d8cea82140140
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/286280
Reviewed-by: Jeremy Leconte <jleconte@google.com>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38807}
This commit is contained in:
Mirko Bonadei 2022-12-05 09:18:27 +01:00 committed by WebRTC LUCI CQ
parent 1b80be352b
commit b6e8c2e393
4 changed files with 15 additions and 4 deletions

View File

@ -332,6 +332,7 @@ if (is_ios) {
"../api/test/metrics:chrome_perf_dashboard_metrics_exporter",
"../api/test/metrics:global_metrics_logger_and_exporter",
"../api/test/metrics:metrics_exporter",
"../api/test/metrics:metrics_set_proto_file_exporter",
"../api/test/metrics:print_result_proxy_metrics_exporter",
"../api/test/metrics:stdout_metrics_exporter",
"../sdk:helpers_objc",

View File

@ -27,6 +27,7 @@ void InitTestSuite(int (*test_suite)(void),
char* argv[],
bool save_chartjson_result,
bool export_perf_results_new_api,
std::string webrtc_test_metrics_output_path,
absl::optional<std::vector<std::string>> metrics_to_plot);
// Returns true if unittests should be run by the XCTest runnner.

View File

@ -13,6 +13,7 @@
#include "api/test/metrics/chrome_perf_dashboard_metrics_exporter.h"
#include "api/test/metrics/global_metrics_logger_and_exporter.h"
#include "api/test/metrics/metrics_exporter.h"
#include "api/test/metrics/metrics_set_proto_file_exporter.h"
#include "api/test/metrics/print_result_proxy_metrics_exporter.h"
#include "api/test/metrics/stdout_metrics_exporter.h"
#include "test/ios/coverage_util_ios.h"
@ -44,6 +45,7 @@ static int g_argc;
static char **g_argv;
static bool g_write_perf_output;
static bool g_export_perf_results_new_api;
static std::string g_webrtc_test_metrics_output_path;
static absl::optional<bool> g_is_xctest;
static absl::optional<std::vector<std::string>> g_metrics_to_plot;
@ -110,6 +112,10 @@ static absl::optional<std::vector<std::string>> g_metrics_to_plot;
[NSString stdStringForString:outputPath]));
}
}
if (!g_webrtc_test_metrics_output_path.empty()) {
exporters.push_back(std::make_unique<webrtc::test::MetricsSetProtoFileExporter>(
webrtc::test::MetricsSetProtoFileExporter::Options(g_webrtc_test_metrics_output_path)));
}
} else {
exporters.push_back(std::make_unique<webrtc::test::PrintResultProxyMetricsExporter>());
}
@ -167,12 +173,14 @@ void InitTestSuite(int (*test_suite)(void),
char *argv[],
bool write_perf_output,
bool export_perf_results_new_api,
std::string webrtc_test_metrics_output_path,
absl::optional<std::vector<std::string>> metrics_to_plot) {
g_test_suite = test_suite;
g_argc = argc;
g_argv = argv;
g_write_perf_output = write_perf_output;
g_export_perf_results_new_api = export_perf_results_new_api;
g_webrtc_test_metrics_output_path = webrtc_test_metrics_output_path;
g_metrics_to_plot = std::move(metrics_to_plot);
}

View File

@ -184,10 +184,11 @@ class TestMainImpl : public TestMain {
}
#if defined(WEBRTC_IOS)
rtc::test::InitTestSuite(RUN_ALL_TESTS, argc, argv,
absl::GetFlag(FLAGS_write_perf_output_on_ios),
absl::GetFlag(FLAGS_export_perf_results_new_api),
metrics_to_plot);
rtc::test::InitTestSuite(
RUN_ALL_TESTS, argc, argv,
absl::GetFlag(FLAGS_write_perf_output_on_ios),
absl::GetFlag(FLAGS_export_perf_results_new_api),
absl::GetFlag(FLAGS_webrtc_test_metrics_output_path), metrics_to_plot);
rtc::test::RunTestsFromIOSApp();
int exit_code = 0;
#else