1// Copyright 2018 the V8 project authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5 6// Wrapper loading javascript tests passed as arguments used by gc fuzzer. 7// It ignores all exceptions and run tests in a separate namespaces. 8// 9// It can't prevent %AbortJS function from aborting execution, so it should be 10// used with d8's --disable-abortjs flag to ignore all possible errors inside 11// tests. 12 13// We use -- as an additional separator for test preamble files and test files. 14// The preamble files (before --) will be loaded in each realm before each 15// test. 16var separator = arguments.indexOf("--") 17var preamble = arguments.slice(0, separator) 18var tests = arguments.slice(separator + 1) 19 20var preambleString = "" 21for (let jstest of preamble) { 22 preambleString += "load(\"" + jstest + "\");" 23} 24 25for (let jstest of tests) { 26 print("Loading " + jstest); 27 let start = performance.now(); 28 29 // anonymous function to not populate global namespace. 30 (function () { 31 let realm = Realm.create(); 32 try { 33 Realm.eval(realm, preambleString + "load(\"" + jstest + "\");"); 34 } catch (err) { 35 // ignore all errors 36 } 37 Realm.dispose(realm); 38 })(); 39 40 let durationSec = ((performance.now() - start) / 1000.0).toFixed(2); 41 print("Duration " + durationSec + "s"); 42} 43