v8/tools/testrunner/trycatch_loader.js
Michael Achenbach f4411a32cd [test] Properly load mjsunit.js on endurance fuzzer
Load mjsunit.js inside the realm as otherwise the functions are not
available in the realm's scope.

This also prints timestamps after each test to easier track down slow
tests.

We also pass --omit-quit to not stop too early.

This also adds the ability to skip certain tests for endurance
fuzzing and skips some tests with known problems.

TBR=ulan@chromium.org,hpayer@chromium.org

Bug: v8:6972, v8:7400
Change-Id: I44464c28bfb10c84f2e59972e7b86945a47ca3b3
Reviewed-on: https://chromium-review.googlesource.com/899008
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51066}
2018-02-02 13:55:32 +00:00

43 lines
1.3 KiB
JavaScript

// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Wrapper loading javascript tests passed as arguments used by gc fuzzer.
// It ignores all exceptions and run tests in a separate namespaces.
//
// It can't prevent %AbortJS function from aborting execution, so it should be
// used with d8's --disable-abortjs flag to ignore all possible errors inside
// tests.
// We use -- as an additional separator for test preamble files and test files.
// The preamble files (before --) will be loaded in each realm before each
// test.
var separator = arguments.indexOf("--")
var preamble = arguments.slice(0, separator)
var tests = arguments.slice(separator + 1)
var preambleString = ""
for (let jstest of preamble) {
preambleString += "load(\"" + jstest + "\");"
}
for (let jstest of tests) {
print("Loading " + jstest);
let start = performance.now();
// anonymous function to not populate global namespace.
(function () {
let realm = Realm.create();
try {
Realm.eval(realm, preambleString + "load(\"" + jstest + "\");");
} catch (err) {
// ignore all errors
}
Realm.dispose(realm);
})();
let durationSec = ((performance.now() - start) / 1000.0).toFixed(2);
print("Duration " + durationSec + "s");
}