Commit 1790f179 authored by tasak@google.com's avatar tasak@google.com

Added core and modules to binding tests results for binding modularization.

Updated main.py to support core/modules results.
Moved all current test results into Source/bindings/tests/results/core.
Added TestInterface5.idl to tests/idls/modules and V8TestInterface5.{h,cpp} to tests/results/modules.

BUG=358074

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

git-svn-id: svn://svn.chromium.org/blink/trunk@181720 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 3aa76a7a
/*
* Copyright (C) 2013 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// Test for interface extended attributes and special operations.
// Also used as a target by TestObject
[
ActiveDOMObject,
Conditional=CONDITION,
Custom=(LegacyCallAsFunction,ToV8),
DoNotCheckConstants,
ImplementedAs=TestInterface5Implementation,
Iterable,
RuntimeEnabled=FeatureName,
SetWrapperReferenceTo(TestInterface5 referencedName),
TypeChecking=(Interface,Unrestricted),
Exposed=(Worker,Window),
] interface TestInterface5 : TestInterfaceEmpty {
// members needed to test [ImplementedAs], as this affect attribute
// configuration and method configuration, and [TypeChecking]
// constants also needed for [DoNotCheckConstants]
const unsigned long UNSIGNED_LONG = 0;
[Reflect=CONST_CPP] const short CONST_JAVASCRIPT = 1;
attribute TestInterface5 testInterfaceAttribute; // Self-referential interface type with [ImplementedAs]
attribute TestInterface5Constructor testInterfaceConstructorAttribute;
attribute double doubleAttribute;
attribute float floatAttribute;
attribute unrestricted double unrestrictedDoubleAttribute;
attribute unrestricted float unrestrictedFloatAttribute;
static attribute DOMString staticStringAttribute;
void voidMethodTestInterfaceEmptyArg(TestInterfaceEmpty testInterfaceEmptyArg);
void voidMethodDoubleArgFloatArg(double doubleArg, float floatArg);
void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg(unrestricted double unrestrictedDoubleArg, unrestricted float unrestrictedFloatArg);
[PerWorldBindings] void voidMethod();
// Anonymous indexed property operations
getter DOMString (unsigned long index);
setter DOMString (unsigned long index, DOMString value);
deleter boolean (unsigned long index);
// Anonymous named property operations
getter DOMString (DOMString name);
setter DOMString (DOMString name, DOMString value);
deleter boolean (DOMString name);
[NotEnumerable] stringifier;
// Per-method [Exposed] annotation support.
void alwaysExposedMethod();
[Exposed=Worker] void workerExposedMethod();
[Exposed=Window] void windowExposedMethod();
static void alwaysExposedStaticMethod();
[Exposed=Worker] static void workerExposedStaticMethod();
[Exposed=Window] static void windowExposedStaticMethod();
attribute long alwaysExposedAttribute;
[Exposed=Worker] attribute long workerExposedAttribute;
[Exposed=Window] attribute long windowExposedAttribute;
[Exposed=(Window,ServiceWorker)] void windowAndServiceWorkerExposedMethod();
};
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
#ifndef V8TestInterface5_h
#define V8TestInterface5_h
#if ENABLE(CONDITION)
#include "bindings/core/v8/ScriptWrappable.h"
#include "bindings/core/v8/V8Binding.h"
#include "bindings/core/v8/V8DOMWrapper.h"
#include "bindings/core/v8/WrapperTypeInfo.h"
#include "bindings/tests/idls/modules/TestInterface5Implementation.h"
#include "bindings/tests/v8/V8TestInterfaceEmpty.h"
#include "platform/heap/Handle.h"
namespace blink {
class V8TestInterface5 {
public:
static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*);
static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Value>, v8::Isolate*);
static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*);
static TestInterface5Implementation* toImpl(v8::Handle<v8::Object> object)
{
return toImpl(blink::toScriptWrappableBase(object));
}
static TestInterface5Implementation* toImplWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>);
static const WrapperTypeInfo wrapperTypeInfo;
static void refObject(ScriptWrappableBase* internalPointer);
static void derefObject(ScriptWrappableBase* internalPointer);
static WrapperPersistentNode* createPersistentHandle(ScriptWrappableBase* internalPointer);
static void visitDOMWrapper(ScriptWrappableBase* internalPointer, const v8::Persistent<v8::Object>&, v8::Isolate*);
static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>);
static void legacyCallCustom(const v8::FunctionCallbackInfo<v8::Value>&);
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
static inline ScriptWrappableBase* toScriptWrappableBase(TestInterface5Implementation* impl)
{
return impl->toScriptWrappableBase();
}
static inline TestInterface5Implementation* toImpl(ScriptWrappableBase* internalPointer)
{
return internalPointer->toImpl<TestInterface5Implementation>();
}
static void installConditionallyEnabledProperties(v8::Handle<v8::Object>, v8::Isolate*);
static void installConditionallyEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*);
private:
};
class TestInterface5Implementation;
v8::Handle<v8::Value> toV8(TestInterface5Implementation*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
template<class CallbackInfo>
inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterface5Implementation* impl)
{
v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()));
}
template<class CallbackInfo>
inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestInterface5Implementation* impl)
{
v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()));
}
template<class CallbackInfo, class Wrappable>
inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestInterface5Implementation* impl, Wrappable*)
{
v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()));
}
inline v8::Handle<v8::Value> toV8(PassRefPtr<TestInterface5Implementation> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
return toV8(impl.get(), creationContext, isolate);
}
template<class CallbackInfo>
inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<TestInterface5Implementation> impl)
{
v8SetReturnValue(callbackInfo, impl.get());
}
template<class CallbackInfo>
inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtr<TestInterface5Implementation> impl)
{
v8SetReturnValueForMainWorld(callbackInfo, impl.get());
}
template<class CallbackInfo, class Wrappable>
inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<TestInterface5Implementation> impl, Wrappable* wrappable)
{
v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
}
} // namespace blink
#endif // ENABLE(CONDITION)
#endif // V8TestInterface5_h
......@@ -72,6 +72,11 @@ COMPONENT_DIRECTORY = frozenset(['core', 'modules'])
test_input_directory = os.path.join(source_path, 'bindings', 'tests', 'idls')
reference_directory = os.path.join(source_path, 'bindings', 'tests', 'results')
PLY_LEX_YACC_FILES = frozenset([
'lextab.py', # PLY lex
'lextab.pyc',
'parsetab.pickle', # PLY yacc
])
@contextmanager
def TemporaryDirectory():
......@@ -125,6 +130,16 @@ def generate_interface_dependencies():
def bindings_tests(output_directory, verbose):
executive = Executive()
def list_files(directory):
files = []
for component in os.listdir(directory):
if component not in COMPONENT_DIRECTORY:
continue
directory_with_component = os.path.join(directory, component)
for filename in os.listdir(directory_with_component):
files.append(os.path.join(directory_with_component, filename))
return files
def diff(filename1, filename2):
# Python's difflib module is too slow, especially on long output, so
# run external diff(1) command
......@@ -137,14 +152,17 @@ def bindings_tests(output_directory, verbose):
# non-zero exit if files differ.
return executive.run_command(cmd, error_handler=lambda x: None)
def is_cache_file(filename):
if filename in PLY_LEX_YACC_FILES:
return True
if filename.endswith('.cache'): # Jinja
return True
return False
def delete_cache_files():
# FIXME: Instead of deleting cache files, don't generate them.
cache_files = [os.path.join(output_directory, output_file)
for output_file in os.listdir(output_directory)
if (output_file in ('lextab.py', # PLY lex
'lextab.pyc',
'parsetab.pickle') or # PLY yacc
output_file.endswith('.cache'))] # Jinja
cache_files = [path for path in list_files(output_directory)
if is_cache_file(os.path.basename(path))]
for cache_file in cache_files:
os.remove(cache_file)
......@@ -169,19 +187,25 @@ def bindings_tests(output_directory, verbose):
print 'PASS: %s' % reference_basename
return True
def identical_output_files():
file_pairs = [(os.path.join(reference_directory, output_file),
os.path.join(output_directory, output_file))
for output_file in os.listdir(output_directory)]
def identical_output_files(output_files):
reference_files = [os.path.join(reference_directory,
os.path.relpath(path, output_directory))
for path in output_files]
return all([identical_file(reference_filename, output_filename)
for (reference_filename, output_filename) in file_pairs])
def no_excess_files():
generated_files = set(os.listdir(output_directory))
generated_files.add('.svn') # Subversion working copy directory
excess_files = [output_file
for output_file in os.listdir(reference_directory)
if output_file not in generated_files]
for (reference_filename, output_filename) in zip(reference_files, output_files)])
def no_excess_files(output_files):
generated_files = set([os.path.relpath(path, output_directory)
for path in output_files])
# Add subversion working copy directories in core and modules.
for component in COMPONENT_DIRECTORY:
generated_files.add(os.path.join(component, '.svn'))
excess_files = []
for path in list_files(reference_directory):
relpath = os.path.relpath(path, reference_directory)
if relpath not in generated_files:
excess_files.append(relpath)
if excess_files:
print ('Excess reference files! '
'(probably cruft from renaming or deleting):\n' +
......@@ -191,15 +215,19 @@ def bindings_tests(output_directory, verbose):
try:
generate_interface_dependencies()
idl_compiler = IdlCompilerV8(output_directory,
interfaces_info=interfaces_info,
only_if_changed=True)
dictionary_impl_compiler = IdlCompilerDictionaryImpl(
output_directory, interfaces_info=interfaces_info,
only_if_changed=True)
idl_filenames = []
for component in COMPONENT_DIRECTORY:
output_dir = os.path.join(output_directory, component)
if not os.path.exists(output_dir):
os.makedirs(output_dir)
idl_compiler = IdlCompilerV8(output_dir,
interfaces_info=interfaces_info,
only_if_changed=True)
dictionary_impl_compiler = IdlCompilerDictionaryImpl(
output_dir, interfaces_info=interfaces_info,
only_if_changed=True)
idl_filenames = []
input_directory = os.path.join(test_input_directory, component)
for filename in os.listdir(input_directory):
if (filename.endswith('.idl') and
......@@ -209,21 +237,21 @@ def bindings_tests(output_directory, verbose):
idl_filenames.append(
os.path.realpath(
os.path.join(input_directory, filename)))
for idl_path in idl_filenames:
idl_basename = os.path.basename(idl_path)
idl_compiler.compile_file(idl_path)
definition_name, _ = os.path.splitext(idl_basename)
if (definition_name in interfaces_info and
interfaces_info[definition_name]['is_dictionary']):
dictionary_impl_compiler.compile_file(idl_path)
if verbose:
print 'Compiled: %s' % idl_path
for idl_path in idl_filenames:
idl_basename = os.path.basename(idl_path)
idl_compiler.compile_file(idl_path)
definition_name, _ = os.path.splitext(idl_basename)
if (definition_name in interfaces_info and interfaces_info[definition_name]['is_dictionary']):
dictionary_impl_compiler.compile_file(idl_path)
if verbose:
print 'Compiled: %s' % idl_path
finally:
delete_cache_files()
# Detect all changes
passed = identical_output_files()
passed &= no_excess_files()
output_files = list_files(output_directory)
passed = identical_output_files(output_files)
passed &= no_excess_files(output_files)
if passed:
if verbose:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment