binaryurp/qa/main.cxx | 28 +++++++++++++++ binaryurp/qa/makefile.mk | 52 ++++++++-------------------- binaryurp/qa/test-cache.cxx | 21 ++--------- binaryurp/qa/test-unmarshal.cxx | 28 +++------------ solenv/inc/_tg_app.mk | 73 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 129 insertions(+), 73 deletions(-)
New commits: commit 893e16df7748581fac11b389fc57acf53b464416 Author: Damjan Jovanovic <dam...@apache.org> Date: Sat Aug 29 14:29:12 2015 +0000 #i125003# migrate main/binaryurp from cppunit to Google Test. diff --git a/binaryurp/qa/main.cxx b/binaryurp/qa/main.cxx new file mode 100644 index 0000000..df14e5b --- /dev/null +++ b/binaryurp/qa/main.cxx @@ -0,0 +1,28 @@ +/************************************************************** + * + * 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. + * + *************************************************************/ + +#include "gtest/gtest.h" + +int main(int argc, char **argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/binaryurp/qa/makefile.mk b/binaryurp/qa/makefile.mk index 8ab0683..ecf0968 100644 --- a/binaryurp/qa/makefile.mk +++ b/binaryurp/qa/makefile.mk @@ -29,39 +29,21 @@ ENABLE_EXCEPTIONS = TRUE .INCLUDE: settings.mk -.IF "$(WITH_CPPUNIT)" != "YES" || "$(GUI)" == "OS2" +.IF "$(ENABLE_UNIT_TESTS)" != "YES" @all: -.IF "$(GUI)" == "OS2" - @echo "Skipping, cppunit broken." -.ELIF "$(WITH_CPPUNIT)" != "YES" - @echo "cppunit disabled. nothing do do." -.END + @echo unit tests are disabled. Nothing to do. .ELSE -CFLAGSCXX += $(CPPUNIT_CFLAGS) -DLLPRE = +APP1OBJS = $(SLO)/test-cache.obj $(SLO)/main.obj +APP1RPATH = NONE +APP1STDLIBS = $(GTESTLIB) $(SALLIB) +APP1TARGET = test-cache +APP1TEST = enabled -.IF "$(GUI)" != "OS2" -SLOFILES = $(SLO)/test-cache.obj $(SLO)/test-unmarshal.obj -.ENDIF - -SHL1IMPLIB = i$(SHL1TARGET) -SHL1OBJS = $(SLO)/test-cache.obj -SHL1RPATH = NONE -SHL1STDLIBS = $(CPPUNITLIB) $(SALLIB) -.IF "$(GUI)" != "OS2" -SHL1TARGET = test-cache -.ELSE -SHL1TARGET = test-c -.ENDIF -SHL1VERSIONMAP = version.map -DEF1NAME = $(SHL1TARGET) - -SHL2IMPLIB = i$(SHL2TARGET) -SHL2OBJS = \ +APP2OBJS = \ $(SLO)/test-unmarshal.obj \ $(SLO)/binaryany.obj \ $(SLO)/bridge.obj \ @@ -69,29 +51,27 @@ SHL2OBJS = \ $(SLO)/currentcontext.obj \ $(SLO)/incomingrequest.obj \ $(SLO)/lessoperators.obj \ + $(SLO)/main.obj \ $(SLO)/marshal.obj \ $(SLO)/outgoingrequests.obj \ $(SLO)/proxy.obj \ $(SLO)/reader.obj \ $(SLO)/unmarshal.obj \ $(SLO)/writer.obj -SHL2RPATH = NONE -SHL2STDLIBS = \ +APP2RPATH = NONE +APP2STDLIBS = \ $(CPPUHELPERLIB) \ $(CPPULIB) \ - $(CPPUNITLIB) \ + $(GTESTLIB) \ $(SALHELPERLIB) \ $(SALLIB) .IF "$(GUI)" != "OS2" -SHL2TARGET = test-unmarshal +APP2TARGET = test-unmarshal .ELSE -SHL2TARGET = test-u +APP2TARGET = test-u .ENDIF -SHL2VERSIONMAP = version.map -DEF2NAME = $(SHL2TARGET) - -.ENDIF # "$(GUI)" == "OS2" +APP2TEST = enabled .INCLUDE: target.mk -.INCLUDE: _cppunit.mk +.ENDIF # "$(ENABLE_UNIT_TESTS)" != "YES" diff --git a/binaryurp/qa/test-cache.cxx b/binaryurp/qa/test-cache.cxx index 2caa6ea..4352863 100644 --- a/binaryurp/qa/test-cache.cxx +++ b/binaryurp/qa/test-cache.cxx @@ -23,26 +23,18 @@ #include "sal/config.h" -#include "cppunit/TestAssert.h" -#include "cppunit/TestFixture.h" -#include "cppunit/extensions/HelperMacros.h" -#include "cppunit/plugin/TestPlugIn.h" +#include "gtest/gtest.h" #include "../source/cache.hxx" namespace { -class Test: public CppUnit::TestFixture { -private: - CPPUNIT_TEST_SUITE(Test); - CPPUNIT_TEST(testNothingLostFromLruList); - CPPUNIT_TEST_SUITE_END(); - - void testNothingLostFromLruList(); +class Test: public ::testing::Test { +public: }; // cf. jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test.java: -void Test::testNothingLostFromLruList() { +TEST_F(Test, testNothingLostFromLruList) { int a[8]; for (int i = 0; i != sizeof a / sizeof a[0]; ++i) { for (int j = 0; j != i; ++j) { @@ -55,7 +47,7 @@ void Test::testNothingLostFromLruList() { c.add(a[k], &f); } bool f; - CPPUNIT_ASSERT_EQUAL( + ASSERT_EQ( 6, c.add(-1, &f) + c.add(-2, &f) + c.add(-3, &f) + c.add(-4, &f)); int j = i - 1; @@ -73,8 +65,5 @@ void Test::testNothingLostFromLruList() { } } -CPPUNIT_TEST_SUITE_REGISTRATION(Test); } - -CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/binaryurp/qa/test-unmarshal.cxx b/binaryurp/qa/test-unmarshal.cxx index f631650..d2f7b91 100644 --- a/binaryurp/qa/test-unmarshal.cxx +++ b/binaryurp/qa/test-unmarshal.cxx @@ -26,10 +26,7 @@ #include "com/sun/star/io/IOException.hpp" #include "com/sun/star/uno/Sequence.hxx" #include "cppu/unotype.hxx" -#include "cppunit/TestAssert.h" -#include "cppunit/TestFixture.h" -#include "cppunit/extensions/HelperMacros.h" -#include "cppunit/plugin/TestPlugIn.h" +#include "gtest/gtest.h" #include "rtl/ref.hxx" #include "rtl/string.h" #include "sal/types.h" @@ -44,19 +41,11 @@ namespace { namespace css = com::sun::star; -class Test: public CppUnit::TestFixture { -private: - CPPUNIT_TEST_SUITE(Test); - CPPUNIT_TEST(testTypeOfBooleanSequence); - CPPUNIT_TEST(testTypeOfVoidSequence); - CPPUNIT_TEST_SUITE_END(); - - void testTypeOfBooleanSequence(); - - void testTypeOfVoidSequence(); +class Test: public ::testing::Test { +public: }; -void Test::testTypeOfBooleanSequence() { +TEST_F(Test, testTypeOfBooleanSequence) { binaryurp::ReaderState state; css::uno::Sequence< sal_Int8 > buf(13); buf[0] = static_cast< sal_Int8 >(20 | 0x80); // sequence type | cache flag @@ -74,14 +63,14 @@ void Test::testTypeOfBooleanSequence() { buf[12] = 'n'; binaryurp::Unmarshal m(rtl::Reference< binaryurp::Bridge >(), state, buf); css::uno::TypeDescription t(m.readType()); - CPPUNIT_ASSERT( + ASSERT_TRUE( t.equals( css::uno::TypeDescription( cppu::UnoType< css::uno::Sequence< bool > >::get()))); m.done(); } -void Test::testTypeOfVoidSequence() { +TEST_F(Test, testTypeOfVoidSequence) { binaryurp::ReaderState state; css::uno::Sequence< sal_Int8 > buf(10); buf[0] = static_cast< sal_Int8 >(20 | 0x80); // sequence type | cache flag @@ -97,12 +86,9 @@ void Test::testTypeOfVoidSequence() { binaryurp::Unmarshal m(rtl::Reference< binaryurp::Bridge >(), state, buf); try { m.readType(); - CPPUNIT_FAIL("exception expected"); + FAIL() << "exception expected"; } catch (css::io::IOException &) {} } -CPPUNIT_TEST_SUITE_REGISTRATION(Test); } - -CPPUNIT_PLUGIN_IMPLEMENT(); commit e38d1f68a0674041d230bac016659fe6682c161c Author: Damjan Jovanovic <dam...@apache.org> Date: Sat Aug 29 14:23:20 2015 +0000 #i125003# add Google Test APPnTARGET_run targets for n=2..10, which commit 1599163 must have missed out ("Up to 9 run unit test targets are supported" says the Wiki, even though only 1 exists in main/solenv/inc/_tg_app.mk). diff --git a/solenv/inc/_tg_app.mk b/solenv/inc/_tg_app.mk index 7c2698d..c25fc68 100644 --- a/solenv/inc/_tg_app.mk +++ b/solenv/inc/_tg_app.mk @@ -287,6 +287,7 @@ $(APP1TARGET)_run: $(APP1TARGETN) .ENDIF + # Instruction for linking # unroll begin @@ -546,6 +547,14 @@ $(APP2TARGETN): $(APP2OBJS) $(APP2LIBS) \ .ENDIF # "$(APP2TARGETN)"!="" +# New rule for automatic run targets of unit test targets +.IF "$(APP2TEST)" == "enabled" && "$(APP2TARGET)" != "" + +$(APP2TARGET)_run: $(APP2TARGETN) + $(COMMAND_ECHO) $(AUGMENT_LIBRARY_PATH_LOCAL) $(APP2TARGETN) --gtest_output="xml:$(BIN)/$(APP2TARGET)_result.xml" + +.ENDIF + # Instruction for linking # unroll begin @@ -806,6 +815,14 @@ $(APP3TARGETN): $(APP3OBJS) $(APP3LIBS) \ .ENDIF # "$(APP3TARGETN)"!="" +# New rule for automatic run targets of unit test targets +.IF "$(APP3TEST)" == "enabled" && "$(APP3TARGET)" != "" + +$(APP3TARGET)_run: $(APP3TARGETN) + $(COMMAND_ECHO) $(AUGMENT_LIBRARY_PATH_LOCAL) $(APP3TARGETN) --gtest_output="xml:$(BIN)/$(APP3TARGET)_result.xml" + +.ENDIF + # Instruction for linking # unroll begin @@ -1066,6 +1083,14 @@ $(APP4TARGETN): $(APP4OBJS) $(APP4LIBS) \ .ENDIF # "$(APP4TARGETN)"!="" +# New rule for automatic run targets of unit test targets +.IF "$(APP4TEST)" == "enabled" && "$(APP4TARGET)" != "" + +$(APP4TARGET)_run: $(APP4TARGETN) + $(COMMAND_ECHO) $(AUGMENT_LIBRARY_PATH_LOCAL) $(APP4TARGETN) --gtest_output="xml:$(BIN)/$(APP4TARGET)_result.xml" + +.ENDIF + # Instruction for linking # unroll begin @@ -1326,6 +1351,14 @@ $(APP5TARGETN): $(APP5OBJS) $(APP5LIBS) \ .ENDIF # "$(APP5TARGETN)"!="" +# New rule for automatic run targets of unit test targets +.IF "$(APP5TEST)" == "enabled" && "$(APP5TARGET)" != "" + +$(APP5TARGET)_run: $(APP5TARGETN) + $(COMMAND_ECHO) $(AUGMENT_LIBRARY_PATH_LOCAL) $(APP5TARGETN) --gtest_output="xml:$(BIN)/$(APP5TARGET)_result.xml" + +.ENDIF + # Instruction for linking # unroll begin @@ -1586,6 +1619,14 @@ $(APP6TARGETN): $(APP6OBJS) $(APP6LIBS) \ .ENDIF # "$(APP6TARGETN)"!="" +# New rule for automatic run targets of unit test targets +.IF "$(APP6TEST)" == "enabled" && "$(APP6TARGET)" != "" + +$(APP6TARGET)_run: $(APP6TARGETN) + $(COMMAND_ECHO) $(AUGMENT_LIBRARY_PATH_LOCAL) $(APP6TARGETN) --gtest_output="xml:$(BIN)/$(APP6TARGET)_result.xml" + +.ENDIF + # Instruction for linking # unroll begin @@ -1846,6 +1887,14 @@ $(APP7TARGETN): $(APP7OBJS) $(APP7LIBS) \ .ENDIF # "$(APP7TARGETN)"!="" +# New rule for automatic run targets of unit test targets +.IF "$(APP7TEST)" == "enabled" && "$(APP7TARGET)" != "" + +$(APP7TARGET)_run: $(APP7TARGETN) + $(COMMAND_ECHO) $(AUGMENT_LIBRARY_PATH_LOCAL) $(APP7TARGETN) --gtest_output="xml:$(BIN)/$(APP7TARGET)_result.xml" + +.ENDIF + # Instruction for linking # unroll begin @@ -2106,6 +2155,14 @@ $(APP8TARGETN): $(APP8OBJS) $(APP8LIBS) \ .ENDIF # "$(APP8TARGETN)"!="" +# New rule for automatic run targets of unit test targets +.IF "$(APP8TEST)" == "enabled" && "$(APP8TARGET)" != "" + +$(APP8TARGET)_run: $(APP8TARGETN) + $(COMMAND_ECHO) $(AUGMENT_LIBRARY_PATH_LOCAL) $(APP8TARGETN) --gtest_output="xml:$(BIN)/$(APP8TARGET)_result.xml" + +.ENDIF + # Instruction for linking # unroll begin @@ -2366,6 +2423,14 @@ $(APP9TARGETN): $(APP9OBJS) $(APP9LIBS) \ .ENDIF # "$(APP9TARGETN)"!="" +# New rule for automatic run targets of unit test targets +.IF "$(APP9TEST)" == "enabled" && "$(APP9TARGET)" != "" + +$(APP9TARGET)_run: $(APP9TARGETN) + $(COMMAND_ECHO) $(AUGMENT_LIBRARY_PATH_LOCAL) $(APP9TARGETN) --gtest_output="xml:$(BIN)/$(APP9TARGET)_result.xml" + +.ENDIF + # Instruction for linking # unroll begin @@ -2626,5 +2691,13 @@ $(APP10TARGETN): $(APP10OBJS) $(APP10LIBS) \ .ENDIF # "$(APP10TARGETN)"!="" +# New rule for automatic run targets of unit test targets +.IF "$(APP10TEST)" == "enabled" && "$(APP10TARGET)" != "" + +$(APP10TARGET)_run: $(APP10TARGETN) + $(COMMAND_ECHO) $(AUGMENT_LIBRARY_PATH_LOCAL) $(APP10TARGETN) --gtest_output="xml:$(BIN)/$(APP10TARGET)_result.xml" + +.ENDIF + # Instruction for linking _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits