xref: /trunk/main/solenv/inc/installationtest.mk (revision dfce871f)
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)/Apache_OpenOffice/archive/$(WORK_STAMP)_$(LAST_MINOR)_native_packed-*_$(defaultlangiso).$(BUILD))
53installationtest_instset = $(my_instsets:1)
54.ELSE
55installationtest_instset = \
56    $(SOLARSRC)/instsetoo_native/$(INPATH)/Apache_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
105.IF "$(SOLAR_JAVA)" == "TRUE" && "$(OOO_JUNIT_JAR)" != ""
106javatest_% .PHONY : $(JAVATARGET)
107    $(COMMAND_ECHO)$(RM) -r $(MISC)/$(TARGET)/user
108    $(COMMAND_ECHO)$(MKDIRHIER) $(MISC)/$(TARGET)/user
109    $(COMMAND_ECHO)$(JAVAI) $(JAVAIFLAGS) $(JAVACPS) \
110        '$(OOO_JUNIT_JAR)$(PATH_SEPERATOR)$(CLASSPATH)' \
111        -Dorg.openoffice.test.arg.soffice=$(my_soffice) \
112        -Dorg.openoffice.test.arg.user=$(my_file)$(PWD)/$(MISC)/$(TARGET)/user \
113        $(my_javaenv) $(TEST_ARGUMENTS:^"-Dorg.openoffice.test.arg.testarg.") \
114        org.junit.runner.JUnitCore \
115        $(subst,/,. $(PACKAGE)).$(@:s/javatest_//)
116    $(RM) -r $(MISC)/$(TARGET)/user
117.IF "$(OS)" == "WNT" && "$(OOO_TEST_SOFFICE)" == ""
118    $(RM) -r $(installationtest_instpath) $(MISC)/$(TARGET)/installation.flag
119javatest : $(MISC)/$(TARGET)/installation.flag
120.END
121javatest .PHONY : $(JAVATARGET)
122    $(COMMAND_ECHO)$(RM) -r $(MISC)/$(TARGET)/user
123    $(COMMAND_ECHO)$(MKDIRHIER) $(MISC)/$(TARGET)/user
124    $(COMMAND_ECHO)$(JAVAI) $(JAVAIFLAGS) $(JAVACPS) \
125        '$(OOO_JUNIT_JAR)$(PATH_SEPERATOR)$(CLASSPATH)' \
126        -Dorg.openoffice.test.arg.soffice=$(my_soffice) \
127        -Dorg.openoffice.test.arg.user=$(my_file)$(PWD)/$(MISC)/$(TARGET)/user \
128        $(my_javaenv) $(TEST_ARGUMENTS:^"-Dorg.openoffice.test.arg.testarg.") \
129        org.junit.runner.JUnitCore \
130        $(foreach,i,$(JAVATESTFILES) $(subst,/,. $(PACKAGE)).$(i:s/.java//))
131    $(RM) -r $(MISC)/$(TARGET)/user
132.IF "$(OS)" == "WNT" && "$(OOO_TEST_SOFFICE)" == ""
133    $(RM) -r $(installationtest_instpath) $(MISC)/$(TARGET)/installation.flag
134javatest : $(MISC)/$(TARGET)/installation.flag
135.END
136.ELSE
137javatest .PHONY :
138    @echo 'javatest needs SOLAR_JAVA=TRUE and OOO_JUNIT_JAR'
139.END
140