PageRenderTime 25ms CodeModel.GetById 1ms app.highlight 18ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/python/Makefile.in

#
Autoconf | 186 lines | 132 code | 34 blank | 20 comment | 4 complexity | 80ef0de7f99a720c394fb925de75b98b MD5 | raw file
  1#######################################################################
  2# Makefile for python test-suite
  3#######################################################################
  4
  5ifeq (,$(PY3))
  6  PYBIN = @PYTHON@
  7else
  8  PYBIN = @PYTHON3@
  9endif
 10
 11LANGUAGE     = python
 12PYTHON       = $(PYBIN)
 13
 14#*_runme.py for Python 2.x, *_runme3.py for Python 3.x
 15PY2SCRIPTSUFFIX = _runme.py
 16PY3SCRIPTSUFFIX = _runme3.py
 17
 18ifeq (,$(PY3))
 19  SCRIPTSUFFIX = $(PY2SCRIPTSUFFIX)
 20else
 21  SCRIPTSUFFIX = $(PY3SCRIPTSUFFIX)
 22endif
 23
 24srcdir       = @srcdir@
 25top_srcdir   = @top_srcdir@
 26top_builddir = @top_builddir@
 27
 28
 29PY2TO3 = 2to3 -x import 
 30
 31
 32CPP_TEST_CASES += \
 33	argcargvtest \
 34	callback \
 35	complextest \
 36	director_stl \
 37	director_wstring \
 38	file_test \
 39	iadd \
 40	implicittest \
 41	inout \
 42	inplaceadd \
 43	input \
 44	kwargs_feature \
 45	li_cstring \
 46	li_cwstring \
 47	li_factory \
 48	li_implicit \
 49	li_std_map_member \
 50	li_std_multimap \
 51	li_std_pair_extra \
 52	li_std_set \
 53	li_std_stream \
 54	li_std_string_extra \
 55	li_std_vectora \
 56	li_std_vector_extra \
 57	li_std_wstream \
 58	li_std_wstring \
 59	primitive_types \
 60        python_abstractbase \
 61	python_append \
 62	python_director \
 63	python_nondynamic \
 64	python_overload_simple_cast \
 65	python_richcompare \
 66	simutry \
 67	std_containers \
 68	swigobject \
 69	template_matrix
 70
 71#	li_std_carray
 72#	director_profile
 73#	python_pybuf
 74
 75C_TEST_CASES += \
 76	file_test \
 77	li_cstring \
 78	li_cwstring \
 79	python_nondynamic \
 80	python_varargs_typemap
 81
 82#
 83# This test only works with modern C compilers
 84#
 85#C_TEST_CASES += \
 86#	complextest
 87
 88include $(srcdir)/../common.mk
 89
 90BUILTIN_BROKEN = \
 91    default_constructor.cpptest \
 92    director_exception.cpptest \
 93    exception_order.cpptest \
 94    li_std_string_extra.cpptest \
 95    li_std_wstring.cpptest \
 96    python_abstractbase.cpptest \
 97    threads_exception.cpptest
 98
 99BUILTIN_NOT_BROKEN = $(filter-out $(BUILTIN_BROKEN),$(NOT_BROKEN_TEST_CASES))
100
101builtin-check : $(BUILTIN_NOT_BROKEN)
102
103# Overridden variables here
104LIBS       = -L.
105VALGRIND_OPT += --suppressions=pythonswig.supp
106
107# Custom tests - tests with additional commandline options
108# none!
109
110# Rules for the different types of tests
111%.cpptest: 
112	$(setup)
113	+$(swig_and_compile_cpp)
114	$(run_testcase)
115
116%.ctest:
117	$(setup)
118	+$(swig_and_compile_c)
119	$(run_testcase)
120
121%.multicpptest: 
122	$(setup)
123	+$(swig_and_compile_multi_cpp)
124	$(run_testcase)
125
126
127# Call 2to3 to generate Python 3.x test from the Python 2.x's *_runme.py file
128%$(PY3SCRIPTSUFFIX): %$(PY2SCRIPTSUFFIX)
129	cp $< $@
130	$(PY2TO3) -w $@ >/dev/null 2>&1 
131
132
133# Runs the testcase. A testcase is only run if
134# a file is found which has _runme.py (or _runme3.py for Python 3) appended after the testcase name.
135
136run_python = env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PYTHONPATH=.:$(srcdir):$$PYTHONPATH $(RUNTOOL) $(PYTHON) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)
137
138py2_runme = $(srcdir)/$(SCRIPTPREFIX)$*$(PY2SCRIPTSUFFIX)
139py3_runme = $(srcdir)/$(SCRIPTPREFIX)$*$(PY3SCRIPTSUFFIX)
140
141ifeq (,$(PY3))
142run_testcase = \
143	if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
144	  $(run_python);\
145	fi
146else
147run_testcase = \
148	if [ -f $(py2_runme) ]; then \
149	  $(MAKE) -f $(srcdir)/Makefile $(py3_runme) && $(run_python); \
150        elif [ -f $(py3_runme) ]; then \
151          $(run_python); \
152	fi
153endif
154
155# Clean: remove the generated .py file
156%.clean:
157	@rm -f $*.py;
158	@#We only remove the _runme3.py if it is generated by 2to3 from a _runme.py.
159	@if [ -f $(py2_runme) ]; then rm -f $(py3_runme) $(py3_runme).bak; fi
160
161clean:
162	$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile python_clean
163	rm -f hugemod.h hugemod_a.i hugemod_b.i hugemod_a.py hugemod_b.py hugemod_runme.py
164
165cvsignore:
166	@echo '*wrap* *.pyc *.so *.dll *.exp *.lib'
167	@echo Makefile
168	@for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do echo $$i.py; done 
169	@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 
170	@echo clientdata_prop_a.py 
171	@echo clientdata_prop_b.py 
172	@echo imports_a.py 
173	@echo imports_b.py 
174	@echo mod_a.py mod_b.py
175	@echo hugemod.h hugemod_a.i hugemod_b.i hugemod_a.py hugemod_b.py hugemod_runme.py
176	@echo template_typedef_import.py
177
178hugemod_runme = hugemod$(SCRIPTPREFIX)
179
180hugemod:
181	perl hugemod.pl $(hugemod_runme) 
182	$(MAKE) hugemod_a.cpptest
183	$(MAKE) hugemod_b.cpptest
184	sh -c "time $(PYTHON) $(hugemod_runme)"
185	sh -c "time $(PYTHON) $(hugemod_runme)"
186