Commit cd658fd2 authored by Camillo Bruni's avatar Camillo Bruni Committed by V8 LUCI CQ

[mjsunit] Fix tmp log files for --log tests

https://crrev.com/c/2972915 previously added more gitignore files to the
repository. This left the repo dirty after running mjsunit tests due to
lingering .log files.

- Add test/mjsunit/tools/tmp dir to keep and ignore temporary log files
  without the need for a platform specific tmp dir
- Use temporary logfiles with --logfile=+ for log-ci.js tests

Change-Id: I1b1a47f45603d6c3027c6ca7050c78e8df0664ce
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2992720Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75451}
parent 58406c76
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --log-ic --logfile=test/mjsunit/tools/log-ic-test.log // Flags: --log-ic --logfile='+' --allow-natives-syntax
// Flags: --allow-natives-syntax
// The idea behind this test is to make sure we do not crash when using the // The idea behind this test is to make sure we do not crash when using the
// --log-ic flag. // --log-ic flag.
......
...@@ -470,35 +470,35 @@ function testTickProcessor(logInput, refOutput, args=[]) { ...@@ -470,35 +470,35 @@ function testTickProcessor(logInput, refOutput, args=[]) {
// /foo/bar/tickprocesser.mjs => /foo/bar/ // /foo/bar/tickprocesser.mjs => /foo/bar/
const dir = import.meta.url.split("/").slice(0, -1).join('/') + '/'; const dir = import.meta.url.split("/").slice(0, -1).join('/') + '/';
const params = ArgumentsProcessor.process(args); const params = ArgumentsProcessor.process(args);
testExpectations(dir + logInput, dir + refOutput, params); testExpectations(dir, logInput, refOutput, params);
// TODO(cbruni): enable again after it works on bots // TODO(cbruni): enable again after it works on bots
// testEndToEnd(dir + 'tickprocessor-test-large.js', dir + refOutput, params); // testEndToEnd(dir, 'tickprocessor-test-large.js', refOutput, params);
} }
function testExpectations(logInput, refOutput, params) { function testExpectations(dir, logInput, refOutput, params) {
const symbolsFile = logInput + '.symbols.json'; const symbolsFile = dir + logInput + '.symbols.json';
const cppEntries = new CppEntriesProviderMock(symbolsFile); const cppEntries = new CppEntriesProviderMock(symbolsFile);
const tickProcessor = TickProcessor.fromParams(params, cppEntries); const tickProcessor = TickProcessor.fromParams(params, cppEntries);
const printMonitor = new PrintMonitor(refOutput); const printMonitor = new PrintMonitor(dir + refOutput);
tickProcessor.processLogFileInTest(logInput); tickProcessor.processLogFileInTest(dir + logInput);
tickProcessor.printStatistics(); tickProcessor.printStatistics();
printMonitor.finish(); printMonitor.finish();
}; };
function testEndToEnd(sourceFile, ignoredRefOutput, params) { function testEndToEnd(dir, sourceFile, ignoredRefOutput, params) {
// This test only works on linux. // This test only works on linux.
if (!os?.system) return; if (!os?.system) return;
if (os.name !== 'linux' && os.name !== 'macos') return; if (os.name !== 'linux' && os.name !== 'macos') return;
params.platform = os.name; params.platform = os.name;
const tmpLogFile= `/var/tmp/${Date.now()}.v8.log` const tmpLogFile= `/var/tmp/${Date.now()}.v8.log`
const result = os.system( const result = os.system(
os.d8Path, ['--prof', `--logfile=${tmpLogFile}`, sourceFile]); os.d8Path, ['--prof', `--logfile=${tmpLogFile}`, dir + sourceFile]);
const tickProcessor = TickProcessor.fromParams(params); const tickProcessor = TickProcessor.fromParams(params);
// We will not always get the same ticks due to timing on bots, // We will not always get the same ticks due to timing on bots,
// hence we cannot properly compare output expectations. // hence we cannot properly compare output expectations.
// Let's just use a dummy file and only test whether we don't throw. // Let's just use a dummy file and only test whether we don't throw.
const printMonitor = new PrintMonitor(ignoredRefOutput); const printMonitor = new PrintMonitor(dir + ignoredRefOutput);
tickProcessor.processLogFileInTest(tmpLogFile); tickProcessor.processLogFileInTest(tmpLogFile);
tickProcessor.printStatistics(); tickProcessor.printStatistics();
} }
\ No newline at end of file
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