From: yangguo@chromium.org Date: Mon, 20 Oct 2014 12:14:26 +0000 (+0000) Subject: Remove fuzz-natives tests. X-Git-Tag: upstream/4.7.83~6248 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7ebe9d820a31f28db883ec38a3c9a670de70669e;p=platform%2Fupstream%2Fv8.git 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 --- diff --git a/src/runtime/runtime-test.cc b/src/runtime/runtime-test.cc index da39b38..cf0a239 100644 --- a/src/runtime/runtime-test.cc +++ b/src/runtime/runtime-test.cc @@ -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 elements = factory->NewFixedArray(entry_count); - int index = 0; - bool inline_runtime_functions = false; -#define ADD_ENTRY(Name, argc, ressize) \ - { \ - HandleScope inner(isolate); \ - Handle 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 pair_elements = factory->NewFixedArray(2); \ - pair_elements->set(0, *name); \ - pair_elements->set(1, Smi::FromInt(argc)); \ - Handle 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 result = factory->NewJSArrayWithElements(elements); - return (*result); -} -#endif - - RUNTIME_FUNCTION(Runtime_HaveSameMap) { SealHandleScope shs(isolate); DCHECK(args.length() == 2); diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h index 084e35d..350fd92 100644 --- a/src/runtime/runtime.h +++ b/src/runtime/runtime.h @@ -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) diff --git a/test/fuzz-natives/base.js b/test/fuzz-natives/base.js deleted file mode 100644 index d1f721d..0000000 --- a/test/fuzz-natives/base.js +++ /dev/null @@ -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); diff --git a/test/fuzz-natives/fuzz-natives.status b/test/fuzz-natives/fuzz-natives.status deleted file mode 100644 index c81188a..0000000 --- a/test/fuzz-natives/fuzz-natives.status +++ /dev/null @@ -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 -] diff --git a/test/fuzz-natives/testcfg.py b/test/fuzz-natives/testcfg.py deleted file mode 100644 index 5e00b40..0000000 --- a/test/fuzz-natives/testcfg.py +++ /dev/null @@ -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) diff --git a/tools/run-tests.py b/tools/run-tests.py index 410f253..66d1677 100755 --- a/tools/run-tests.py +++ b/tools/run-tests.py @@ -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",