Author: Wim Lavrijsen <[email protected]>
Branch: reflex-support
Changeset: r66142:c6d9d629e328
Date: 2013-08-13 23:42 -0700
http://bitbucket.org/pypy/pypy/changeset/c6d9d629e328/
Log: more support for test using the dummy backend
diff --git a/pypy/module/cppyy/test/Makefile b/pypy/module/cppyy/test/Makefile
--- a/pypy/module/cppyy/test/Makefile
+++ b/pypy/module/cppyy/test/Makefile
@@ -9,15 +9,19 @@
ROOTSYS := ${ROOTSYS}
endif
-ifeq ($(ROOTSYS),)
- genreflex=genreflex
- cppflags=-I$(shell root-config --incdir) -L$(shell root-config --libdir)
+ifeq ($(DUMMY),t)
+ cppflags=
else
- genreflex=$(ROOTSYS)/bin/genreflex
- ifeq ($(wildcard $(ROOTSYS)/include),) # standard locations used?
- cppflags=-I$(shell root-config --incdir) -L$(shell root-config --libdir)
+ ifeq ($(ROOTSYS),)
+ genreflex=genreflex
+ cppflags=-I$(ROOTSYS)/include -L$(ROOTSYS)/lib64 -L$(ROOTSYS)/lib
else
- cppflags=-I$(ROOTSYS)/include -L$(ROOTSYS)/lib64 -L$(ROOTSYS)/lib
+ genreflex=$(ROOTSYS)/bin/genreflex
+ ifeq ($(wildcard $(ROOTSYS)/include),) # standard locations used?
+ cppflags=-I$(shell root-config --incdir) -L$(shell root-config --libdir)
+ else
+ cppflags=-I$(ROOTSYS)/include -L$(ROOTSYS)/lib64 -L$(ROOTSYS)/lib
+ endif
endif
endif
@@ -26,7 +30,9 @@
cppflags+=-dynamiclib -single_module -arch x86_64 -undefined dynamic_lookup
endif
-ifeq ($(CINT),)
+ifeq ($(DUMMY),t)
+ cppflags2=-O3 -fPIC -rdynamic
+else ifeq ($(CINT),)
ifeq ($(shell $(genreflex) --help | grep -- --with-methptrgetter),)
genreflexflags=
cppflags2=-O3 -fPIC
@@ -34,32 +40,38 @@
genreflexflags=--with-methptrgetter
cppflags2=-Wno-pmf-conversions -O3 -fPIC
endif
-else
- cppflags2=-O3 -fPIC -rdynamic
endif
-ifeq ($(CINT),)
+ifeq ($(CINT),t)
+%Dict.so: %_cint.cxx %.cxx
+ g++ -o $@ $^ -shared $(cppflags) $(cppflags2)
+ rlibmap -f -o $*Dict.rootmap -l $@ -c $*_LinkDef.h
+
+%_cint.cxx: %.h %_LinkDef.h
+ rootcint -f $@ -c $*.h $*_LinkDef.h
+
+else ifeq ($(DUMMY),t)
+%Dict.so: %.cxx
+ g++ -o $@ $^ -shared $(cppflags) $(cppflags2)
+
+else # reflex
%Dict.so: %_rflx.cpp %.cxx
echo $(cppflags)
g++ -o $@ $^ -shared -lReflex $(cppflags) $(cppflags2)
%_rflx.cpp: %.h %.xml
$(genreflex) $< $(genreflexflags) --selection=$*.xml
--rootmap=$*Dict.rootmap --rootmap-lib=$*Dict.so
-else
-%Dict.so: %_cint.cxx %.cxx
- g++ -o $@ $^ -shared $(cppflags) $(cppflags2)
- rlibmap -f -o $*Dict.rootmap -l $@ -c $*_LinkDef.h
-%_cint.cxx: %.h %_LinkDef.h
- rootcint -f $@ -c $*.h $*_LinkDef.h
endif
ifeq ($(CINT),)
+ifeq ($(DUMMY),)
# TODO: methptrgetter causes these tests to crash, so don't use it for now
std_streamsDict.so: std_streams.cxx std_streams.h std_streams.xml
$(genreflex) std_streams.h --selection=std_streams.xml
g++ -o $@ std_streams_rflx.cpp std_streams.cxx -shared -lReflex
$(cppflags) $(cppflags2)
endif
+endif
.PHONY: clean
clean:
diff --git a/pypy/module/cppyy/test/conftest.py
b/pypy/module/cppyy/test/conftest.py
--- a/pypy/module/cppyy/test/conftest.py
+++ b/pypy/module/cppyy/test/conftest.py
@@ -1,1 +1,28 @@
import py
+
+if py.path.local.sysfind('genreflex') is None:
+ # build the dummy CAPI
+
+ import os
+ from rpython.translator.tool.cbuild import ExternalCompilationInfo
+ from rpython.translator import platform
+
+ from rpython.rtyper.lltypesystem import rffi
+
+ pkgpath = py.path.local(__file__).dirpath().join(os.pardir)
+ srcpath = pkgpath.join('src')
+ incpath = pkgpath.join('include')
+
+ eci = ExternalCompilationInfo(
+ separate_module_files=[srcpath.join('dummy_backend.cxx')],
+ include_dirs=[incpath],
+ use_cpp_linker=True,
+ )
+
+ soname = platform.platform.compile(
+ [], eci,
+ outputfilename='libcppyy_backend',
+ standalone=False)
+
+ import pypy.module.cppyy.capi.loadable_capi as lcapi
+ lcapi.reflection_library = str(soname)
diff --git a/pypy/module/cppyy/test/test_cppyy.py
b/pypy/module/cppyy/test/test_cppyy.py
--- a/pypy/module/cppyy/test/test_cppyy.py
+++ b/pypy/module/cppyy/test/test_cppyy.py
@@ -1,7 +1,8 @@
import py, os, sys
+isdummy = ''
if py.path.local.sysfind('genreflex') is None:
- py.test.skip("genreflex is not installed")
+ isdummy = 'DUMMY=t'
from pypy.module.cppyy import interp_cppyy, executor
@@ -12,7 +13,7 @@
def setup_module(mod):
if sys.platform == 'win32':
py.test.skip("win32 not supported so far")
- err = os.system("cd '%s' && make example01Dict.so" % currpath)
+ err = os.system("cd '%s' && make %s example01Dict.so" % (currpath,
isdummy))
if err:
raise OSError("'make' failed (see stderr)")
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit