2018-01-25 15:18:29 +00:00
|
|
|
// 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.
|
2018-02-02 12:51:25 +00:00
|
|
|
|
|
|
|
// 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) {
|
2018-01-25 15:18:29 +00:00
|
|
|
print("Loading " + jstest);
|
2018-02-02 12:51:25 +00:00
|
|
|
let start = performance.now();
|
2018-01-25 15:18:29 +00:00
|
|
|
|
|
|
|
// anonymous function to not populate global namespace.
|
|
|
|
(function () {
|
2018-01-27 14:33:02 +00:00
|
|
|
let realm = Realm.create();
|
2018-01-25 15:18:29 +00:00
|
|
|
try {
|
2018-02-02 12:51:25 +00:00
|
|
|
Realm.eval(realm, preambleString + "load(\"" + jstest + "\");");
|
2018-01-25 15:18:29 +00:00
|
|
|
} catch (err) {
|
|
|
|
// ignore all errors
|
|
|
|
}
|
2018-01-27 14:33:02 +00:00
|
|
|
Realm.dispose(realm);
|
2018-01-25 15:18:29 +00:00
|
|
|
})();
|
2018-02-02 12:51:25 +00:00
|
|
|
|
|
|
|
let durationSec = ((performance.now() - start) / 1000.0).toFixed(2);
|
|
|
|
print("Duration " + durationSec + "s");
|
2018-01-25 15:18:29 +00:00
|
|
|
}
|