Author: jsc Date: Mon Jun 2 10:57:39 2014 New Revision: 1599163 URL: http://svn.apache.org/r1599163 Log: #125003# integrate googletest framework for general use for unit testing
Added: openoffice/trunk/ext_libraries/gtest/ openoffice/trunk/ext_libraries/gtest/gtest_version.mk openoffice/trunk/ext_libraries/gtest/makefile.mk openoffice/trunk/ext_libraries/gtest/prj/ openoffice/trunk/ext_libraries/gtest/prj/build.lst openoffice/trunk/ext_libraries/gtest/prj/d.lst openoffice/trunk/ext_libraries/gtest/win/ openoffice/trunk/ext_libraries/gtest/win/Library_gtest.mk openoffice/trunk/ext_libraries/gtest/win/Makefile openoffice/trunk/ext_libraries/gtest/win/Module_gtest.mk openoffice/trunk/ext_libraries/gtest/win/Package_inc.mk Modified: openoffice/trunk/ext_libraries/Repository.mk openoffice/trunk/ext_libraries/RepositoryFixes.mk openoffice/trunk/main/configure.in openoffice/trunk/main/external_deps.lst openoffice/trunk/main/sal/prj/build.lst openoffice/trunk/main/sal/qa/sal/makefile.mk openoffice/trunk/main/sal/qa/sal/test_types.cxx openoffice/trunk/main/set_soenv.in openoffice/trunk/main/solenv/inc/_tg_app.mk openoffice/trunk/main/solenv/inc/libs.mk openoffice/trunk/main/solenv/inc/target.mk openoffice/trunk/main/solenv/inc/tg_app.mk Modified: openoffice/trunk/ext_libraries/Repository.mk URL: http://svn.apache.org/viewvc/openoffice/trunk/ext_libraries/Repository.mk?rev=1599163&r1=1599162&r2=1599163&view=diff ============================================================================== --- openoffice/trunk/ext_libraries/Repository.mk (original) +++ openoffice/trunk/ext_libraries/Repository.mk Mon Jun 2 10:57:39 2014 @@ -32,4 +32,5 @@ $(eval $(call gb_Helper_register_librari libeay32 \ ssleay32 \ zlib \ -)) \ No newline at end of file + gtest \ +)) Modified: openoffice/trunk/ext_libraries/RepositoryFixes.mk URL: http://svn.apache.org/viewvc/openoffice/trunk/ext_libraries/RepositoryFixes.mk?rev=1599163&r1=1599162&r2=1599163&view=diff ============================================================================== --- openoffice/trunk/ext_libraries/RepositoryFixes.mk (original) +++ openoffice/trunk/ext_libraries/RepositoryFixes.mk Mon Jun 2 10:57:39 2014 @@ -27,6 +27,7 @@ gb_Library_FILENAMES := $(patsubst expat gb_Library_FILENAMES := $(patsubst libeay32:ilibeay32%,libeay32:libeay32%,$(gb_Library_FILENAMES)) gb_Library_FILENAMES := $(patsubst ssleay32:issleay32%,ssleay32:ssleay32%,$(gb_Library_FILENAMES)) gb_Library_FILENAMES := $(patsubst zlib:izlib%,zlib:zlib%,$(gb_Library_FILENAMES)) +gb_Library_FILENAMES := $(patsubst gtest:igtest%,gtest:igtest%,$(gb_Library_FILENAMES)) endif #gb_Library_FILENAMES := $(patsubst apr-util:iapr-util%,apr:libapr-util-1%,$(gb_Library_FILENAMES)) Added: openoffice/trunk/ext_libraries/gtest/gtest_version.mk URL: http://svn.apache.org/viewvc/openoffice/trunk/ext_libraries/gtest/gtest_version.mk?rev=1599163&view=auto ============================================================================== --- openoffice/trunk/ext_libraries/gtest/gtest_version.mk (added) +++ openoffice/trunk/ext_libraries/gtest/gtest_version.mk Mon Jun 2 10:57:39 2014 @@ -0,0 +1,24 @@ +#************************************************************** +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +#************************************************************** + +GTEST_MAJOR=1 +GTEST_MINOR=7 +GTEST_MICRO=0 Added: openoffice/trunk/ext_libraries/gtest/makefile.mk URL: http://svn.apache.org/viewvc/openoffice/trunk/ext_libraries/gtest/makefile.mk?rev=1599163&view=auto ============================================================================== --- openoffice/trunk/ext_libraries/gtest/makefile.mk (added) +++ openoffice/trunk/ext_libraries/gtest/makefile.mk Mon Jun 2 10:57:39 2014 @@ -0,0 +1,100 @@ +#************************************************************** +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +#************************************************************** + +PRJ=. + +PRJNAME=gtest +TARGET=oo_gtest + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : gtest_version.mk + +# --- Files -------------------------------------------------------- + +.IF "$(ENABLE_UNIT_TESTS)"!="YES" + +all: + @echo "Unit tests are disabled. Does not have to be built." + +.ELSE + +# Assemble the full version number from the parts defined in gtest_version.mk +LIBGTESTVERSION=$(GTEST_MAJOR).$(GTEST_MINOR).$(GTEST_MICRO) + +TARFILE_NAME=$(PRJNAME)-$(LIBGTESTVERSION) +# This is the SHA1 checksum, not MD5 but tg_ext.mk does not now about this and, +# thankfully, does not care. +TARFILE_MD5=2d6ec8ccdf5c46b05ba54a9fd1d130d7 + +PATCH_FILES= + +.IF "$(OS)"=="WNT" + +CONFIGURE_DIR= +# dirty hack for gbuild whihc relies on .cxx extension for C++ files +CONFIGURE_ACTION=cp src/gtest-all.cc src/gtest-all.cxx +CONFIGURE_FLAGS= + +BUILD_DIR= +BUILD_ACTION=$(GNUMAKE) +BUILD_FLAGS+= -f ../../../../win/Makefile -j$(EXTMAXPROCESS) + +.ELIF "$(GUI)" == "OS2" + +@all: + @echo "using system serf. nothing do do." + +.ELSE + +CONFIGURE_DIR= +CONFIGURE_ACTION=autoconf && .$/configure + +.IF "$(OS)"=="MACOSX" +CONFIGURE_FLAGS='CXX=$(CXX)' +CONFIGURE_FLAGS+='CXXFLAGS=-stdlib=libc++ -U__STRICT_ANSI__' +.ENDIF + +BUILD_DIR=$(CONFIGURE_DIR) +BUILD_ACTION=$(GNUMAKE) +BUILD_FLAGS+= -j$(EXTMAXPROCESS) + + +OUTDIR2INC=include/gtest + +.IF "$(OS)"=="MACOSX" +OUT2LIB=lib/.libs/libgtest.*dylib +#OUT2LIB+=lib/.libs/libgtest_main.*dylib +.ELSE +OUT2LIB=lib/.libs/libgtest.so* +#OUT2LIB+=lib/.libs/libgtest_main.so* +.ENDIF + +.ENDIF + +# --- Targets ------------------------------------------------------ + +.INCLUDE : set_ext.mk +.INCLUDE : target.mk +.INCLUDE : tg_ext.mk + +.ENDIF Added: openoffice/trunk/ext_libraries/gtest/prj/build.lst URL: http://svn.apache.org/viewvc/openoffice/trunk/ext_libraries/gtest/prj/build.lst?rev=1599163&view=auto ============================================================================== --- openoffice/trunk/ext_libraries/gtest/prj/build.lst (added) +++ openoffice/trunk/ext_libraries/gtest/prj/build.lst Mon Jun 2 10:57:39 2014 @@ -0,0 +1,3 @@ +gtest gtest : NULL +gtest gtest usr1 - all gtest_mkout NULL +gtest gtest nmake - all gtest_gtest NULL Added: openoffice/trunk/ext_libraries/gtest/prj/d.lst URL: http://svn.apache.org/viewvc/openoffice/trunk/ext_libraries/gtest/prj/d.lst?rev=1599163&view=auto ============================================================================== --- openoffice/trunk/ext_libraries/gtest/prj/d.lst (added) +++ openoffice/trunk/ext_libraries/gtest/prj/d.lst Mon Jun 2 10:57:39 2014 @@ -0,0 +1,20 @@ +mkdir: %_DEST%\inc%_EXT%\gtest +mkdir: %_DEST%\inc%_EXT%\gtest\internal +..\%__SRC%\inc\gtest\gtest*.h %_DEST%\inc%_EXT%\gtest +..\%__SRC%\inc\gtest\internal\gtest*.h %_DEST%\inc%_EXT%\gtest\internal +..\gtest_version.mk %_DEST%\inc%_EXT% + +# Mac +..\%__SRC%\lib\libgtest.*dylib %_DEST%\lib%_EXT% +#..\%__SRC%\lib\libgtest-main.*dylib %_DEST%\lib%_EXT% + +# Linux, BSD, et al +..\%__SRC%\lib\libgtest.so.*.* %_DEST%\lib%_EXT% +..\%__SRC%\lib\libgtest.so.* %_DEST%\lib%_EXT% +linklib: libgtest.so.*.* +linklib: libgtest.so.* + +#..\%__SRC%\lib\libgtest_main.so.*.* %_DEST%\lib%_EXT% +#..\%__SRC%\lib\libgtest_main.so.* %_DEST%\lib%_EXT% +#linklib: libgtest_main.so.*.* +#linklib: libgtest_main.so.* Added: openoffice/trunk/ext_libraries/gtest/win/Library_gtest.mk URL: http://svn.apache.org/viewvc/openoffice/trunk/ext_libraries/gtest/win/Library_gtest.mk?rev=1599163&view=auto ============================================================================== --- openoffice/trunk/ext_libraries/gtest/win/Library_gtest.mk (added) +++ openoffice/trunk/ext_libraries/gtest/win/Library_gtest.mk Mon Jun 2 10:57:39 2014 @@ -0,0 +1,50 @@ +#/************************************************************** +# * +# * Licensed to the Apache Software Foundation (ASF) under one +# * or more contributor license agreements. See the NOTICE file +# * distributed with this work for additional information +# * regarding copyright ownership. The ASF licenses this file +# * to you under the Apache License, Version 2.0 (the +# * "License"); you may not use this file except in compliance +# * with the License. You may obtain a copy of the License at +# * +# * http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, +# * software distributed under the License is distributed on an +# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# * KIND, either express or implied. See the License for the +# * specific language governing permissions and limitations +# * under the License. +# * +# *************************************************************/ + +gb_Cxx_extension=cc + +$(eval $(call gb_Library_Library,gtest)) + +$(eval $(call gb_Library_add_package_headers,gtest,gtest_inc)) + +$(eval $(call gb_Library_set_include,gtest,\ + $$(INCLUDE) \ + -I. \ + -I./include \ +)) + +$(eval $(call gb_Library_set_defs,gtest,\ + $$(DEFS) \ + -DGTEST_CREATE_SHARED_LIBRARY=1 \ +)) + +$(eval $(call gb_Library_set_ldflags,gtest,\ + $$(LDFLAGS) \ +)) + +$(eval $(call gb_Library_add_linked_libs,gtest,\ + $(gb_STDLIBS) \ + $(gb_Library_STLLIBS) \ +)) + +$(eval $(call gb_Library_add_exception_objects,gtest, \ + gtest/$(INPATH)/misc/build/gtest-1.7.0/src/gtest-all \ +)) Added: openoffice/trunk/ext_libraries/gtest/win/Makefile URL: http://svn.apache.org/viewvc/openoffice/trunk/ext_libraries/gtest/win/Makefile?rev=1599163&view=auto ============================================================================== --- openoffice/trunk/ext_libraries/gtest/win/Makefile (added) +++ openoffice/trunk/ext_libraries/gtest/win/Makefile Mon Jun 2 10:57:39 2014 @@ -0,0 +1,30 @@ +#/************************************************************** +# * +# * Licensed to the Apache Software Foundation (ASF) under one +# * or more contributor license agreements. See the NOTICE file +# * distributed with this work for additional information +# * regarding copyright ownership. The ASF licenses this file +# * to you under the Apache License, Version 2.0 (the +# * "License"); you may not use this file except in compliance +# * with the License. You may obtain a copy of the License at +# * +# * http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, +# * software distributed under the License is distributed on an +# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# * KIND, either express or implied. See the License for the +# * specific language governing permissions and limitations +# * under the License. +# * +# *************************************************************/ + +ifeq ($(strip $(SOLARENV)),) +$(error No environment set!) +endif + +gb_PARTIALBUILD := T +GBUILDDIR := $(SOLARENV)/gbuild +include $(GBUILDDIR)/gbuild.mk + +$(eval $(call gb_Module_make_global_targets,$(shell ls $(dir $(realpath $(firstword $(MAKEFILE_LIST))))Module*.mk))) Added: openoffice/trunk/ext_libraries/gtest/win/Module_gtest.mk URL: http://svn.apache.org/viewvc/openoffice/trunk/ext_libraries/gtest/win/Module_gtest.mk?rev=1599163&view=auto ============================================================================== --- openoffice/trunk/ext_libraries/gtest/win/Module_gtest.mk (added) +++ openoffice/trunk/ext_libraries/gtest/win/Module_gtest.mk Mon Jun 2 10:57:39 2014 @@ -0,0 +1,27 @@ +#/************************************************************** +# * +# * Licensed to the Apache Software Foundation (ASF) under one +# * or more contributor license agreements. See the NOTICE file +# * distributed with this work for additional information +# * regarding copyright ownership. The ASF licenses this file +# * to you under the Apache License, Version 2.0 (the +# * "License"); you may not use this file except in compliance +# * with the License. You may obtain a copy of the License at +# * +# * http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, +# * software distributed under the License is distributed on an +# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# * KIND, either express or implied. See the License for the +# * specific language governing permissions and limitations +# * under the License. +# * +# *************************************************************/ + +$(eval $(call gb_Module_Module,gtest)) + +$(eval $(call gb_Module_add_targets,gtest,\ + Library_gtest \ + Package_inc \ +)) Added: openoffice/trunk/ext_libraries/gtest/win/Package_inc.mk URL: http://svn.apache.org/viewvc/openoffice/trunk/ext_libraries/gtest/win/Package_inc.mk?rev=1599163&view=auto ============================================================================== --- openoffice/trunk/ext_libraries/gtest/win/Package_inc.mk (added) +++ openoffice/trunk/ext_libraries/gtest/win/Package_inc.mk Mon Jun 2 10:57:39 2014 @@ -0,0 +1,45 @@ +#/************************************************************** +# * +# * Licensed to the Apache Software Foundation (ASF) under one +# * or more contributor license agreements. See the NOTICE file +# * distributed with this work for additional information +# * regarding copyright ownership. The ASF licenses this file +# * to you under the Apache License, Version 2.0 (the +# * "License"); you may not use this file except in compliance +# * with the License. You may obtain a copy of the License at +# * +# * http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, +# * software distributed under the License is distributed on an +# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# * KIND, either express or implied. See the License for the +# * specific language governing permissions and limitations +# * under the License. +# * +# *************************************************************/ + +$(eval $(call gb_Package_Package,gtest_inc,$(EXT_LIBRARIES)/gtest/$(INPATH)/misc/build/gtest-1.7.0)) + +$(eval $(call gb_Package_add_file,gtest_inc,inc/gtest/gtest.h,include/gtest/gtest.h)) + +$(eval $(call gb_Package_add_file,gtest_inc,inc/gtest/gtest-death-test.h,include/gtest/gtest-death-test.h)) +$(eval $(call gb_Package_add_file,gtest_inc,inc/gtest/gtest-message.h,include/gtest/gtest-message.h)) +$(eval $(call gb_Package_add_file,gtest_inc,inc/gtest/gtest-param-test.h,include/gtest/gtest-param-test.h)) +$(eval $(call gb_Package_add_file,gtest_inc,inc/gtest/gtest-printers.h,include/gtest/gtest-printers.h)) +$(eval $(call gb_Package_add_file,gtest_inc,inc/gtest/gtest-spi.h,include/gtest/gtest-spi.h)) +$(eval $(call gb_Package_add_file,gtest_inc,inc/gtest/gtest-test-part.h,include/gtest/gtest-test-part.h)) +$(eval $(call gb_Package_add_file,gtest_inc,inc/gtest/gtest-typed-test.h,include/gtest/gtest-typed-test.h)) +$(eval $(call gb_Package_add_file,gtest_inc,inc/gtest/gtest_pred_impl.h,include/gtest/gtest_pred_impl.h)) +$(eval $(call gb_Package_add_file,gtest_inc,inc/gtest/gtest_prod.h,include/gtest/gtest_prod.h)) + +$(eval $(call gb_Package_add_file,gtest_inc,inc/gtest/internal/gtest-internal.h,include/gtest/internal/gtest-internal.h)) +$(eval $(call gb_Package_add_file,gtest_inc,inc/gtest/internal/gtest-death-test-internal.h,include/gtest/internal/gtest-death-test-internal.h)) +$(eval $(call gb_Package_add_file,gtest_inc,inc/gtest/internal/gtest-filepath.h,include/gtest/internal/gtest-filepath.h)) +$(eval $(call gb_Package_add_file,gtest_inc,inc/gtest/internal/gtest-linked_ptr.h,include/gtest/internal/gtest-linked_ptr.h)) +$(eval $(call gb_Package_add_file,gtest_inc,inc/gtest/internal/gtest-param-util-generated.h,include/gtest/internal/gtest-param-util-generated.h)) +$(eval $(call gb_Package_add_file,gtest_inc,inc/gtest/internal/gtest-param-util.h,include/gtest/internal/gtest-param-util.h)) +$(eval $(call gb_Package_add_file,gtest_inc,inc/gtest/internal/gtest-port.h,include/gtest/internal/gtest-port.h)) +$(eval $(call gb_Package_add_file,gtest_inc,inc/gtest/internal/gtest-string.h,include/gtest/internal/gtest-string.h)) +$(eval $(call gb_Package_add_file,gtest_inc,inc/gtest/internal/gtest-tuple.h,include/gtest/internal/gtest-tuple.h)) +$(eval $(call gb_Package_add_file,gtest_inc,inc/gtest/internal/gtest-type-util.h,include/gtest/internal/gtest-type-util.h)) Modified: openoffice/trunk/main/configure.in URL: http://svn.apache.org/viewvc/openoffice/trunk/main/configure.in?rev=1599163&r1=1599162&r2=1599163&view=diff ============================================================================== --- openoffice/trunk/main/configure.in (original) +++ openoffice/trunk/main/configure.in Mon Jun 2 10:57:39 2014 @@ -58,6 +58,9 @@ AC_ARG_WITH(system-apache-commons, AC_ARG_ENABLE(online-update, [ --disable-online-update Disables the Online Update feature. ],,enable_online_update=yes) +AC_ARG_ENABLE(unit-tests, +[ --disable-unit-tests Disables default unit tests (eg. unit tests using Google test, ...). +],,enable_unit_tests=yes) AC_ARG_ENABLE(ldap, [ --disable-ldap Disables the use of LDAP backend via OpenLDAP ],,) @@ -1446,6 +1449,19 @@ else fi AC_SUBST(ENABLE_ONLINE_UPDATE) +dnl =================================================================== +dnl Unit Tests +dnl =================================================================== +AC_MSG_CHECKING([whether to enable unit tests]) +if test "$enable_unit_tests" = "yes" -o "$enable_unit_tests" = "TRUE"; then + ENABLE_UNIT_TESTS="YES" + BUILD_TYPE="$BUILD_TYPE GTEST" + AC_MSG_RESULT([yes]) +else + ENABLE_UNIT_TESTS="" + AC_MSG_RESULT([no]) +fi +AC_SUBST(ENABLE_UNIT_TESTS) AC_MSG_CHECKING([whether to enable native CUPS support]) if test "$test_cups" = "yes" -a \( "$enable_cups" = "yes" -o "$enable_cups" = "TRUE" \) ; then Modified: openoffice/trunk/main/external_deps.lst URL: http://svn.apache.org/viewvc/openoffice/trunk/main/external_deps.lst?rev=1599163&r1=1599162&r2=1599163&view=diff ============================================================================== --- openoffice/trunk/main/external_deps.lst (original) +++ openoffice/trunk/main/external_deps.lst Mon Jun 2 10:57:39 2014 @@ -41,6 +41,11 @@ if ( true ) URL1 = http://ucpp.googlecode.com/files/ucpp-1.3.2.tar.gz URL2 = $(OOO_EXTRAS)$(MD5)-$(name) +if (ENABLE_UNIT_TESTS == YES) + MD5 = 2d6ec8ccdf5c46b05ba54a9fd1d130d7 + name = gtest-1.7.0.zip + URL1 = http://googletest.googlecode.com/files/gtest-1.7.0.zip + if ( true ) MD5 = 067201ea8b126597670b5eff72e1f66c name = mythes-1.2.0.tar.gz Modified: openoffice/trunk/main/sal/prj/build.lst URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sal/prj/build.lst?rev=1599163&r1=1599162&r2=1599163&view=diff ============================================================================== --- openoffice/trunk/main/sal/prj/build.lst (original) +++ openoffice/trunk/main/sal/prj/build.lst Mon Jun 2 10:57:39 2014 @@ -1,4 +1,4 @@ -sa sal : xml2cmp stlport external BOOST:boost NULL +sa sal : xml2cmp stlport external BOOST:boost GTEST:gtest NULL sa sal usr1 - all sa_mkout NULL sa sal\inc nmake - all sa_inc NULL sa sal\typesconfig nmake - u sa_tc sa_inc NULL @@ -14,6 +14,8 @@ sa sal\qa sa sal\osl\unx nmake - u sa_oslu sa_tc.u sa_inc NULL sa sal\osl\all nmake - all sa_oslall sa_tc.u sa_inc NULL sa sal\util nmake - all sa_util sa_tc.u sa_oslall sa_uwinapi.n sa_kill.n sa_onlineupdate.n sa_osln.n sa_oslp.p sa_oslu.u sa_rtl sa_textenc NULL +sa sal\qa\sal nmake - all sa_qa_sal sa_util NULL + sa sal\cppunittester nmake - all sa_cppunittester sa_cpprt.u sa_util NULL sa sal\qa\ByteSequence nmake - all sa_qa_ByteSequence sa_cppunittester sa_util NULL sa sal\qa\OStringBuffer nmake - all sa_qa_OStringBuffer sa_cppunittester sa_util NULL Modified: openoffice/trunk/main/sal/qa/sal/makefile.mk URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sal/qa/sal/makefile.mk?rev=1599163&r1=1599162&r2=1599163&view=diff ============================================================================== --- openoffice/trunk/main/sal/qa/sal/makefile.mk (original) +++ openoffice/trunk/main/sal/qa/sal/makefile.mk Mon Jun 2 10:57:39 2014 @@ -20,27 +20,27 @@ #************************************************************** +PRJ = ..$/.. +PRJNAME = sal +TARGET = sal_ut_types -PRJ := ..$/.. -PRJNAME := sal -TARGET := qa_sal - -ENABLE_EXCEPTIONS := TRUE +ENABLE_EXCEPTIONS = TRUE .INCLUDE: settings.mk -SHL1TARGET = $(TARGET)_types -SHL1OBJS = $(SLO)$/test_types.obj -SHL1STDLIBS = $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB) -SHL1VERSIONMAP = version.map -SHL1IMPLIB = i$(SHL1TARGET) -DEF1NAME = $(SHL1TARGET) - -SLOFILES = $(SHL1OBJS) +.IF "$(ENABLE_UNIT_TESTS)" != "YES" +all: + @echo unit tests are disabled. Nothing to do. + +.ELSE + +APP1OBJS = $(OBJ)/test_types.obj +APP1RPATH = NONE +APP1STDLIBS = $(GTESTLIB) $(SALLIB) +APP1TARGET = sal_ut_test +APP1TEST = enabled +#APP1TEST = disabled .INCLUDE: target.mk -ALLTAR: test - -test .PHONY: $(SHL1TARGETN) - testshl2 $(SHL1TARGETN) +.ENDIF Modified: openoffice/trunk/main/sal/qa/sal/test_types.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sal/qa/sal/test_types.cxx?rev=1599163&r1=1599162&r2=1599163&view=diff ============================================================================== --- openoffice/trunk/main/sal/qa/sal/test_types.cxx (original) +++ openoffice/trunk/main/sal/qa/sal/test_types.cxx Mon Jun 2 10:57:39 2014 @@ -28,9 +28,10 @@ #include <stdio.h> // C99 snprintf not necessarily in <cstdio> #include <string.h> // wntmsci10 does not know <cstring> std::strcmp -#include "testshl/simpleheader.hxx" #include "sal/types.h" +#include "gtest/gtest.h" + namespace { template< typename T > void testPrintf( @@ -39,20 +40,11 @@ template< typename T > void testPrintf( std::size_t const bufsize = 1000; char buf[bufsize]; int n = snprintf(buf, bufsize, format, argument); - CPPUNIT_ASSERT(n >= 0 && sal::static_int_cast< unsigned int >(n) < bufsize); - CPPUNIT_ASSERT(strcmp(buf, result) == 0); + ASSERT_TRUE(n >= 0 && sal::static_int_cast< unsigned int >(n) < bufsize); + ASSERT_TRUE(strcmp(buf, result) == 0); } -class Test: public CppUnit::TestFixture { -public: - void test(); - - CPPUNIT_TEST_SUITE(Test); - CPPUNIT_TEST(test); - CPPUNIT_TEST_SUITE_END(); -}; - -void Test::test() { +TEST(Sal_Test, Types_Test) { testPrintf("-2147483648", "%" SAL_PRIdINT32, SAL_MIN_INT32); testPrintf("4294967295", "%" SAL_PRIuUINT32, SAL_MAX_UINT32); testPrintf("ffffffff", "%" SAL_PRIxUINT32, SAL_MAX_UINT32); @@ -70,8 +62,10 @@ void Test::test() { testPrintf("ABC", "%" SAL_PRIXUINTPTR, static_cast< sal_uIntPtr >(0xabc)); } -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests"); - } -NOADDITIONAL; +int main(int argc, char **argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} Modified: openoffice/trunk/main/set_soenv.in URL: http://svn.apache.org/viewvc/openoffice/trunk/main/set_soenv.in?rev=1599163&r1=1599162&r2=1599163&view=diff ============================================================================== --- openoffice/trunk/main/set_soenv.in (original) +++ openoffice/trunk/main/set_soenv.in Mon Jun 2 10:57:39 2014 @@ -105,7 +105,7 @@ my ( $oldPATH, $SRC_ROOT, $SO_HOME, $JAV $WIN_GNUCOPY, $WIN_TOUCH, $MOZILLABUILD, $PROEXT, $TARFILE_LOCATION, $ENABLE_HUNSPELL, $ENABLE_HYPHEN, - $SYSTEM_PYTHON, $EPM_FLAGS); + $SYSTEM_PYTHON, $EPM_FLAGS, $ENABLE_UNIT_TESTS); # #------------------------------------------- # IId. Declaring the aliases. @@ -1861,6 +1861,7 @@ ToFile( "SYSTEM_CPPUNIT", "@SYSTEM_CP ToFile( "CPPUNIT_CFLAGS", "@CPPUNIT_CFLAGS@", "e" ); ToFile( "CPPUNIT_LIBS", "@CPPUNIT_LIBS@", "e" ); ToFile( "WITH_CPPUNIT", "@WITH_CPPUNIT@", "e" ); +ToFile( "ENABLE_UNIT_TESTS", "@ENABLE_UNIT_TESTS@", "e" ); ToFile( "SYSTEM_LIBXML", "@SYSTEM_LIBXML@", "e" ); ToFile( "USE_FT_EMBOLDEN", "@USE_FT_EMBOLDEN@", "e" ); ToFile( "LIBXML_CFLAGS", "@LIBXML_CFLAGS@", "e" ); Modified: openoffice/trunk/main/solenv/inc/_tg_app.mk URL: http://svn.apache.org/viewvc/openoffice/trunk/main/solenv/inc/_tg_app.mk?rev=1599163&r1=1599162&r2=1599163&view=diff ============================================================================== --- openoffice/trunk/main/solenv/inc/_tg_app.mk (original) +++ openoffice/trunk/main/solenv/inc/_tg_app.mk Mon Jun 2 10:57:39 2014 @@ -279,6 +279,13 @@ $(APP1TARGETN): $(APP1OBJS) $(APP1LIBS) .ENDIF # "$(APP1TARGETN)"!="" +# New rule for automatic run targets of unit test targets +.IF "$(APP1TEST)" == "enabled" && "$(APP1TARGET)" != "" + +$(APP1TARGET)_run: $(APP1TARGETN) + $(COMMAND_ECHO) $(AUGMENT_LIBRARY_PATH) $(APP1TARGETN) --gtest_output="xml:$(BIN)/$(APP1TARGET)_result.xml" + +.ENDIF # Instruction for linking # unroll begin Modified: openoffice/trunk/main/solenv/inc/libs.mk URL: http://svn.apache.org/viewvc/openoffice/trunk/main/solenv/inc/libs.mk?rev=1599163&r1=1599162&r2=1599163&view=diff ============================================================================== --- openoffice/trunk/main/solenv/inc/libs.mk (original) +++ openoffice/trunk/main/solenv/inc/libs.mk Mon Jun 2 10:57:39 2014 @@ -278,6 +278,9 @@ CPPUNITLIB = $(CPPUNIT_LIBS) .ELSE CPPUNITLIB = -lcppunit .ENDIF + +GTESTLIB= -lgtest + .IF "$(SYSTEM_LIBXSLT)"=="YES" XSLTLIB=$(LIBXSLT_LIBS) .ELSE @@ -294,7 +297,6 @@ REDLANDLIB=$(REDLAND_LIBS) REDLANDLIB=-lrdf .ENDIF - # # USED_%NAME%_LIBS # Variablen, in denen in gueltiger Reihenfolge ALLE Libraries, @@ -470,6 +472,8 @@ HELPLINKERLIB=ihelplinker.lib JVMACCESSLIB = ijvmaccess.lib XSLTLIB = libxslt.lib $(LIBXML2LIB) CPPUNITLIB = icppunit_dll.lib +GTESTLIB = igtest.lib + REDLANDLIB = librdf.lib JVMFWKLIB = ijvmfwk.lib Modified: openoffice/trunk/main/solenv/inc/target.mk URL: http://svn.apache.org/viewvc/openoffice/trunk/main/solenv/inc/target.mk?rev=1599163&r1=1599162&r2=1599163&view=diff ============================================================================== --- openoffice/trunk/main/solenv/inc/target.mk (original) +++ openoffice/trunk/main/solenv/inc/target.mk Mon Jun 2 10:57:39 2014 @@ -150,6 +150,44 @@ APP8TARGET= APP9TARGET= .ENDIF +APP1RUNTEST= +APP2RUNTEST= +APP3RUNTEST= +APP4RUNTEST= +APP5RUNTEST= +APP6RUNTEST= +APP7RUNTEST= +APP8RUNTEST= +APP9RUNTEST= + +.IF "$(APP1TEST)"=="enabled" +APP1RUNTEST=$(APP1TARGET)_run +.ENDIF +.IF "$(APP2TEST)"=="enabled" +APP2RUNTEST=$(APP2TARGET)_run +.ENDIF +.IF "$(APP3TEST)"=="enabled" +APP3RUNTEST=$(APP3TARGET)_run +.ENDIF +.IF "$(APP4TEST)"=="enabled" +APP4RUNTEST=$(APP4TARGET)_run +.ENDIF +.IF "$(APP5TEST)"=="enabled" +APP5RUNTEST=$(APP5TARGET)_run +.ENDIF +.IF "$(APP6TEST)"=="enabled" +APP6RUNTEST=$(APP6TARGET)_run +.ENDIF +.IF "$(APP7TEST)"=="enabled" +APP7RUNTEST=$(APP7TARGET)_run +.ENDIF +.IF "$(APP8TEST)"=="enabled" +APP8RUNTEST=$(APP8TARGET)_run +.ENDIF +.IF "$(APP9TEST)"=="enabled" +APP9RUNTEST=$(APP9TARGET)_run +.ENDIF + .IF "$(IDLFILES)"!="" URDFILES+=$(foreach,i,$(IDLFILES:s/.idl/.urd/:f) $(OUT)/ucr/$(IDLPACKAGE)/$i) @@ -1156,6 +1194,9 @@ ALLTAR: \ $(APP1TARGETN) $(APP2TARGETN) $(APP3TARGETN) \ $(APP4TARGETN) $(APP5TARGETN) $(APP6TARGETN) \ $(APP7TARGETN) $(APP8TARGETN) $(APP9TARGETN) \ + $(APP1RUNTEST) $(APP2RUNTEST) $(APP3RUNTEST) \ + $(APP4RUNTEST) $(APP5RUNTEST) $(APP6RUNTEST) \ + $(APP7RUNTEST) $(APP8RUNTEST) $(APP9RUNTEST) \ $(JARTARGETN) \ $(JARTARGETDEPN) \ $(SRC1TARGET) \ @@ -1166,9 +1207,9 @@ ALLTAR: \ $(SRC10TARGET) $(SRC11TARGET) $(SRC12TARGET) \ $(SRC13TARGET) $(SRC14TARGET) $(SRC15TARGET) \ $(SRC16TARGET) \ - $(RSC_MULTI1) \ - $(RSC_MULTI2) \ - $(RSC_MULTI3) \ + $(RSC_MULTI1) \ + $(RSC_MULTI2) \ + $(RSC_MULTI3) \ $(RSC_MULTI4) \ $(RSC_MULTI5) \ $(RSC_MULTI6) \ Modified: openoffice/trunk/main/solenv/inc/tg_app.mk URL: http://svn.apache.org/viewvc/openoffice/trunk/main/solenv/inc/tg_app.mk?rev=1599163&r1=1599162&r2=1599163&view=diff ============================================================================== --- openoffice/trunk/main/solenv/inc/tg_app.mk (original) +++ openoffice/trunk/main/solenv/inc/tg_app.mk Mon Jun 2 10:57:39 2014 @@ -281,6 +281,13 @@ $(APP$(TNR)TARGETN): $(APP$(TNR)OBJS) $( .ENDIF # "$(APP$(TNR)TARGETN)"!="" +# New rule for automatic run targets of unit test targets +.IF "$(APP$(TNR)TEST)" == "enabled" && "$(APP$(TNR)TARGET)" != "" + +$(APP$(TNR)TARGET)_run: $(APP$(TNR)TARGETN) + $(COMMAND_ECHO) $(AUGMENT_LIBRARY_PATH) $(APP$(TNR)TARGETN) --gtest_output="xml:$(BIN)/$(APP$(TNR)TARGET)_result.xml" + +.ENDIF # Instruction for linking # unroll end