Commit 5c6698bf authored by Fergal Daly's avatar Fergal Daly Committed by Commit Bot

Allow --enable-tracing-output to take a directory name.

PROBLEM: It is not possible to retrieve traces from swarming with
--gtest_repeat.

For a file to be retrievable from swarming, it must be placed in
${ISOLATED_OUTDIR} but specifying anything for --enable-tracing-output
disables the unique-filename-per-test behaviour.

With this change it becomes possible to do e.g.

tools/mb/mb.py run ... \
  --gtest_filter=WebNavigationApiTest.Crash \
  --gtest_repeat=100
  --enable-tracing=*,disabled-by-default-toplevel.flow \
  --enable-tracing-output='${ISOLATED_OUTDIR}/'

and have unique files for each test that are retrievable with swarming
collect.

Also drive-by fix typo in name of function.

BUG=1043616

Change-Id: Idd1bcbbdb6f18d297170f074e9409c61204fcacb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2445649
Commit-Queue: Fergal Daly <fergal@chromium.org>
Reviewed-by: default avatarNasko Oskov <nasko@chromium.org>
Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814052}
parent 4bea273f
...@@ -408,7 +408,9 @@ const char kEnableThreadedCompositing[] = "enable-threaded-compositing"; ...@@ -408,7 +408,9 @@ const char kEnableThreadedCompositing[] = "enable-threaded-compositing";
// Enable tracing during the execution of browser tests. // Enable tracing during the execution of browser tests.
const char kEnableTracing[] = "enable-tracing"; const char kEnableTracing[] = "enable-tracing";
// The filename to write the output of the test tracing to. // The filename to write the output of the test tracing to. If it is empty
// or it ends in a directory separator then an auto-generated filename will be
// appended.
const char kEnableTracingOutput[] = "enable-tracing-output"; const char kEnableTracingOutput[] = "enable-tracing-output";
// Enable screen capturing support for MediaStream API. // Enable screen capturing support for MediaStream API.
......
...@@ -654,7 +654,7 @@ void BrowserTestBase::WaitUntilJavaIsReady(base::OnceClosure quit_closure) { ...@@ -654,7 +654,7 @@ void BrowserTestBase::WaitUntilJavaIsReady(base::OnceClosure quit_closure) {
namespace { namespace {
std::string GetDefaultTraceFileneme() { std::string GetDefaultTraceFilename() {
std::string test_suite_name = ::testing::UnitTest::GetInstance() std::string test_suite_name = ::testing::UnitTest::GetInstance()
->current_test_info() ->current_test_info()
->test_suite_name(); ->test_suite_name();
...@@ -769,10 +769,10 @@ void BrowserTestBase::ProxyRunTestOnMainThreadLoop() { ...@@ -769,10 +769,10 @@ void BrowserTestBase::ProxyRunTestOnMainThreadLoop() {
base::FilePath trace_file = base::FilePath trace_file =
base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( base::CommandLine::ForCurrentProcess()->GetSwitchValuePath(
switches::kEnableTracingOutput); switches::kEnableTracingOutput);
// If there was no file specified, put a hardcoded one in the current // If |trace_file| ends in a directory separator or is empty use a generated
// working directory. // name in that directory (empty means current directory).
if (trace_file.empty()) if (trace_file.empty() || trace_file.EndsWithSeparator())
trace_file = base::FilePath().AppendASCII(GetDefaultTraceFileneme()); trace_file = trace_file.AppendASCII(GetDefaultTraceFilename());
// Wait for tracing to collect results from the renderers. // Wait for tracing to collect results from the renderers.
base::RunLoop run_loop; base::RunLoop run_loop;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment