Create isolated output directory when creating the output file.

Currently isolated output directory is created in flags_compatibility.py script.
This doesn't work for android swarming tasks because this script isn't called.

Bug: webrtc:11895
Change-Id: I8b8f01850d6e5970292b524d104314eef7ab17be
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/185883
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Commit-Queue: Jeremy Leconte <jleconte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32236}
This commit is contained in:
Jeremy Leconte 2020-09-29 09:26:02 +02:00 committed by Commit Bot
parent 445e6b034a
commit c5152e893e
3 changed files with 3 additions and 6 deletions

View file

@ -253,6 +253,7 @@ rtc_library("perf_test") {
"../rtc_base:logging",
"../rtc_base:rtc_numerics",
"../rtc_base/synchronization:mutex",
"../test:fileutils",
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
if (rtc_enable_protobuf) {

View file

@ -19,6 +19,7 @@
#include "rtc_base/checks.h"
#include "rtc_base/synchronization/mutex.h"
#include "test/testsupport/file_utils.h"
#include "test/testsupport/perf_test_histogram_writer.h"
namespace webrtc {
@ -221,6 +222,7 @@ void PrintPlottableResults(const std::vector<std::string>& desired_graphs) {
bool WritePerfResults(const std::string& output_path) {
std::string results = GetPerfResults();
CreateDir(DirName(output_path));
FILE* output = fopen(output_path.c_str(), "wb");
if (output == NULL) {
printf("Failed to write to %s.\n", output_path.c_str());

6
tools_webrtc/flags_compatibility.py Normal file → Executable file
View file

@ -10,7 +10,6 @@
import argparse
import logging
import os
import subprocess
import sys
@ -22,11 +21,6 @@ def main():
test_command = _ForcePythonInterpreter(unrecognized_args)
if args.isolated_script_test_perf_output:
# TODO(bugs.webrtc.org/11895): Move this code somewhere else because
# flags_compatibility.py shouldn't create output directories.
output_dirname = os.path.dirname(args.isolated_script_test_perf_output)
if not os.path.exists(output_dirname):
os.makedirs(output_dirname)
test_command += ['--isolated_script_test_perf_output=' +
args.isolated_script_test_perf_output]
logging.info('Running %r', test_command)