xref: /aoo41x/main/solenv/inc/installationtest.mk (revision f4026d8c)
1#**************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20#**************************************************************
21
22
23
24# relevant for non-product builds only, but built unconditionally
25.IF "$(ABORT_ON_ASSERTION)" != ""
26    DBGSV_ERROR_OUT=abort
27    SAL_DIAGNOSE_ABORT=TRUE
28    .EXPORT: SAL_DIAGNOSE_ABORT
29.ELSE
30    DBGSV_ERROR_OUT=shell
31.ENDIF
32.EXPORT: DBGSV_ERROR_OUT
33
34# don't allow to overwrite DBGSV_ERROR_OUT with an INI file. Otherwise, people
35# might be tempted to put an DBGSV_INIT into their .bash_profile which points to a file
36# delcaring to ignore all assertions completely ...
37DBGSV_INIT=
38.EXPORT: DBGSV_INIT
39
40.IF "$(OS)" == "WNT"
41my_file = file:///
42.ELSE
43my_file = file://
44.END
45
46# The following conditional is an approximation of: UPDATER set to YES and
47# SHIPDRIVE set and CWS_WORK_STAMP not set and either SOL_TMP not set or
48# SOLARENV set to a pathname of which SOL_TMP is not a prefix:
49.IF "$(UPDATER)" == "YES" && "$(SHIPDRIVE)" != "" && \
50    "$(CWS_WORK_STAMP)" == "" && "$(SOLARENV:s/$(SOL_TMP)//" == "$(SOLARENV)"
51my_instsets = $(shell ls -dt \
52    $(SHIPDRIVE)/$(INPATH)/OpenOffice/archive/$(WORK_STAMP)_$(LAST_MINOR)_native_packed-*_$(defaultlangiso).$(BUILD))
53installationtest_instset = $(my_instsets:1)
54.ELSE
55installationtest_instset = \
56    $(SOLARSRC)/instsetoo_native/$(INPATH)/OpenOffice/archive/install/$(defaultlangiso)
57.END
58
59.IF "$(OS)" == "WNT"
60installationtest_instpath = `cat $(MISC)/$(TARGET)/installation.flag`
61.ELSE
62installationtest_instpath = $(SOLARVERSION)/$(INPATH)/installation$(UPDMINOREXT)
63.END
64
65.IF "$(OS)" == "MACOSX"
66my_sofficepath = \
67    $(installationtest_instpath)/opt/OpenOffice.org.app/Contents/MacOS/soffice
68.ELIF "$(OS)" == "WNT"
69my_sofficepath = \
70    $(installationtest_instpath)'/opt/OpenOffice.org 3/program/soffice.exe'
71.ELSE
72my_sofficepath = \
73    $(installationtest_instpath)/opt/openoffice.org3/program/soffice
74.END
75
76.IF "$(OOO_TEST_SOFFICE)" == ""
77my_soffice = path:$(my_sofficepath)
78.ELSE
79my_soffice = '$(OOO_TEST_SOFFICE:s/'/'\''/)'
80.END
81
82.IF "$(OOO_LIBRARY_PATH_VAR)" != ""
83my_cppenv = \
84    -env:arg-env=$(OOO_LIBRARY_PATH_VAR)"$${{$(OOO_LIBRARY_PATH_VAR)+=$$$(OOO_LIBRARY_PATH_VAR)}}"
85my_javaenv = \
86    -Dorg.openoffice.test.arg.env=$(OOO_LIBRARY_PATH_VAR)"$${{$(OOO_LIBRARY_PATH_VAR)+=$$$(OOO_LIBRARY_PATH_VAR)}}"
87.END
88
89# Work around Windows problems with long pathnames (see issue 50885) by
90# installing into the temp directory instead of the module output tree (in which
91# case $(TARGET).installation.flag contains the path to the temp installation,
92# which is removed after smoketest); can be removed once issue 50885 is fixed;
93# on other platforms, a single installation to solver is created in
94# smoketestoo_native:
95.IF "$(OS)" == "WNT" && "$(OOO_TEST_SOFFICE)" == ""
96OOO_EXTRACT_TO:=$(shell cygpath -m `mktemp -dt ooosmoke.XXXXXX`)
97$(MISC)/$(TARGET)/installation.flag : $(shell \
98        ls $(installationtest_instset)/Apache_OpenOffice_*_install-arc_$(defaultlangiso).zip)
99    $(COMMAND_ECHO)$(MKDIRHIER) $(@:d)
100    $(COMMAND_ECHO)unzip -q $(installationtest_instset)/Apache_OpenOffice_*_install-arc_$(defaultlangiso).zip -d "$(OOO_EXTRACT_TO)"
101    $(COMMAND_ECHO)mv "$(OOO_EXTRACT_TO)"/Apache_OpenOffice_*_install-arc_$(defaultlangiso) "$(OOO_EXTRACT_TO)"/opt
102    $(COMMAND_ECHO)echo "$(OOO_EXTRACT_TO)" > $@
103.END
104
105cpptest .PHONY :
106    $(COMMAND_ECHO)$(RM) -r $(MISC)/$(TARGET)/user
107    $(COMMAND_ECHO)$(MKDIRHIER) $(MISC)/$(TARGET)/user
108    $(CPPUNITTESTER) \
109        -env:UNO_SERVICES=$(my_file)$(SOLARXMLDIR)/ure/services.rdb \
110        -env:UNO_TYPES=$(my_file)$(SOLARBINDIR)/types.rdb \
111        -env:arg-soffice=$(my_soffice) -env:arg-user=$(MISC)/$(TARGET)/user \
112        $(my_cppenv) $(TEST_ARGUMENTS:^"-env:arg-testarg.") --protector \
113        $(SOLARSHAREDBIN)/unoexceptionprotector$(DLLPOST) \
114        unoexceptionprotector $(CPPTEST_LIBRARY)
115# As a workaround for #i111400#, ignore failure of $(RM):
116    $(COMMAND_ECHO)- $(RM) -r $(MISC)/$(TARGET)/user
117.IF "$(OS)" == "WNT" && "$(OOO_TEST_SOFFICE)" == ""
118    $(COMMAND_ECHO)$(RM) -r $(installationtest_instpath) $(MISC)/$(TARGET)/installation.flag
119cpptest : $(MISC)/$(TARGET)/installation.flag
120.END
121
122.IF "$(SOLAR_JAVA)" == "TRUE" && "$(OOO_JUNIT_JAR)" != ""
123javatest_% .PHONY : $(JAVATARGET)
124    $(COMMAND_ECHO)$(RM) -r $(MISC)/$(TARGET)/user
125    $(COMMAND_ECHO)$(MKDIRHIER) $(MISC)/$(TARGET)/user
126    $(COMMAND_ECHO)$(JAVAI) $(JAVAIFLAGS) $(JAVACPS) \
127        '$(OOO_JUNIT_JAR)$(PATH_SEPERATOR)$(CLASSPATH)' \
128        -Dorg.openoffice.test.arg.soffice=$(my_soffice) \
129        -Dorg.openoffice.test.arg.user=$(my_file)$(PWD)/$(MISC)/$(TARGET)/user \
130        $(my_javaenv) $(TEST_ARGUMENTS:^"-Dorg.openoffice.test.arg.testarg.") \
131        org.junit.runner.JUnitCore \
132        $(subst,/,. $(PACKAGE)).$(@:s/javatest_//)
133    $(RM) -r $(MISC)/$(TARGET)/user
134.IF "$(OS)" == "WNT" && "$(OOO_TEST_SOFFICE)" == ""
135    $(RM) -r $(installationtest_instpath) $(MISC)/$(TARGET)/installation.flag
136javatest : $(MISC)/$(TARGET)/installation.flag
137.END
138javatest .PHONY : $(JAVATARGET)
139    $(COMMAND_ECHO)$(RM) -r $(MISC)/$(TARGET)/user
140    $(COMMAND_ECHO)$(MKDIRHIER) $(MISC)/$(TARGET)/user
141    $(COMMAND_ECHO)$(JAVAI) $(JAVAIFLAGS) $(JAVACPS) \
142        '$(OOO_JUNIT_JAR)$(PATH_SEPERATOR)$(CLASSPATH)' \
143        -Dorg.openoffice.test.arg.soffice=$(my_soffice) \
144        -Dorg.openoffice.test.arg.user=$(my_file)$(PWD)/$(MISC)/$(TARGET)/user \
145        $(my_javaenv) $(TEST_ARGUMENTS:^"-Dorg.openoffice.test.arg.testarg.") \
146        org.junit.runner.JUnitCore \
147        $(foreach,i,$(JAVATESTFILES) $(subst,/,. $(PACKAGE)).$(i:s/.java//))
148    $(RM) -r $(MISC)/$(TARGET)/user
149.IF "$(OS)" == "WNT" && "$(OOO_TEST_SOFFICE)" == ""
150    $(RM) -r $(installationtest_instpath) $(MISC)/$(TARGET)/installation.flag
151javatest : $(MISC)/$(TARGET)/installation.flag
152.END
153.ELSE
154javatest .PHONY :
155    @echo 'javatest needs SOLAR_JAVA=TRUE and OOO_JUNIT_JAR'
156.END
157