1
#######################################################################
2
# Makefile for python test-suite
3
#######################################################################
14
#*_runme.py for Python 2.x, *_runme3.py for Python 3.x
15
PY2SCRIPTSUFFIX = _runme.py
16
PY3SCRIPTSUFFIX = _runme3.py
19
SCRIPTSUFFIX = $(PY2SCRIPTSUFFIX)
21
SCRIPTSUFFIX = $(PY3SCRIPTSUFFIX)
25
top_srcdir = @top_srcdir@
26
top_builddir = @top_builddir@
29
PY2TO3 = 2to3 -x import
63
python_overload_simple_cast \
80
# This test only works with modern C compilers
85
include $(srcdir)/../common.mk
87
# Overridden variables here
89
VALGRIND_OPT += --suppressions=pythonswig.supp
91
# Custom tests - tests with additional commandline options
94
# Rules for the different types of tests
97
+$(swig_and_compile_cpp)
102
+$(swig_and_compile_c)
107
+$(swig_and_compile_multi_cpp)
111
# Call 2to3 to generate Python 3.x test from the Python 2.x's *_runme.py file
112
%$(PY3SCRIPTSUFFIX): %$(PY2SCRIPTSUFFIX)
114
$(PY2TO3) -w $@ >/dev/null 2>&1
117
# Runs the testcase. A testcase is only run if
118
# a file is found which has _runme.py (or _runme3.py for Python 3) appended after the testcase name.
120
run_python = env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PYTHONPATH=.:$(srcdir):$$PYTHONPATH $(RUNTOOL) $(PYTHON) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)
122
py2_runme = $(srcdir)/$(SCRIPTPREFIX)$*$(PY2SCRIPTSUFFIX)
123
py3_runme = $(srcdir)/$(SCRIPTPREFIX)$*$(PY3SCRIPTSUFFIX)
127
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
132
if [ -f $(py2_runme) ]; then \
133
$(MAKE) -f $(srcdir)/Makefile $(py3_runme) && $(run_python); \
134
elif [ -f $(py3_runme) ]; then \
139
# Clean: remove the generated .py file
142
@#We only remove the _runme3.py if it is generated by 2to3 from a _runme.py.
143
@if [ -f $(py2_runme) ]; then rm -f $(py3_runme) $(py3_runme).bak; fi
146
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile python_clean
147
rm -f hugemod.h hugemod_a.i hugemod_b.i hugemod_a.py hugemod_b.py hugemod_runme.py
150
@echo '*wrap* *.pyc *.so *.dll *.exp *.lib'
152
@for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do echo $$i.py; done
153
@for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do if grep -q $${i}_runme.py CVS/Entries ; then echo $${i}_runme.py; fi; done
154
@echo clientdata_prop_a.py
155
@echo clientdata_prop_b.py
158
@echo mod_a.py mod_b.py
159
@echo hugemod.h hugemod_a.i hugemod_b.i hugemod_a.py hugemod_b.py hugemod_runme.py
160
@echo template_typedef_import.py
162
hugemod_runme = hugemod$(SCRIPTPREFIX)
165
perl hugemod.pl $(hugemod_runme)
166
$(MAKE) hugemod_a.cpptest
167
$(MAKE) hugemod_b.cpptest
168
sh -c "time $(PYTHON) $(hugemod_runme)"
169
sh -c "time $(PYTHON) $(hugemod_runme)"