From f711428898cb2f03d4d09738ba751cf0d316c631 Mon Sep 17 00:00:00 2001 From: Edward Lemur Date: Mon, 11 Dec 2017 17:21:46 +0100 Subject: [PATCH] Use std::fstream instead of rtc::File to write perf results + rename flag. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use std::fstream instead of rtc::File to write perf results. On Android, when I use rtc::File, the results are not written for some reason. Also rename the flag to '--chartjson_result_file'. Bug: webrtc:8566 Change-Id: I32215e2233e18690c41050dfd35ac77e01d11f35 Reviewed-on: https://webrtc-review.googlesource.com/32001 Reviewed-by: Patrik Höglund Commit-Queue: Edward Lemur Cr-Commit-Position: refs/heads/master@{#21225} --- test/test_main.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/test_main.cc b/test/test_main.cc index 5023ae6558..c6c00c599d 100644 --- a/test/test_main.cc +++ b/test/test_main.cc @@ -8,7 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "rtc_base/file.h" +#include + #include "rtc_base/flags.h" #include "rtc_base/logging.h" #include "system_wrappers/include/metrics_default.h" @@ -35,7 +36,7 @@ DEFINE_string(force_fieldtrials, "", " will assign the group Enable to field trial WebRTC-FooFeature."); DEFINE_string( - perf_results_json_path, + chartjson_result_file, "", "Path where the perf results should be stored it the JSON format described " "by " @@ -73,13 +74,12 @@ int main(int argc, char* argv[]) { int exit_code = RUN_ALL_TESTS(); - std::string perf_results_json_path = FLAG_perf_results_json_path; - if (perf_results_json_path != "") { + std::string chartjson_result_file = FLAG_chartjson_result_file; + if (chartjson_result_file != "") { std::string json_results = webrtc::test::GetPerfResultsJSON(); - rtc::File json_file = rtc::File::Open(perf_results_json_path); - json_file.Write(reinterpret_cast(json_results.c_str()), - json_results.size()); - json_file.Close(); + std::fstream json_file(chartjson_result_file, std::fstream::out); + json_file << json_results; + json_file.close(); } return exit_code;