xref: /aoo41x/main/solenv/inc/installationtest.mk (revision cdf0e10c)
1#*************************************************************************
2# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3#
4# Copyright 2000, 2010 Oracle and/or its affiliates.
5#
6# OpenOffice.org - a multi-platform office productivity suite
7#
8# This file is part of OpenOffice.org.
9#
10# OpenOffice.org is free software: you can redistribute it and/or modify
11# it under the terms of the GNU Lesser General Public License version 3
12# only, as published by the Free Software Foundation.
13#
14# OpenOffice.org is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17# GNU Lesser General Public License version 3 for more details
18# (a copy is included in the LICENSE file that accompanied this code).
19#
20# You should have received a copy of the GNU Lesser General Public License
21# version 3 along with OpenOffice.org.  If not, see
22# <http://www.openoffice.org/license.html>
23# for a copy of the LGPLv3 License.
24#***********************************************************************/
25
26# relevant for non-product builds only, but built unconditionally
27.IF "$(ABORT_ON_ASSERTION)" != ""
28    DBGSV_ERROR_OUT=abort
29    SAL_DIAGNOSE_ABORT=TRUE
30    .EXPORT: SAL_DIAGNOSE_ABORT
31.ELSE
32    DBGSV_ERROR_OUT=shell
33.ENDIF
34.EXPORT: DBGSV_ERROR_OUT
35
36# don't allow to overwrite DBGSV_ERROR_OUT with an INI file. Otherwise, people
37# might be tempted to put an DBGSV_INIT into their .bash_profile which points to a file
38# delcaring to ignore all assertions completely ...
39DBGSV_INIT=
40.EXPORT: DBGSV_INIT
41
42.IF "$(OS)" == "WNT"
43my_file = file:///
44.ELSE
45my_file = file://
46.END
47
48# The following conditional is an approximation of: UPDATER set to YES and
49# SHIPDRIVE set and CWS_WORK_STAMP not set and either SOL_TMP not set or
50# SOLARENV set to a pathname of which SOL_TMP is not a prefix:
51.IF "$(UPDATER)" == "YES" && "$(SHIPDRIVE)" != "" && \
52    "$(CWS_WORK_STAMP)" == "" && "$(SOLARENV:s/$(SOL_TMP)//" == "$(SOLARENV)"
53my_instsets = $(shell ls -dt \
54    $(SHIPDRIVE)/$(INPATH)/OpenOffice/archive/$(WORK_STAMP)_$(LAST_MINOR)_native_packed-*_$(defaultlangiso).$(BUILD))
55installationtest_instset = $(my_instsets:1)
56.ELSE
57installationtest_instset = \
58    $(SOLARSRC)/instsetoo_native/$(INPATH)/OpenOffice/archive/install/$(defaultlangiso)
59.END
60
61.IF "$(OS)" == "WNT"
62installationtest_instpath = `cat $(MISC)/$(TARGET)/installation.flag`
63.ELSE
64installationtest_instpath = $(SOLARVERSION)/$(INPATH)/installation$(UPDMINOREXT)
65.END
66
67.IF "$(OS)" == "MACOSX"
68my_sofficepath = \
69    $(installationtest_instpath)/opt/OpenOffice.org.app/Contents/MacOS/soffice
70.ELIF "$(OS)" == "WNT"
71my_sofficepath = \
72    $(installationtest_instpath)'/opt/OpenOffice.org 3/program/soffice.exe'
73.ELSE
74my_sofficepath = \
75    $(installationtest_instpath)/opt/openoffice.org3/program/soffice
76.END
77
78.IF "$(OOO_TEST_SOFFICE)" == ""
79my_soffice = path:$(my_sofficepath)
80.ELSE
81my_soffice = '$(OOO_TEST_SOFFICE:s/'/'\''/)'
82.END
83
84.IF "$(OOO_LIBRARY_PATH_VAR)" != ""
85my_cppenv = \
86    -env:arg-env=$(OOO_LIBRARY_PATH_VAR)"$${{$(OOO_LIBRARY_PATH_VAR)+=$$$(OOO_LIBRARY_PATH_VAR)}}"
87my_javaenv = \
88    -Dorg.openoffice.test.arg.env=$(OOO_LIBRARY_PATH_VAR)"$${{$(OOO_LIBRARY_PATH_VAR)+=$$$(OOO_LIBRARY_PATH_VAR)}}"
89.END
90
91# Work around Windows problems with long pathnames (see issue 50885) by
92# installing into the temp directory instead of the module output tree (in which
93# case $(TARGET).installation.flag contains the path to the temp installation,
94# which is removed after smoketest); can be removed once issue 50885 is fixed;
95# on other platforms, a single installation to solver is created in
96# smoketestoo_native:
97.IF "$(OS)" == "WNT" && "$(OOO_TEST_SOFFICE)" == ""
98OOO_EXTRACT_TO:=$(shell cygpath -m `mktemp -dt ooosmoke.XXXXXX`)
99$(MISC)/$(TARGET)/installation.flag : $(shell \
100        ls $(installationtest_instset)/OOo_*_install-arc_$(defaultlangiso).zip)
101    $(COMMAND_ECHO)$(MKDIRHIER) $(@:d)
102    $(COMMAND_ECHO)unzip -q $(installationtest_instset)/OOo_*_install-arc_$(defaultlangiso).zip -d "$(OOO_EXTRACT_TO)"
103    $(COMMAND_ECHO)mv "$(OOO_EXTRACT_TO)"/OOo_*_install-arc_$(defaultlangiso) "$(OOO_EXTRACT_TO)"/opt
104    $(COMMAND_ECHO)echo "$(OOO_EXTRACT_TO)" > $@
105.END
106
107cpptest .PHONY :
108    $(COMMAND_ECHO)$(RM) -r $(MISC)/$(TARGET)/user
109    $(COMMAND_ECHO)$(MKDIRHIER) $(MISC)/$(TARGET)/user
110    $(CPPUNITTESTER) \
111        -env:UNO_SERVICES=$(my_file)$(SOLARXMLDIR)/ure/services.rdb \
112        -env:UNO_TYPES=$(my_file)$(SOLARBINDIR)/types.rdb \
113        -env:arg-soffice=$(my_soffice) -env:arg-user=$(MISC)/$(TARGET)/user \
114        $(my_cppenv) $(TEST_ARGUMENTS:^"-env:arg-testarg.") --protector \
115        $(SOLARSHAREDBIN)/unoexceptionprotector$(DLLPOST) \
116        unoexceptionprotector $(CPPTEST_LIBRARY)
117# As a workaround for #i111400#, ignore failure of $(RM):
118    $(COMMAND_ECHO)- $(RM) -r $(MISC)/$(TARGET)/user
119.IF "$(OS)" == "WNT" && "$(OOO_TEST_SOFFICE)" == ""
120    $(COMMAND_ECHO)$(RM) -r $(installationtest_instpath) $(MISC)/$(TARGET)/installation.flag
121cpptest : $(MISC)/$(TARGET)/installation.flag
122.END
123
124.IF "$(SOLAR_JAVA)" == "TRUE" && "$(OOO_JUNIT_JAR)" != ""
125javatest_% .PHONY : $(JAVATARGET)
126    $(COMMAND_ECHO)$(RM) -r $(MISC)/$(TARGET)/user
127    $(COMMAND_ECHO)$(MKDIRHIER) $(MISC)/$(TARGET)/user
128    $(COMMAND_ECHO)$(JAVAI) $(JAVAIFLAGS) $(JAVACPS) \
129        '$(OOO_JUNIT_JAR)$(PATH_SEPERATOR)$(CLASSPATH)' \
130        -Dorg.openoffice.test.arg.soffice=$(my_soffice) \
131        -Dorg.openoffice.test.arg.user=$(my_file)$(PWD)/$(MISC)/$(TARGET)/user \
132        $(my_javaenv) $(TEST_ARGUMENTS:^"-Dorg.openoffice.test.arg.testarg.") \
133        org.junit.runner.JUnitCore \
134        $(subst,/,. $(PACKAGE)).$(@:s/javatest_//)
135    $(RM) -r $(MISC)/$(TARGET)/user
136.IF "$(OS)" == "WNT" && "$(OOO_TEST_SOFFICE)" == ""
137    $(RM) -r $(installationtest_instpath) $(MISC)/$(TARGET)/installation.flag
138javatest : $(MISC)/$(TARGET)/installation.flag
139.END
140javatest .PHONY : $(JAVATARGET)
141    $(COMMAND_ECHO)$(RM) -r $(MISC)/$(TARGET)/user
142    $(COMMAND_ECHO)$(MKDIRHIER) $(MISC)/$(TARGET)/user
143    $(COMMAND_ECHO)$(JAVAI) $(JAVAIFLAGS) $(JAVACPS) \
144        '$(OOO_JUNIT_JAR)$(PATH_SEPERATOR)$(CLASSPATH)' \
145        -Dorg.openoffice.test.arg.soffice=$(my_soffice) \
146        -Dorg.openoffice.test.arg.user=$(my_file)$(PWD)/$(MISC)/$(TARGET)/user \
147        $(my_javaenv) $(TEST_ARGUMENTS:^"-Dorg.openoffice.test.arg.testarg.") \
148        org.junit.runner.JUnitCore \
149        $(foreach,i,$(JAVATESTFILES) $(subst,/,. $(PACKAGE)).$(i:s/.java//))
150    $(RM) -r $(MISC)/$(TARGET)/user
151.IF "$(OS)" == "WNT" && "$(OOO_TEST_SOFFICE)" == ""
152    $(RM) -r $(installationtest_instpath) $(MISC)/$(TARGET)/installation.flag
153javatest : $(MISC)/$(TARGET)/installation.flag
154.END
155.ELSE
156javatest .PHONY :
157    @echo 'javatest needs SOLAR_JAVA=TRUE and OOO_JUNIT_JAR'
158.END
159