Remove fuzz-natives tests.

R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/663043003

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24739 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
yangguo@chromium.org 2014-10-20 12:14:26 +00:00
parent 465d643a9d
commit 7ebe9d820a
6 changed files with 7 additions and 282 deletions

View File

@ -351,50 +351,6 @@ RUNTIME_FUNCTION(Runtime_TraceExit) {
}
#ifdef DEBUG
// ListNatives is ONLY used by the fuzz-natives.js in debug mode
// Exclude the code in release mode.
RUNTIME_FUNCTION(Runtime_ListNatives) {
HandleScope scope(isolate);
DCHECK(args.length() == 0);
#define COUNT_ENTRY(Name, argc, ressize) +1
int entry_count =
0 RUNTIME_FUNCTION_LIST(COUNT_ENTRY) INLINE_FUNCTION_LIST(COUNT_ENTRY)
INLINE_OPTIMIZED_FUNCTION_LIST(COUNT_ENTRY);
#undef COUNT_ENTRY
Factory* factory = isolate->factory();
Handle<FixedArray> elements = factory->NewFixedArray(entry_count);
int index = 0;
bool inline_runtime_functions = false;
#define ADD_ENTRY(Name, argc, ressize) \
{ \
HandleScope inner(isolate); \
Handle<String> name; \
/* Inline runtime functions have an underscore in front of the name. */ \
if (inline_runtime_functions) { \
name = factory->NewStringFromStaticChars("_" #Name); \
} else { \
name = factory->NewStringFromStaticChars(#Name); \
} \
Handle<FixedArray> pair_elements = factory->NewFixedArray(2); \
pair_elements->set(0, *name); \
pair_elements->set(1, Smi::FromInt(argc)); \
Handle<JSArray> pair = factory->NewJSArrayWithElements(pair_elements); \
elements->set(index++, *pair); \
}
inline_runtime_functions = false;
RUNTIME_FUNCTION_LIST(ADD_ENTRY)
INLINE_OPTIMIZED_FUNCTION_LIST(ADD_ENTRY)
inline_runtime_functions = true;
INLINE_FUNCTION_LIST(ADD_ENTRY)
#undef ADD_ENTRY
DCHECK_EQ(index, entry_count);
Handle<JSArray> result = factory->NewJSArrayWithElements(elements);
return (*result);
}
#endif
RUNTIME_FUNCTION(Runtime_HaveSameMap) {
SealHandleScope shs(isolate);
DCHECK(args.length() == 2);

View File

@ -632,14 +632,6 @@ namespace internal {
#endif
#ifdef DEBUG
#define RUNTIME_FUNCTION_LIST_DEBUG(F) \
/* Testing */ \
F(ListNatives, 0, 1)
#else
#define RUNTIME_FUNCTION_LIST_DEBUG(F)
#endif
// ----------------------------------------------------------------------------
// RUNTIME_FUNCTION_LIST defines all runtime functions accessed
// either directly by id (via the code generator), or indirectly
@ -650,7 +642,6 @@ namespace internal {
RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \
RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \
RUNTIME_FUNCTION_LIST_ALWAYS_3(F) \
RUNTIME_FUNCTION_LIST_DEBUG(F) \
RUNTIME_FUNCTION_LIST_DEBUGGER(F) \
RUNTIME_FUNCTION_LIST_I18N_SUPPORT(F)

View File

@ -1,103 +0,0 @@
// Copyright 2014 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.
// Flags: --allow-natives-syntax
// TODO(jkummerow): There are many ways to improve these tests, e.g.:
// - more variance in randomized inputs
// - better time complexity management
// - better code readability and documentation of intentions.
var RUN_WITH_ALL_ARGUMENT_ENTRIES = false;
var kOnManyArgumentsRemove = 5;
function makeArguments() {
var result = [ ];
result.push(17);
result.push(-31);
result.push(new Array(100));
var a = %NormalizeElements([]);
a.length = 100003;
result.push(a);
result.push(Number.MIN_VALUE);
result.push("whoops");
result.push("x");
result.push({"x": 1, "y": 2});
var slowCaseObj = {"a": 3, "b": 4, "c": 5};
delete slowCaseObj.c;
result.push(slowCaseObj);
result.push(function () { return 8; });
return result;
}
var kArgObjects = makeArguments().length;
function makeFunction(name, argc) {
var args = [];
for (var i = 0; i < argc; i++)
args.push("x" + i);
var argsStr = args.join(", ");
return new Function(argsStr,
"return %" + name + "(" + argsStr + ");");
}
function testArgumentCount(name, argc) {
for (var i = 0; i < 10; i++) {
var func = null;
try {
func = makeFunction(name, i);
} catch (e) {
if (e != "SyntaxError: Illegal access") throw e;
}
if (func === null && i == argc) {
throw "unexpected exception";
}
var args = [ ];
for (var j = 0; j < i; j++)
args.push(0);
try {
func.apply(void 0, args);
} catch (e) {
// we don't care what happens as long as we don't crash
}
}
}
function testArgumentTypes(name, argc) {
var type = 0;
var hasMore = true;
var func = makeFunction(name, argc);
while (hasMore) {
var argPool = makeArguments();
// When we have 5 or more arguments we lower the amount of tests cases
// by randomly removing kOnManyArgumentsRemove entries
var numArguments = RUN_WITH_ALL_ARGUMENT_ENTRIES ?
kArgObjects : kArgObjects - kOnManyArgumentsRemove;
if (kArgObjects >= 5 && !RUN_WITH_ALL_ARGUMENT_ENTRIES) {
for (var i = 0; i < kOnManyArgumentsRemove; i++) {
var rand = Math.floor(Math.random() * (kArgObjects - i));
argPool.splice(rand, 1);
}
}
var current = type;
hasMore = false;
var argList = [ ];
for (var i = 0; i < argc; i++) {
var index = current % numArguments;
current = (current / numArguments) << 0;
if (index != (numArguments - 1))
hasMore = true;
argList.push(argPool[index]);
}
try {
func.apply(void 0, argList);
} catch (e) {
// we don't care what happens as long as we don't crash
}
type++;
}
}
testArgumentCount(NAME, ARGC);
testArgumentTypes(NAME, ARGC);

View File

@ -1,71 +0,0 @@
# Copyright 2014 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.
[
[ALWAYS, {
# These are designed to crash:
"Abort": [SKIP],
"AbortJS": [SKIP],
"SystemBreak": [SKIP],
"_DebugBreakInOptimizedCode": [SKIP],
# varargs.
"Call": [SKIP],
"_CallFunction": [SKIP],
# Implemented in the parser, not callable.
"IS_VAR": [SKIP],
# Compile-time ASSERTs.
"_DateField": [SKIP],
"_GetFromCache": [SKIP],
# Riddled with ASSERTs.
"CompileForOnStackReplacement": [SKIP],
# Too slow for fuzzing.
"SetAllocationTimeout": [SKIP],
# TODO(jkummerow): Fix these and un-blacklist them!
"CreateDateTimeFormat": [SKIP],
"CreateNumberFormat": [SKIP],
# TODO(danno): Fix these internal function that are only callable form stubs
# and un-blacklist them!
"CompileLazy": [SKIP],
"NotifyDeoptimized": [SKIP],
"NotifyStubFailure": [SKIP],
"NewSloppyArguments": [SKIP],
"NewStrictArguments": [SKIP],
"ArrayConstructor": [SKIP],
"InternalArrayConstructor": [SKIP],
"FinalizeInstanceSize": [SKIP],
"PromoteScheduledException": [SKIP],
"NewFunctionContext": [SKIP],
"PushWithContext": [SKIP],
"PushCatchContext": [SKIP],
"PushModuleContext": [SKIP],
"LoadLookupSlot": [SKIP],
"LoadLookupSlotNoReferenceError": [SKIP],
"ResolvePossiblyDirectEval": [SKIP],
"ForInInit": [SKIP],
"ForInNext": [SKIP],
# TODO(jkummerow): Figure out what to do about inlined functions.
"_GeneratorNext": [SKIP],
"_GeneratorThrow": [SKIP],
"_GetCachedArrayIndex": [SKIP],
"_HasCachedArrayIndex": [SKIP],
"_IsStringWrapperSafeForDefaultValueOf": [SKIP],
"_OneByteSeqStringSetChar": [SKIP],
"_RegExpConstructResult": [SKIP],
"_TwoByteSeqStringSetChar": [SKIP],
# These are slow.
"DebugEvaluate": [PASS, SLOW],
"DebugReferencedBy": [PASS, SLOW],
"SetAccessorProperty": [PASS, SLOW],
"SetScopeVariableValue": [PASS, SLOW],
}] # ALWAYS
]

View File

@ -1,52 +0,0 @@
# Copyright 2014 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.
import os
from testrunner.local import commands
from testrunner.local import testsuite
from testrunner.local import utils
from testrunner.objects import testcase
class FuzzNativesTestSuite(testsuite.TestSuite):
def __init__(self, name, root):
super(FuzzNativesTestSuite, self).__init__(name, root)
def ListTests(self, context):
shell = os.path.abspath(os.path.join(context.shell_dir, self.shell()))
if utils.IsWindows():
shell += ".exe"
output = commands.Execute(
context.command_prefix +
[shell, "--allow-natives-syntax", "-e",
"try { var natives = %ListNatives();"
" for (var n in natives) { print(natives[n]); }"
"} catch(e) {}"] +
context.extra_flags)
if output.exit_code != 0:
print output.stdout
print output.stderr
assert False, "Failed to get natives list."
tests = []
for line in output.stdout.strip().split():
try:
(name, argc) = line.split(",")
flags = ["--allow-natives-syntax",
"-e", "var NAME = '%s', ARGC = %s;" % (name, argc)]
test = testcase.TestCase(self, name, flags)
tests.append(test)
except:
# Work-around: If parsing didn't work, it might have been due to output
# caused by other d8 flags.
pass
return tests
def GetFlagsForTestCase(self, testcase, context):
name = testcase.path
basefile = os.path.join(self.root, "base.js")
return testcase.flags + [basefile] + context.mode_flags
def GetSuite(name, root):
return FuzzNativesTestSuite(name, root)

View File

@ -51,8 +51,13 @@ from testrunner.objects import context
ARCH_GUESS = utils.DefaultArch()
DEFAULT_TESTS = ["mjsunit", "fuzz-natives", "unittests",
"cctest", "message", "preparser"]
DEFAULT_TESTS = [
"mjsunit",
"unittests",
"cctest",
"message",
"preparser",
]
# Map of test name synonyms to lists of test suites. Should be ordered by
# expected runtimes (suites with slow test cases first). These groups are
@ -60,7 +65,6 @@ DEFAULT_TESTS = ["mjsunit", "fuzz-natives", "unittests",
TEST_MAP = {
"default": [
"mjsunit",
"fuzz-natives",
"cctest",
"message",
"preparser",