[log][d8] Only use d8.log.getAndStop on temporary log file

We run tests in parallel which can cause multiple tests to write to
the shared v8.log file. This obviously breaks the simple assertions in
mjsunit/tools/log.js.

- Use temporary files for log testing with --logfile='+'

- Change the symbol from '&' to '+' for using temporary files for
  logging with --logfile

- Enable skipped log tests again.

Bug: v8:10937, chromium:1129854, chromium:1130196
Change-Id: I607dc9a9ecc352e58525cdd21c1c93efebf0f09f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2421826
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70071}
This commit is contained in:
Camillo Bruni 2020-09-22 12:16:22 +02:00 committed by Commit Bot
parent 9c89f33a85
commit 21bb43cc6a
5 changed files with 7 additions and 9 deletions

View File

@ -1511,8 +1511,8 @@ void Shell::LogGetAndStop(const v8::FunctionCallbackInfo<v8::Value>& args) {
HandleScope handle_scope(isolate);
std::string file_name = i_isolate->logger()->file_name();
if (i::Log::IsLoggingToConsole(file_name)) {
Throw(isolate, "Logging to console instead of file.");
if (!i::Log::IsLoggingToTemporaryFile(file_name)) {
Throw(isolate, "Only capturing from temporary files is supported.");
return;
}
if (!i_isolate->logger()->is_logging()) {

View File

@ -1660,7 +1660,9 @@ DEFINE_BOOL(trace_wasm_gdb_remote, false, "trace Webassembly GDB-remote server")
#define FLAG FLAG_FULL
// log.cc
DEFINE_STRING(logfile, "v8.log", "Specify the name of the log file.")
DEFINE_STRING(logfile, "v8.log",
"Specify the name of the log file, use '-' for console, '+' for "
"a temporary file.")
DEFINE_BOOL(logfile_per_isolate, true, "Separate log files for each isolate.")
DEFINE_BOOL(log, false,

View File

@ -19,7 +19,7 @@
namespace v8 {
namespace internal {
const char* const Log::kLogToTemporaryFile = "&";
const char* const Log::kLogToTemporaryFile = "+";
const char* const Log::kLogToConsole = "-";
// static

View File

@ -182,10 +182,6 @@
# Needs to be adapted after changes to Function constructor. chromium:1065094
'cross-realm-filtering': [SKIP],
# https://crbug.com/v8/10937
# https://crbug.com/1129854
'tools/log': [SKIP],
}], # ALWAYS
##############################################################################

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --log-all --log --no-stress-opt
// Flags: --logfile='+' --log-all --log --no-stress-opt
function testFunctionWithFunnyName(o) {
return o.a;