Fix export of plottable metrics on iOS
Bug: None Change-Id: I12c3cecb92e5f163f9451d6f90de3bce9b15bca1 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168942 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30580}
This commit is contained in:
@ -261,6 +261,7 @@ if (is_ios) {
|
|||||||
deps = [
|
deps = [
|
||||||
":perf_test",
|
":perf_test",
|
||||||
"../sdk:helpers_objc",
|
"../sdk:helpers_objc",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
configs += [ ":test_support_objc_config" ]
|
configs += [ ":test_support_objc_config" ]
|
||||||
}
|
}
|
||||||
@ -394,6 +395,8 @@ if (rtc_include_tests) {
|
|||||||
"../system_wrappers:metrics",
|
"../system_wrappers:metrics",
|
||||||
"//third_party/abseil-cpp/absl/flags:flag",
|
"//third_party/abseil-cpp/absl/flags:flag",
|
||||||
"//third_party/abseil-cpp/absl/flags:parse",
|
"//third_party/abseil-cpp/absl/flags:parse",
|
||||||
|
"//third_party/abseil-cpp/absl/memory",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,11 @@
|
|||||||
#ifndef TEST_IOS_TEST_SUPPORT_H_
|
#ifndef TEST_IOS_TEST_SUPPORT_H_
|
||||||
#define TEST_IOS_TEST_SUPPORT_H_
|
#define TEST_IOS_TEST_SUPPORT_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
|
|
||||||
namespace rtc {
|
namespace rtc {
|
||||||
namespace test {
|
namespace test {
|
||||||
// Launches an iOS app that serves as a host for a test suite.
|
// Launches an iOS app that serves as a host for a test suite.
|
||||||
@ -20,7 +25,8 @@ void RunTestsFromIOSApp();
|
|||||||
void InitTestSuite(int (*test_suite)(void),
|
void InitTestSuite(int (*test_suite)(void),
|
||||||
int argc,
|
int argc,
|
||||||
char* argv[],
|
char* argv[],
|
||||||
bool save_chartjson_result);
|
bool save_chartjson_result,
|
||||||
|
absl::optional<std::vector<std::string>> metrics_to_plot);
|
||||||
|
|
||||||
} // namespace test
|
} // namespace test
|
||||||
} // namespace rtc
|
} // namespace rtc
|
||||||
|
@ -34,6 +34,7 @@ static int (*g_test_suite)(void) = NULL;
|
|||||||
static int g_argc;
|
static int g_argc;
|
||||||
static char **g_argv;
|
static char **g_argv;
|
||||||
static bool g_save_chartjson_result;
|
static bool g_save_chartjson_result;
|
||||||
|
static absl::optional<std::vector<std::string>> g_metrics_to_plot;
|
||||||
|
|
||||||
@interface UIApplication (Testing)
|
@interface UIApplication (Testing)
|
||||||
- (void)_terminateWithStatus:(int)status;
|
- (void)_terminateWithStatus:(int)status;
|
||||||
@ -88,6 +89,9 @@ static bool g_save_chartjson_result;
|
|||||||
[NSString stdStringForString:outputPath]);
|
[NSString stdStringForString:outputPath]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (g_metrics_to_plot) {
|
||||||
|
webrtc::test::PrintPlottableResults(*g_metrics_to_plot);
|
||||||
|
}
|
||||||
|
|
||||||
// If a test app is too fast, it will exit before Instruments has has a
|
// If a test app is too fast, it will exit before Instruments has has a
|
||||||
// a chance to initialize and no test results will be seen.
|
// a chance to initialize and no test results will be seen.
|
||||||
@ -109,12 +113,16 @@ namespace test {
|
|||||||
|
|
||||||
// Note: This is not thread safe, and must be called from the same thread as
|
// Note: This is not thread safe, and must be called from the same thread as
|
||||||
// runTests above.
|
// runTests above.
|
||||||
void InitTestSuite(int (*test_suite)(void), int argc, char *argv[],
|
void InitTestSuite(int (*test_suite)(void),
|
||||||
bool save_chartjson_result) {
|
int argc,
|
||||||
|
char *argv[],
|
||||||
|
bool save_chartjson_result,
|
||||||
|
absl::optional<std::vector<std::string>> metrics_to_plot) {
|
||||||
g_test_suite = test_suite;
|
g_test_suite = test_suite;
|
||||||
g_argc = argc;
|
g_argc = argc;
|
||||||
g_argv = argv;
|
g_argv = argv;
|
||||||
g_save_chartjson_result = save_chartjson_result;
|
g_save_chartjson_result = save_chartjson_result;
|
||||||
|
g_metrics_to_plot = std::move(metrics_to_plot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunTestsFromIOSApp() {
|
void RunTestsFromIOSApp() {
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
#include "absl/flags/flag.h"
|
#include "absl/flags/flag.h"
|
||||||
#include "absl/flags/parse.h"
|
#include "absl/flags/parse.h"
|
||||||
|
#include "absl/memory/memory.h"
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "rtc_base/checks.h"
|
#include "rtc_base/checks.h"
|
||||||
#include "rtc_base/event_tracer.h"
|
#include "rtc_base/event_tracer.h"
|
||||||
#include "rtc_base/logging.h"
|
#include "rtc_base/logging.h"
|
||||||
@ -69,6 +71,7 @@ ABSL_FLAG(
|
|||||||
"by "
|
"by "
|
||||||
"https://github.com/catapult-project/catapult/blob/master/dashboard/docs/"
|
"https://github.com/catapult-project/catapult/blob/master/dashboard/docs/"
|
||||||
"data-format.md.");
|
"data-format.md.");
|
||||||
|
#endif
|
||||||
|
|
||||||
constexpr char kPlotAllMetrics[] = "all";
|
constexpr char kPlotAllMetrics[] = "all";
|
||||||
ABSL_FLAG(std::vector<std::string>,
|
ABSL_FLAG(std::vector<std::string>,
|
||||||
@ -78,8 +81,6 @@ ABSL_FLAG(std::vector<std::string>,
|
|||||||
"available). Example: psnr,ssim,encode_time. To plot all available "
|
"available). Example: psnr,ssim,encode_time. To plot all available "
|
||||||
" metrics pass 'all' as flag value");
|
" metrics pass 'all' as flag value");
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ABSL_FLAG(bool, logs, true, "print logs to stderr");
|
ABSL_FLAG(bool, logs, true, "print logs to stderr");
|
||||||
ABSL_FLAG(bool, verbose, false, "verbose logs to stderr");
|
ABSL_FLAG(bool, verbose, false, "verbose logs to stderr");
|
||||||
|
|
||||||
@ -156,9 +157,22 @@ class TestMainImpl : public TestMain {
|
|||||||
rtc::tracing::StartInternalCapture(trace_event_path.c_str());
|
rtc::tracing::StartInternalCapture(trace_event_path.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
absl::optional<std::vector<std::string>> metrics_to_plot =
|
||||||
|
absl::GetFlag(FLAGS_plot);
|
||||||
|
|
||||||
|
if (metrics_to_plot->empty()) {
|
||||||
|
metrics_to_plot = absl::nullopt;
|
||||||
|
} else {
|
||||||
|
if (metrics_to_plot->size() == 1 &&
|
||||||
|
(*metrics_to_plot)[0] == kPlotAllMetrics) {
|
||||||
|
metrics_to_plot->clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(WEBRTC_IOS)
|
#if defined(WEBRTC_IOS)
|
||||||
rtc::test::InitTestSuite(RUN_ALL_TESTS, argc, argv,
|
rtc::test::InitTestSuite(RUN_ALL_TESTS, argc, argv,
|
||||||
absl::GetFlag(FLAGS_save_chartjson_result));
|
absl::GetFlag(FLAGS_save_chartjson_result),
|
||||||
|
metrics_to_plot);
|
||||||
rtc::test::RunTestsFromIOSApp();
|
rtc::test::RunTestsFromIOSApp();
|
||||||
int exit_code = 0;
|
int exit_code = 0;
|
||||||
#else
|
#else
|
||||||
@ -169,13 +183,8 @@ class TestMainImpl : public TestMain {
|
|||||||
if (!chartjson_result_file.empty()) {
|
if (!chartjson_result_file.empty()) {
|
||||||
webrtc::test::WritePerfResults(chartjson_result_file);
|
webrtc::test::WritePerfResults(chartjson_result_file);
|
||||||
}
|
}
|
||||||
std::vector<std::string> metrics_to_plot = absl::GetFlag(FLAGS_plot);
|
if (metrics_to_plot) {
|
||||||
if (!metrics_to_plot.empty()) {
|
webrtc::test::PrintPlottableResults(*metrics_to_plot);
|
||||||
if (metrics_to_plot.size() == 1 &&
|
|
||||||
metrics_to_plot[0] == kPlotAllMetrics) {
|
|
||||||
metrics_to_plot.clear();
|
|
||||||
}
|
|
||||||
webrtc::test::PrintPlottableResults(metrics_to_plot);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string result_filename =
|
std::string result_filename =
|
||||||
|
Reference in New Issue
Block a user