bump product version to 6.3.0.0.beta1
[LibreOffice.git] / solenv / gbuild / UITest.mk
blob2e511041288318743a99b6a1cf311cadc467349b
1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 # UITest class
12 gb_UITest_UNITTESTFAILED ?= $(GBUILDDIR)/uitest-failed-default.sh
14 ifeq ($(SYSTEM_PYTHON),)
15 gb_UITest_EXECUTABLE := $(gb_Python_INSTALLED_EXECUTABLE)
16 gb_UITest_DEPS ?= $(call gb_Package_get_target,python3)
17 else
18 gb_UITest_EXECUTABLE := $(PYTHON_FOR_BUILD)
19 gb_UITest_DEPS :=
20 endif
22 # UITests are much more likely to generate core files for the soffice than for
23 # the python executable, but solenv/bin/gdb-core-bt.sh is often unable to
24 # determine the executable that generated a core file, so make it fall back to
25 # the soffice executable rather than to gb_UITest_EXECUTABLE:
26 gb_UITest_EXECUTABLE_GDB := $(call gb_Executable_get_target,soffice_bin)
28 ifneq ($(strip $(UITESTTRACE)),)
29 gb_UITest_GDBTRACE := --gdb
30 gb_UITest__interactive := $(true)
31 endif
33 ifneq ($(gb_UITest_DEBUGRUN),)
34 gb_UITest_SOFFICEARG:=connect:pipe,name=$(USER)
35 gb_UITest__interactive := $(true)
36 else
37 gb_UITest_SOFFICEARG:=path:$(INSTROOT)/$(LIBO_BIN_FOLDER)/soffice
38 endif
40 gb_UITest_COMMAND = LIBO_LANG=C $(gb_CppunitTest_RR) $(gb_UITest_EXECUTABLE) $(SRCDIR)/uitest/test_main.py
42 .PHONY : $(call gb_UITest_get_clean_target,%)
43 $(call gb_UITest_get_clean_target,%) :
44 $(call gb_Helper_abbreviate_dirs,\
45 rm -f $@ $@.log)
47 ifneq ($(DISABLE_PYTHON),TRUE)
49 # qadevOOo/qa/registrymodifications.xcu is copied to user profile directory to ensure en_US locale;
50 # this might be overwritten later when gb_UITest_use_config is set
51 .PHONY : $(call gb_UITest_get_target,%)
52 $(call gb_UITest_get_target,%) :| $(gb_UITest_DEPS)
53 ifneq ($(gb_SUPPRESS_TESTS),)
54 @true
55 else
56 $(call gb_Output_announce,$*,$(true),UIT,2)
57 $(call gb_Helper_abbreviate_dirs,\
58 rm -rf $(dir $(call gb_UITest_get_target,$*)) && \
59 mkdir -p $(dir $(call gb_UITest_get_target,$*))/user/user && \
60 cp $(SRCDIR)/qadevOOo/qa/registrymodifications.xcu $(dir $(call gb_UITest_get_target,$*))/user/user/ && \
61 $(if $(gb_UITest__interactive),, \
62 rm -fr $@.core && mkdir -p $(dir $(call gb_UITest_get_target,$*))user/ && mkdir $@.core && cd $@.core && ) \
63 $(if $(gb_UITest_use_config), \
64 cp $(gb_UITest_use_config) $(dir $(call gb_UITest_get_target,$*))user/. && ) \
65 ($(gb_UITest_PRECOMMAND) \
66 $(if $(G_SLICE),G_SLICE=$(G_SLICE)) \
67 $(if $(GLIBCXX_FORCE_NEW),GLIBCXX_FORCE_NEW=$(GLIBCXX_FORCE_NEW)) \
68 $(DEFS) \
69 $(if $(filter WNT,$(OS)),SAL_LOG_FILE="$(dir $(call gb_UITest_get_target,$*))/soffice.out.log") \
70 TEST_LIB=$(call gb_Library_get_target,test) \
71 URE_BOOTSTRAP=vnd.sun.star.pathname:$(call gb_Helper_get_rcfile,$(INSTROOT)/$(LIBO_ETC_FOLDER)/fundamental) \
72 PYTHONPATH="$(PYPATH)" \
73 TestUserDir="$(call gb_Helper_make_url,$(dir $(call gb_UITest_get_target,$*)))" \
74 PYTHONDONTWRITEBYTECODE=0 \
75 $(gb_TEST_ENV_VARS) \
76 $(gb_UITest_COMMAND) \
77 --soffice="$(gb_UITest_SOFFICEARG)" \
78 --userdir=$(call gb_Helper_make_url,$(dir $(call gb_UITest_get_target,$*))user) \
79 --dir=$(strip $(MODULES)) \
80 $(gb_UITest_GDBTRACE) \
81 $(if $(gb_UITest__interactive),, \
82 > $@.log 2>&1 \
83 || ($(if $(value gb_CppunitTest_postprocess), \
84 RET=$$?; \
85 $(call gb_CppunitTest_postprocess,$(gb_UITest_EXECUTABLE_GDB),$@.core,$$RET) >> $@.log 2>&1;) \
86 $(if $(filter WNT,$(OS)), \
87 printf '%s: <<<\n' $(dir $(call gb_UITest_get_target,$*))/soffice.out.log; \
88 cat $(dir $(call gb_UITest_get_target,$*))/soffice.out.log; \
89 printf ' >>>\n\n';) \
90 cat $@.log; $(gb_UITest_UNITTESTFAILED) UI $*))))
91 endif
93 # always use udkapi and URE services
94 define gb_UITest_UITest
95 $(call gb_UITest_get_target,$(1)) : PYPATH := $(SRCDIR)/uitest$$(gb_CLASSPATHSEP)$(SRCDIR)/unotest/source/python$$(gb_CLASSPATHSEP)$(INSTROOT)/$(LIBO_LIB_PYUNO_FOLDER)$(if $(filter-out $(LIBO_LIB_PYUNO_FOLDER),$(LIBO_LIB_FOLDER)),$(gb_CLASSPATHSEP)$(INSTROOT)/$(LIBO_LIB_FOLDER))
96 $(call gb_UITest_get_target,$(1)) : MODULES :=
98 $(eval $(call gb_Module_register_target,$(call gb_UITest_get_target,$(1)),$(call gb_UITest_get_clean_target,$(1))))
99 $(call gb_Helper_make_userfriendly_targets,$(1),UITest)
101 endef
103 define gb_UITest_set_defs
104 $(call gb_UITest_get_target,$(1)) : DEFS := $(2)
106 endef
108 # put the directory on the PYTHONPATH because the "unittest" loader
109 # mysteriously fails to load modules given as absolute path unless the $PWD is
110 # a prefix of the absolute path, which it is not when we go into a certain
111 # dir to get a core dump there
113 # gb_UITest_add_modules directory module(s)
114 define gb_UITest_add_modules
115 $(call gb_UITest_get_target,$(1)) : PYPATH := $$(PYPATH)$$(gb_CLASSPATHSEP)$(strip $(2))/$(strip $(3))
116 $(call gb_UITest_get_target,$(1)) : MODULES += $(strip $(2))/$(strip $(3))
118 endef
120 define gb_UITest_use_customtarget
121 $(call gb_UITest_get_target,$(1)) : $(call gb_CustomTarget_get_workdir,$(2))
123 endef
125 define gb_UITest_use_configuration
126 $(call gb_UITest_get_target,$(1)) : gb_UITest_use_config := $(2)
127 endef
130 else # DISABLE_PYTHON
132 .PHONY : $(call gb_UITest_get_target,$(1))
133 $(call gb_UITest_get_target,%) :
134 ifeq ($(gb_SUPPRESS_TESTS),)
135 $(call gb_Output_announce,$* (skipped - no UITest),$(true),PYT,2)
136 endif
137 @true
139 define gb_UITest_UITest
140 $(eval $(call gb_Module_register_target,$(call gb_UITest_get_target,$(1)),$(call gb_UITest_get_clean_target,$(1))))
141 $(call gb_Helper_make_userfriendly_targets,$(1),UITest)
143 endef
145 gb_UITest_set_defs :=
146 gb_UITest_add_modules :=
147 gb_UITest_use_customtarget :=
149 endif # DISABLE_PYTHON
150 # vim: set noet sw=4: