2024-01-02 06:47:40 +00:00
|
|
|
import * as std from "std"
|
|
|
|
import * as os from "os"
|
|
|
|
|
|
|
|
argv0 = realpath(argv0)
|
|
|
|
const tweak = realpath("v8-tweak.js")
|
|
|
|
const dir = "test262/implementation-contributed/v8/mjsunit"
|
|
|
|
|
|
|
|
const exclude = [
|
2024-03-10 16:04:06 +00:00
|
|
|
"arguments-indirect.js", // implementation-defined
|
2024-01-02 06:47:40 +00:00
|
|
|
"array-concat.js", // slow
|
|
|
|
"array-isarray.js", // unstable output due to stack overflow
|
2024-03-15 09:49:33 +00:00
|
|
|
"array-join.js", // unstable output due to stack overflow
|
2024-01-02 06:47:40 +00:00
|
|
|
"ascii-regexp-subject.js", // slow
|
2024-03-10 16:04:06 +00:00
|
|
|
"asm-directive.js", // v8 specific
|
|
|
|
"disallow-codegen-from-strings.js", // --disallow-code-generation-from-strings
|
2024-01-02 06:47:40 +00:00
|
|
|
"cyclic-array-to-string.js", // unstable output due to stack overflow
|
|
|
|
"error-tostring.js", // unstable output due to stack overflow
|
2024-03-30 12:11:37 +00:00
|
|
|
"invalid-lhs.js", // v8 expects ReferenceError but ECMA says SyntaxError
|
2024-01-02 06:47:40 +00:00
|
|
|
"regexp.js", // invalid, legitimate early SyntaxError
|
|
|
|
"regexp-capture-3.js", // slow
|
2024-03-30 12:11:37 +00:00
|
|
|
"regexp-cache-replace.js", // deprecated RegExp.$1 etc.
|
2024-03-10 16:04:06 +00:00
|
|
|
"regexp-indexof.js", // deprecated RegExp.lastMatch etc.
|
|
|
|
"regexp-static.js", // deprecated RegExp static properties.
|
2024-03-30 12:11:37 +00:00
|
|
|
"regexp-modifiers-autogenerated-i18n.js", // invalid group
|
|
|
|
"regexp-modifiers-autogenerated.js", // invalid group
|
|
|
|
"regexp-modifiers-dotall.js", // invalid group
|
|
|
|
"regexp-modifiers-i18n.js", // invalid group
|
|
|
|
"regexp-modifiers.js", // invalid group
|
|
|
|
"regexp-override-symbol-match-all.js", // missing g flag
|
|
|
|
"serialize-embedded-error.js", // parseInt() = 0;
|
2024-01-02 06:47:40 +00:00
|
|
|
"string-replace.js", // unstable output
|
2024-03-30 12:11:37 +00:00
|
|
|
"string-match.js", // deprecated RegExp.$1 etc.
|
|
|
|
"string-slices-regexp.js", // deprecated RegExp.$1 etc.
|
2024-03-22 10:19:36 +00:00
|
|
|
"omit-default-ctors-array-iterator.js",
|
2024-01-02 06:47:40 +00:00
|
|
|
|
|
|
|
"mjsunit.js",
|
2024-03-22 10:19:36 +00:00
|
|
|
"mjsunit-assertion-error.js",
|
|
|
|
"mjsunit-assert-equals.js",
|
2024-01-02 06:47:40 +00:00
|
|
|
"mjsunit_suppressions.js",
|
|
|
|
|
|
|
|
"verify-assert-false.js", // self check
|
|
|
|
"verify-check-false.js", // self check
|
2024-03-22 10:19:36 +00:00
|
|
|
|
|
|
|
"clone-ic-regression-crbug-1466315.js", // spurious output
|
2024-01-02 06:47:40 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
let files = scriptArgs.slice(1) // run only these tests
|
|
|
|
if (files.length === 0) files = os.readdir(dir)[0].sort()
|
|
|
|
|
|
|
|
for (const file of files) {
|
|
|
|
if (!file.endsWith(".js")) continue
|
|
|
|
if (exclude.includes(file)) continue
|
|
|
|
const source = std.loadFile(dir + "/" + file)
|
|
|
|
if (/^(im|ex)port/m.test(source)) continue // TODO support modules
|
2024-03-22 10:19:36 +00:00
|
|
|
if (source.includes('Realm.create')) continue // TODO support Realm object
|
2024-03-10 16:04:06 +00:00
|
|
|
if (source.includes('// MODULE')) continue // TODO support modules
|
2024-01-02 06:47:40 +00:00
|
|
|
if (source.includes('// Files:')) continue // TODO support includes
|
2024-03-14 07:19:11 +00:00
|
|
|
|
|
|
|
// the default --stack-size is necessary to keep output of stack overflowing
|
|
|
|
// tests stable; it will be overridden by a Flags comment
|
|
|
|
let flags = { '--stack-size': 2048 }, flagstr = ""
|
|
|
|
// parse command line flags
|
|
|
|
for (let s of source.matchAll(/\/\/ Flags:(.+)/g)) {
|
|
|
|
for (let m of s[1].matchAll(/\s*([\S]+)/g)) {
|
|
|
|
const v = m[1].match(/([\S]+)=([\S]+)/)
|
|
|
|
if (v) {
|
|
|
|
flags[v[1]] = v[2]
|
|
|
|
flagstr += ` ${v[1]}=${v[2]}`
|
|
|
|
} else {
|
|
|
|
flags[m[1]] = true
|
|
|
|
flagstr += ` ${m[1]}`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-01-02 06:47:40 +00:00
|
|
|
// exclude tests that use V8 intrinsics like %OptimizeFunctionOnNextCall
|
2024-03-14 07:19:11 +00:00
|
|
|
if (flags["--allow-natives-syntax"]) continue
|
2024-03-22 10:19:36 +00:00
|
|
|
if (flags["--allow-natives-for-differential-fuzzing"]) continue
|
|
|
|
if (flags["--dump-counters"]) continue
|
|
|
|
if (flags["--expose-cputracemark"]) continue
|
|
|
|
if (flags["--harmony-rab-gsab"]) continue
|
|
|
|
if (flags["--harmony-class-fields"]) continue
|
|
|
|
if (flags["--enable-experimental-regexp-engine"]) continue
|
|
|
|
if (flags["--experimental-stack-trace-frames"]) continue
|
|
|
|
if (flags["--js-float16array"]) continue
|
|
|
|
if (flags["--expose-cputracemark-as"]) continue
|
2024-01-02 06:47:40 +00:00
|
|
|
// exclude tests that use V8 extensions
|
2024-03-14 07:19:11 +00:00
|
|
|
if (flags["--expose-externalize-string"]) continue
|
|
|
|
// parse environment variables
|
2024-03-10 09:34:26 +00:00
|
|
|
let env = {}, envstr = ""
|
|
|
|
for (let s of source.matchAll(/environment variables:(.+)/ig)) {
|
|
|
|
for (let m of s[1].matchAll(/\s*([\S]+)=([\S]+)/g)) {
|
|
|
|
env[m[1]] = m[2]
|
|
|
|
envstr += ` ${m[1]}=${m[2]}`
|
|
|
|
}
|
|
|
|
}
|
2024-03-14 07:19:11 +00:00
|
|
|
//print(`=== ${file}${envstr}${flagstr}`)
|
2024-03-10 09:34:26 +00:00
|
|
|
print(`=== ${file}${envstr}`)
|
2024-03-14 07:19:11 +00:00
|
|
|
const args = [argv0,
|
2024-04-23 12:37:57 +00:00
|
|
|
"--stack-size", `${flags["--stack-size"]}`,
|
2024-03-14 07:19:11 +00:00
|
|
|
"-I", "mjsunit.js",
|
|
|
|
"-I", tweak,
|
|
|
|
file]
|
2024-01-02 06:47:40 +00:00
|
|
|
const opts = {block:true, cwd:dir, env:env, usePath:false}
|
|
|
|
os.exec(args, opts)
|
|
|
|
}
|
|
|
|
|
|
|
|
function realpath(path) {
|
|
|
|
return os.realpath(path)[0]
|
|
|
|
}
|