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/.
9 # This file incorporates work covered by the following license notice:
11 # Licensed to the Apache Software Foundation (ASF) under one or more
12 # contributor license agreements. See the NOTICE file distributed
13 # with this work for additional information regarding copyright
14 # ownership. The ASF licenses this file to you under the Apache
15 # License, Version 2.0 (the "License"); you may not use this file
16 # except in compliance with the License. You may obtain a copy of
17 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
23 gb_JunitTest_JAVACOMMAND
:= $(JAVAINTERPRETER
) $(JAVAIFLAGS
)
26 .PHONY
: $(call gb_JunitTest_get_clean_target
,%)
27 $(call gb_JunitTest_get_clean_target
,%) : $(call gb_JavaClassSet_get_clean_target
,$(call gb_JunitTest_get_classsetname
,%))
28 $(call gb_Helper_abbreviate_dirs
,\
31 ifneq (,$(strip $(OOO_JUNIT_JAR
)))
33 # DBGSV_ERROR_OUT => in non-product builds, ensure that tools-based assertions do not pop up as message box, but are routed to the shell
34 # DISABLE_SAL_DBGBOX is the same, for osl/diagnose.h on Windows only
35 .PHONY
: $(call gb_JunitTest_get_target
,%)
36 $(call gb_JunitTest_get_target
,%) :
37 $(call gb_Output_announce
,$*,$(true
),JUT
,2)
38 $(call gb_Helper_abbreviate_dirs
,\
39 rm -rf
$(call gb_JunitTest_get_userdir
,$*) && \
40 mkdir
-p
$(call gb_JunitTest_get_userdir
,$*) && \
41 (DBGSV_ERROR_OUT
=shell DISABLE_SAL_DBGBOX
=t \
42 $(gb_JunitTest_JAVACOMMAND
) \
43 -classpath
"$(T_CP)" \
45 org.junit.runner.JUnitCore \
46 $(CLASSES
) > $@.log
2>&1 || \
48 && echo
"to rerun just this failed test without all others, run:" \
49 && echo
&& echo
" make JunitTest_$*" && echo \
50 && echo
"cd into the module dir to run the tests faster" \
51 && echo
"Or to do interactive debugging (non-Windows), run two shells with:" \
53 && echo
" make debugrun" \
54 && echo
" make gb_JunitTest_DEBUGRUN=T JunitTest_$*" \
59 define gb_JunitTest_JunitTest
60 $(call gb_JunitTest_get_target
,$(1)) : T_CP
:= $(call gb_JavaClassSet_get_classdir
,$(call gb_JunitTest_get_classsetname
,$(1)))$$(gb_CLASSPATHSEP
)$(OOO_JUNIT_JAR
)$$(gb_CLASSPATHSEP
)$(INSTROOT
)/$(LIBO_URE_LIB_FOLDER
)
61 $(call gb_JunitTest_get_target
,$(1)) : CLASSES
:=
62 $(eval
$(call gb_JunitTest_JunitTest_platform
,$(1)))
64 $(call gb_JavaClassSet_JavaClassSet
,$(call gb_JunitTest_get_classsetname
,$(1)))
65 $(call gb_JavaClassSet_use_system_jar
,$(call gb_JunitTest_get_classsetname
,$(1)),$(OOO_JUNIT_JAR
))
66 $(call gb_JunitTest_get_target
,$(1)) : $(call gb_JavaClassSet_get_target
,$(call gb_JunitTest_get_classsetname
,$(1)))
67 $(eval
$(call gb_Module_register_target
,$(call gb_JunitTest_get_target
,$(1)),$(call gb_JunitTest_get_clean_target
,$(1))))
68 $(call gb_Helper_make_userfriendly_targets
,$(1),JunitTest
)
72 define gb_JunitTest_set_defs
73 $(call gb_JunitTest_get_target
,$(1)) : DEFS
:= $(2)
77 define gb_JunitTest_add_classes
78 $(call gb_JunitTest_get_target
,$(1)) : CLASSES
+= $(2)
82 define gb_JunitTest_add_class
83 $(call gb_JunitTest_add_classes
,$(1),$(2))
88 define gb_JunitTest_add_sourcefile
89 $(call gb_JavaClassSet_add_sourcefile
,$(call gb_JunitTest_get_classsetname
,$(1)),$(2))
93 define gb_JunitTest_add_sourcefiles
94 $(foreach sourcefile
,$(2),$(call gb_JunitTest_add_sourcefile
,$(1),$(sourcefile
)))
98 define gb_JunitTest_use_jar
99 $(call gb_JavaClassSet_use_jar
,$(call gb_JunitTest_get_classsetname
,$(1)),$(2))
100 $(call gb_JunitTest_get_target
,$(1)) : T_CP
:= $$(T_CP
)$$(gb_CLASSPATHSEP
)$(call gb_Jar_get_target
,$(2))
101 $(call gb_JunitTest_get_target
,$(1)) : $(call gb_Jar_get_target
,$(2))
105 define gb_JunitTest_use_jars
106 $(foreach jar
,$(2),$(call gb_JunitTest_use_jar
,$(1),$(jar
)))
110 # see gb_JavaClassSet_use_jar_classset
111 define gb_JunitTest_use_jar_classset
112 $(call gb_JavaClassSet_use_jar_classset
,$(call gb_JunitTest_get_classsetname
,$(1)),$(2))
113 $(call gb_JunitTest_get_target
,$(1)) : T_CP
:= $$(T_CP
)$$(gb_CLASSPATHSEP
)$(call gb_JavaClassSet_get_classdir
,$(call gb_Jar_get_classsetname
,$(2)))
117 define gb_JunitTest_use_system_jar
118 $(call gb_JavaClassSet_use_system_jar
,$(call gb_JunitTest_get_classsetname
,$(1)),$(2))
122 define gb_JunitTest_use_system_jars
123 $(foreach jar
,$(2),$(call gb_JunitTest_use_system_jar
,$(1),$(jar
)))
127 # this forwards to functions that must be defined in RepositoryExternal.mk.
128 # $(eval $(call gb_JunitTest_use_external,jar,external))
129 define gb_JunitTest_use_external
130 $(if
$(value gb_JunitTest__use_
$(2)),\
131 $(call gb_JunitTest__use_
$(2),$(1)),\
132 $(error gb_JunitTest_use_external
: unknown external
: $(2)))
136 define gb_JunitTest_use_externals
137 $(foreach external
,$(2),$(call gb_JunitTest_use_external
,$(1),$(external
)))
141 define gb_JunitTest_use_customtarget
142 $(call gb_JavaClassSet_use_customtarget
,$(call gb_JunitTest_get_classsetname
,$(1)),$(2))
143 $(call gb_JunitTest_get_target
,$(1)) : T_CP
:= $$(T_CP
)$$(gb_CLASSPATHSEP
)$(call gb_CustomTarget_get_workdir
,$(2))
147 define gb_JunitTest_use_customtargets
148 $(foreach dependency
,$(2),$(call gb_JunitTest_use_customtarget
,$(1),$(dependency
)))
154 .PHONY
: $(call gb_JunitTest_get_target
,$(1))
155 $(call gb_JunitTest_get_target
,%) :
156 $(call gb_Output_announce
,$* (skipped
- no Junit
),$(true
),JUT
,2)
159 define gb_JunitTest_JunitTest
160 $(eval
$(call gb_Module_register_target
,$(call gb_JunitTest_get_target
,$(1)),$(call gb_JunitTest_get_clean_target
,$(1))))
161 $(call gb_Helper_make_userfriendly_targets
,$(1),JunitTest
)
165 gb_JunitTest_set_defs
:=
166 gb_JunitTest_add_classes
:=
167 gb_JunitTest_add_class
:=
168 gb_JunitTest_add_sourcefile
:=
169 gb_JunitTest_add_sourcefiles
:=
170 gb_JunitTest_use_jar
:=
171 gb_JunitTest_use_jars
:=
172 gb_JunitTest_use_jar_classset
:=
173 gb_JunitTest_use_system_jar
:=
174 gb_JunitTest_use_system_jars
:=
175 gb_JunitTest_use_external
:=
176 gb_JunitTest_use_externals
:=
177 gb_JunitTest_use_customtarget
:=
178 gb_JunitTest_use_customtargets
:=
180 endif # OOO_JUNIT_JAR
181 # vim: set noet sw=4: