1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
2 #*************************************************************************
4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 # Copyright 2000, 2011 Oracle and/or its affiliates.
8 # OpenOffice.org - a multi-platform office productivity suite
10 # This file is part of OpenOffice.org.
12 # OpenOffice.org is free software: you can redistribute it and/or modify
13 # it under the terms of the GNU Lesser General Public License version 3
14 # only, as published by the Free Software Foundation.
16 # OpenOffice.org is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU Lesser General Public License version 3 for more details
20 # (a copy is included in the LICENSE file that accompanied this code).
22 # You should have received a copy of the GNU Lesser General Public License
23 # version 3 along with OpenOffice.org. If not, see
24 # <http://www.openoffice.org/license.html>
25 # for a copy of the LGPLv3 License.
27 #*************************************************************************
32 gb_JunitTest_JAVACOMMAND
:= $(JAVAINTERPRETER
) $(JAVAIFLAGS
)
35 .PHONY
: $(call gb_JunitTest_get_clean_target
,%)
36 $(call gb_JunitTest_get_clean_target
,%) : $(call gb_JavaClassSet_get_clean_target
,$(call gb_JunitTest_get_classsetname
,%))
37 $(call gb_Helper_abbreviate_dirs
,\
40 ifneq (,$(strip $(OOO_JUNIT_JAR
)))
42 # 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
43 .PHONY
: $(call gb_JunitTest_get_target
,%)
44 $(call gb_JunitTest_get_target
,%) :
45 $(call gb_Output_announce
,$*,$(true
),JUT
,2)
46 $(call gb_Helper_abbreviate_dirs
,\
47 rm -rf
$(call gb_JunitTest_get_userdir
,$*) && \
48 mkdir
-p
$(call gb_JunitTest_get_userdir
,$*) && \
49 (DBGSV_ERROR_OUT
=shell $(gb_JunitTest_JAVACOMMAND
) \
52 org.junit.runner.JUnitCore \
53 $(CLASSES
) > $@.log
2>&1 || \
54 (grep
-v
-e
'at org.junit.' \
55 -e
'at java.lang.reflect.' \
56 -e
'at sun.reflect.' $@.log \
57 && echo
"see full error log at $@.log" \
58 && echo
"to rerun just this failed test without all others, run:" \
59 && echo
&& echo
" make $@" && echo \
60 && echo
"cd into the module dir to run the tests faster" \
61 && echo
"Or to do interactive debugging, run two shells with (Linux only):" \
63 && echo
" make debugrun" \
64 && echo
" make gb_JunitTest_DEBUGRUN=T $@" \
67 rm -rf
$(call gb_JunitTest_get_userdir
,$*))
70 define gb_JunitTest_JunitTest
71 $(call gb_JunitTest_get_target
,$(1)) : T_CP
:= $(if
$(value XCLASSPATH
),$$(value XCLASSPATH
)$$(gb_CLASSPATHSEP
))$(call gb_JavaClassSet_get_classdir
,$(call gb_JunitTest_get_classsetname
,$(1)))$$(gb_CLASSPATHSEP
)$(OOO_JUNIT_JAR
)$$(gb_CLASSPATHSEP
)$(OUTDIR
)/lib
72 $(call gb_JunitTest_get_target
,$(1)) : CLASSES
:=
73 $(eval
$(call gb_JunitTest_JunitTest_platform
,$(1)))
75 $(call gb_JavaClassSet_JavaClassSet
,$(call gb_JunitTest_get_classsetname
,$(1)))
76 $(call gb_JavaClassSet_use_system_jar
,$(call gb_JunitTest_get_classsetname
,$(1)),$(OOO_JUNIT_JAR
))
77 $(call gb_JunitTest_get_target
,$(1)) : $(call gb_JavaClassSet_get_target
,$(call gb_JunitTest_get_classsetname
,$(1)))
78 $(eval
$(call gb_Module_register_target
,$(call gb_JunitTest_get_target
,$(1)),$(call gb_JunitTest_get_clean_target
,$(1))))
81 define gb_JunitTest_set_defs
82 $(call gb_JunitTest_get_target
,$(1)) : DEFS
:= $(2)
86 define gb_JunitTest_add_classes
87 $(call gb_JunitTest_get_target
,$(1)) : CLASSES
+= $(2)
91 define gb_JunitTest_add_class
92 $(call gb_JunitTest_add_classes
,$(1),$(2))
97 define gb_JunitTest_add_sourcefile
98 $(call gb_JavaClassSet_add_sourcefile
,$(call gb_JunitTest_get_classsetname
,$(1)),$(2))
102 define gb_JunitTest_add_sourcefiles
103 $(foreach sourcefile
,$(2),$(call gb_JunitTest_add_sourcefile
,$(1),$(sourcefile
)))
107 define gb_JunitTest_add_jar
108 $$(call gb_Output_error
,\
109 gb_JunitTest_add_jar
: use gb_JunitTest_use_jar instead.
)
112 define gb_JunitTest_use_jar
113 $(call gb_JavaClassSet_use_jar
,$(call gb_JunitTest_get_classsetname
,$(1)),$(2))
114 $(call gb_JunitTest_get_target
,$(1)) : T_CP
:= $$(T_CP
)$$(gb_CLASSPATHSEP
)$(2)
115 $(call gb_JunitTest_get_target
,$(1)) : $(2)
116 $(2) :|
$(gb_Helper_PHONY
)
120 define gb_JunitTest_add_jars
121 $$(call gb_Output_error
,\
122 gb_JunitTest_add_jars
: use gb_JunitTest_use_jars instead.
)
125 define gb_JunitTest_use_jars
126 $(foreach jar
,$(2),$(call gb_JunitTest_use_jar
,$(1),$(jar
)))
130 define gb_JunitTest_add_jar_classset
131 $$(call gb_Output_error
,\
132 gb_JunitTest_add_jar_classset
: use gb_JunitTest_use_jar_classset instead.
)
135 # see gb_JavaClassSet_use_jar_classset
136 define gb_JunitTest_use_jar_classset
137 $(call gb_JavaClassSet_use_jar_classset
,$(call gb_JunitTest_get_classsetname
,$(1)),$(2))
138 $(call gb_JunitTest_get_target
,$(1)) : T_CP
:= $$(T_CP
)$$(gb_CLASSPATHSEP
)$(call gb_JavaClassSet_get_classdir
,$(call gb_Jar_get_classsetname
,$(2)))
142 define gb_JunitTest_add_customtarget_dependency
143 $$(call gb_Output_error
,\
144 gb_JunitTest_add_customtarget_dependency
: use gb_Jar_use_customtarget instead.
)
147 define gb_JunitTest_use_customtarget
148 $(call gb_JavaClassSet_use_customtarget
,$(call gb_JunitTest_get_classsetname
,$(1)),$(2))
152 define gb_JunitTest_add_customtarget_dependencies
153 $$(call gb_Output_error
,\
154 gb_JunitTest_add_customtarget_dependencies
: use gb_Jar_use_customtargets instead.
)
157 define gb_JunitTest_use_customtargets
158 $(foreach dependency
,$(2),$(call gb_JunitTest_use_customtarget
,$(1),$(dependency
)))
164 .PHONY
: $(call gb_JunitTest_get_target
,$(1))
165 $(call gb_JunitTest_get_target
,%) :
166 $(call gb_Output_announce
,$* (skipped
- no Junit
),$(true
),JUT
,2)
169 define gb_JunitTest_JunitTest
170 $(eval
$(call gb_Module_register_target
,$(call gb_JunitTest_get_target
,$(1)),$(call gb_JunitTest_get_clean_target
,$(1))))
173 gb_JunitTest_set_defs
:=
174 gb_JunitTest_add_classes
:=
175 gb_JunitTest_add_class
:=
176 gb_JunitTest_add_sourcefile
:=
177 gb_JunitTest_add_sourcefiles
:=
178 gb_JunitTest_use_jar
:=
179 gb_JunitTest_use_jars
:=
180 gb_JunitTest_use_jar_classset
:=
181 gb_JunitTest_use_customtarget
:=
182 gb_JunitTest_use_customtargets
:=
184 endif # OOO_JUNIT_JAR
185 # vim: set noet sw=4: