Make javascript test-suite work with nodejs.

This commit is contained in:
Oliver Buchtala 2013-09-03 16:57:40 +02:00
commit 8bbd928831
37 changed files with 98 additions and 39 deletions

View file

@ -10,25 +10,23 @@ top_builddir = @top_builddir@
JS_INCLUDE = @JSCOREINC@
JS_DLNK = @JSCOREDYNAMICLINKING@
JSCXXFLAGS = @JSCXXFLAGS@
JAVASCRIPT_EXE = $(top_srcdir)/Tools/javascript/javascript
JAVASCRIPT_EXE = node
SWIG = $(top_builddir)/preinst_swig
C_TEST_CASES = \
preproc \
preproc_include
preproc
CPP_TEST_CASES = \
abstract_access \
abstract_typedef \
abstract_typedef2 \
abstract_virtual \
array_member \
arrays_global \
char_binary \
class_ignore \
class_scope_weird \
complextest \
constover \
constructor_copy \
cpp_enum \
cpp_namespace \
cpp_static \
@ -50,6 +48,12 @@ CPP_TEST_CASES = \
using2 \
javascript_unicode
BROKEN_TEST_CASES = \
array_member \
complextest \
constructor_copy \
preproc_include
SKIP_CPP_CASES = @SKIP_CPP_CASES@
SKIP_C_CASES = @SKIP_C_CASES@
SKIP_CPP_STD_CASES = @SKIP_CPP_STD_CASES@
@ -57,45 +61,47 @@ SKIP_MULTI_CPP_CASES = @SKIP_MULTI_CPP_CASES@
include $(srcdir)/../common.mk
ifeq (,$(V8))
JSENGINEFLAG = -jsc
else
JSENGINEFLAG = -v8
endif
# Overridden variables here
# Custom tests - tests with additional commandline options
javascript_exe:
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile JSCXXSRCS='$(JSCXXSRCS)' TOP='$(top_builddir)/$(EXAMPLES)' javascript_exe
# Rules for the different types of tests
%.cpptest: javascript_exe
$(setup)
+$(swig_and_compile_cpp)
%.cpptest:
$(prepare_test)
$(generate_cpp_wrapper)
$(build_module)
$(run_testcase)
%.ctest: javascript_exe
$(setup)
+$(swig_and_compile_c)
%.ctest:
$(prepare_test)
$(generate_cpp_wrapper)
$(build_module)
$(run_testcase)
%.multicpptest: javascript_exe
$(setup)
+$(swig_and_compile_multi_cpp)
%.multicpptest:
$(prepare_test)
$(generate_cpp_wrapper)
$(build_module)
$(run_testcase)
prepare_test = \
sh ./setup_test.sh $*
generate_cpp_wrapper = \
$(SWIG) -c++ -javascript -node -o $*/$*_wrap.cxx ../$*.i
build_module = \
cd $* && node-gyp configure build && cd ..
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.js appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(JAVASCRIPT_EXE) $(JSENGINEFLAG) -l $* $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
if [ -f $(srcdir)/$*$(SCRIPTSUFFIX) ]; then \
node $(srcdir)/$*$(SCRIPTSUFFIX); \
fi
# Clean
%.clean:
clean:
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile javascript_clean