solenv/gbuild/PythonTest.mk | 39 +++++++++++++++++++------------- solenv/gbuild/platform/com_MSC_class.mk | 1 solenv/gbuild/platform/macosx.mk | 3 ++ solenv/gbuild/platform/solaris.mk | 3 ++ solenv/gbuild/platform/unxgcc.mk | 5 +++- sw/Module_sw.mk | 2 + sw/PythonTest_sw_unoapi.mk | 6 ++-- 7 files changed, 40 insertions(+), 19 deletions(-)
New commits: commit 80885bf2c371d697c2719cc53975771ff36524de Author: Michael Stahl <mst...@redhat.com> Date: Sat Apr 20 20:51:11 2013 +0200 gbuild: PythonTest: automatic GDB backtrace on failures This requires changing the interface a bit to pass the directory containing the test modules separately, because strangely the "unittest" thingy cannot load the test modules by their absolute path when changing the current working dir to where the core dump should happen. So put the directory onto the PYTHONPATH to work around that; arguably it's even nicer for clients this way. Change-Id: I0d1d39f33d0c086c6c3014d2f9ba93f0a3dc0128 diff --git a/solenv/gbuild/PythonTest.mk b/solenv/gbuild/PythonTest.mk index 141dc2d..d6570f3 100644 --- a/solenv/gbuild/PythonTest.mk +++ b/solenv/gbuild/PythonTest.mk @@ -26,12 +26,17 @@ $(call gb_PythonTest_get_clean_target,%) : ifneq ($(DISABLE_PYTHON),TRUE) +# pass a hard-coded 139 to the gdb postprocess script to match soffice.bin +# signal exit values (assumption: non-0 exit value here means it crashed) .PHONY : $(call gb_PythonTest_get_target,%) $(call gb_PythonTest_get_target,%) : $(call gb_Output_announce,$*,$(true),PYT,2) $(call gb_Helper_abbreviate_dirs,\ mkdir -p $(dir $(call gb_PythonTest_get_target,$*)) && \ - (PYTHONPATH=$(SRCDIR)/unotest/source/python:$(DEVINSTALLDIR)/opt/program \ + $(if $(gb_CppunitTest__interactive),, \ + $(if $(value gb_CppunitTest_postprocess), \ + rm -fr $@.core && mkdir $@.core && cd $@.core &&)) \ + (PYTHONPATH=$(PYPATH):$(DEVINSTALLDIR)/opt/program \ UserInstallation="$(call gb_Helper_make_url,$(OUTDIR)/unittest)" \ BRAND_BASE_DIR="$(call gb_Helper_make_url,$(OUTDIR)/unittest/install)" \ CONFIGURATION_LAYERS="$(strip $(CONFIGURATION_LAYERS))" \ @@ -40,18 +45,18 @@ $(call gb_PythonTest_get_target,%) : $(foreach dir,URE_INTERNAL_LIB_DIR LO_LIB_DIR,\ $(dir)="$(call gb_Helper_make_url,$(gb_CppunitTest_LIBDIR))") \ $(gb_CppunitTest_GDBTRACE) $(gb_CppunitTest_VALGRINDTOOL) $(gb_PythonTest_COMMAND) \ - $(CLASSES) \ + $(MODULES) \ $(if $(gb_CppunitTest__interactive),, \ > $@.log 2>&1 \ || (cat $@.log && $(UNIT_FAILED_MSG) \ $(if $(value gb_CppunitTest_postprocess), \ - && $(call gb_CppunitTest_postprocess,$(gb_PythonTest_EXECUTABLE_GDB),$@.core)) \ + && $(call gb_CppunitTest_postprocess,$(gb_PythonTest_EXECUTABLE_GDB),$@.core,139)) \ && false)))) # always use udkapi and URE services define gb_PythonTest_PythonTest -$(call gb_PythonTest_get_target,$(1)) : T_CP := -$(call gb_PythonTest_get_target,$(1)) : CLASSES := +$(call gb_PythonTest_get_target,$(1)) : PYPATH := $(SRCDIR)/unotest/source/python +$(call gb_PythonTest_get_target,$(1)) : MODULES := $(call gb_PythonTest_get_target,$(1)) : CONFIGURATION_LAYERS := $(call gb_PythonTest_get_target,$(1)) : UNO_TYPES := $(call gb_PythonTest_get_target,$(1)) : UNO_SERVICES := @@ -107,13 +112,15 @@ $(foreach component,$(call gb_CppunitTest__filter_not_built_components,$(2)),$(c endef -define gb_PythonTest_add_classes -$(call gb_PythonTest_get_target,$(1)) : CLASSES += $(2) - -endef - -define gb_PythonTest_add_class -$(call gb_PythonTest_add_classes,$(1),$(2)) +# put the directory on the PYTHONPATH because the "unittest" loader +# mysteriously fails to load modules given as absolute path unless the $PWD is +# a prefix of the absolute path, which it is not when we go into a certain +# dir to get a core dump there +# +# gb_PythonTest_add_modules directory module(s) +define gb_PythonTest_add_modules +$(call gb_PythonTest_get_target,$(1)) : PYPATH := $$(PYPATH):$(2) +$(call gb_PythonTest_get_target,$(1)) : MODULES += $(3) endef diff --git a/sw/PythonTest_sw_unoapi.mk b/sw/PythonTest_sw_unoapi.mk index 20c6549..a78f1c5 100644 --- a/sw/PythonTest_sw_unoapi.mk +++ b/sw/PythonTest_sw_unoapi.mk @@ -48,9 +48,9 @@ $(eval $(call gb_PythonTest_use_components,sw_unoapi,\ unoxml/source/service/unoxml \ )) -$(eval $(call gb_PythonTest_add_classes,sw_unoapi,\ - $(SRCDIR)/sw/qa/python/set_expression.py \ - $(SRCDIR)/sw/qa/python/get_expression.py \ +$(eval $(call gb_PythonTest_add_modules,sw_unoapi,$(SRCDIR)/sw/qa/python,\ + set_expression \ + get_expression \ )) # vim: set noet sw=4 ts=4: commit 6d6bb989d1ba9af26518a110728f479d099b4562 Author: Michael Stahl <mst...@redhat.com> Date: Sat Apr 20 20:18:40 2013 +0200 gbuild: PythonTest: try to make it more portable Mac OS X is not tested though. Change-Id: I143e20e91378b5c0546c0435dda756682d7773e7 diff --git a/solenv/gbuild/PythonTest.mk b/solenv/gbuild/PythonTest.mk index bbf7877..141dc2d 100644 --- a/solenv/gbuild/PythonTest.mk +++ b/solenv/gbuild/PythonTest.mk @@ -10,12 +10,14 @@ # PythonTest class ifeq ($(SYSTEM_PYTHON),NO) -gb_Python_EXE := /bin/sh $(DEVINSTALLDIR)/opt/program/python +gb_PythonTest_EXECUTABLE := $(gb_Python_INSTALLED_EXECUTABLE) +gb_PythonTest_EXECUTABLE_GDB := $(gb_Python_INSTALLED_EXECUTABLE_GDB) else -gb_Python_EXE := $(PYTHON_FOR_BUILD) +gb_PythonTest_EXECUTABLE := $(PYTHON_FOR_BUILD) +gb_PythonTest_EXECUTABLE_GDB := $(PYTHON_FOR_BUILD) endif -gb_PythonTest_COMMAND := $(gb_Python_EXE) -m unittest +gb_PythonTest_COMMAND := $(gb_PythonTest_EXECUTABLE) -m unittest .PHONY : $(call gb_PythonTest_get_clean_target,%) $(call gb_PythonTest_get_clean_target,%) : @@ -43,7 +45,7 @@ $(call gb_PythonTest_get_target,%) : > $@.log 2>&1 \ || (cat $@.log && $(UNIT_FAILED_MSG) \ $(if $(value gb_CppunitTest_postprocess), \ - && $(call gb_CppunitTest_postprocess,$(gb_CppunitTest_CPPTESTCOMMAND),$@.core)) \ + && $(call gb_CppunitTest_postprocess,$(gb_PythonTest_EXECUTABLE_GDB),$@.core)) \ && false)))) # always use udkapi and URE services diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk index d56801f..36f973d 100755 --- a/solenv/gbuild/platform/com_MSC_class.mk +++ b/solenv/gbuild/platform/com_MSC_class.mk @@ -624,5 +624,6 @@ gb_Pyuno_PROGRAMDIRNAME := program # Python gb_PYTHON_PRECOMMAND := $(gb_Helper_set_ld_path) PYTHONHOME="$(OUTDIR_FOR_BUILD)/lib/python" PYTHONPATH="$(OUTDIR_FOR_BUILD)/lib/python;$(OUTDIR_FOR_BUILD)/lib/python/lib-dynload" +gb_Python_INSTALLED_EXECUTABLE := $(DEVINSTALLDIR)/opt/program/python.exe # vim: set noet sw=4: diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk index 5ce425c..c7c093d 100644 --- a/solenv/gbuild/platform/macosx.mk +++ b/solenv/gbuild/platform/macosx.mk @@ -403,6 +403,9 @@ endef # Python gb_PYTHON_PRECOMMAND := DYLD_LIBRARY_PATH=$(OUTDIR)/lib +gb_Python_INSTALLED_EXECUTABLE := $(DEVINSTALLDIR)/opt/LibreOffice.app/Contents/MacOS/LibreOfficePython.framework/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/Resources/Python.app/Contents/MacOS/LibreOfficePython +# this is passed to gdb as executable when running tests +gb_Python_INSTALLED_EXECUTABLE_GDB := $(gb_Python_INSTALLED_EXECUTABLE) # Pyuno class diff --git a/solenv/gbuild/platform/solaris.mk b/solenv/gbuild/platform/solaris.mk index 965b2ef..8ec01c5 100644 --- a/solenv/gbuild/platform/solaris.mk +++ b/solenv/gbuild/platform/solaris.mk @@ -435,6 +435,9 @@ gb_Pyuno_PROGRAMDIRNAME := program # Python gb_PYTHON_PRECOMMAND := $(gb_Helper_set_ld_path) PYTHONHOME=$(OUTDIR)/lib/python PYTHONPATH=$(OUTDIR)/lib/python:$(OUTDIR)/lib/python/lib-dynload +gb_Python_INSTALLED_EXECUTABLE := /bin/sh $(DEVINSTALLDIR)/opt/program/python +# this is passed to gdb as executable when running tests +gb_Python_INSTALLED_EXECUTABLE_GDB := $(DEVINSTALLDIR)/opt/program/python.bin include $(GBUILDDIR)/platform/com_GCC_class.mk diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk index ab54e27..e2784d1 100644 --- a/solenv/gbuild/platform/unxgcc.mk +++ b/solenv/gbuild/platform/unxgcc.mk @@ -433,7 +433,10 @@ gb_UIMenubarTarget_UIMenubarTarget_platform := gb_Pyuno_PROGRAMDIRNAME := program # Python -gb_PYTHON_PRECOMMAND := $(gb_Helper_set_ld_path) PYTHONHOME=$(OUTDIR)/lib/python PYTHONPATH=$(OUTDIR)/lib/python:$(OUTDIR)/lib/python/lib-dynload +gb_Python_PRECOMMAND := $(gb_Helper_set_ld_path) PYTHONHOME=$(OUTDIR)/lib/python PYTHONPATH=$(OUTDIR)/lib/python:$(OUTDIR)/lib/python/lib-dynload +gb_Python_INSTALLED_EXECUTABLE := /bin/sh $(DEVINSTALLDIR)/opt/program/python +# this is passed to gdb as executable when running tests +gb_Python_INSTALLED_EXECUTABLE_GDB := $(DEVINSTALLDIR)/opt/program/python.bin include $(GBUILDDIR)/platform/com_GCC_class.mk commit 0a354129838758e2b34078b3c73b3551ce182a2b Author: Michael Stahl <mst...@redhat.com> Date: Sat Apr 20 23:33:33 2013 +0200 disable PythonTest on WNT for now There is a problem that needs fixing first, in order to be able to load the test.dll the OUTDIR/bin needs to be on PATH but starting the dev-install's python.exe with that then results in 2 instances of tklo.dll loaded, which fails horribly. Hopefully this will get easier once more stuff (python and libraries) is moved to INSTDIR. Change-Id: Ib615baac48e5e863b0b49a2de6c2985100ce3ae7 diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk index fedb44a..164e690 100644 --- a/sw/Module_sw.mk +++ b/sw/Module_sw.mk @@ -71,9 +71,11 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sw,\ endif ifneq ($(DISABLE_PYTHON),TRUE) +ifneq ($(OS),WNT) $(eval $(call gb_Module_add_subsequentcheck_targets,sw,\ PythonTest_sw_unoapi \ )) endif +endif # vim: set noet sw=4 ts=4: _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits