extensions.lst | 2 sal/prj/build.lst | 1 sal/qa/ByteSequence/ByteSequence.cxx | 253 +++++++++++++++------------------ sal/qa/ByteSequence/main.cxx | 28 +++ sal/qa/ByteSequence/makefile.mk | 25 +-- sal/qa/osl/condition/osl_Condition.cxx | 3 sal/qa/osl/thread/makefile.mk | 26 +-- sal/qa/osl/thread/test_thread.cxx | 55 +++---- sal/qa/osl/thread/version.map | 30 --- salhelper/prj/build.lst | 1 salhelper/qa/main.cxx | 28 +++ salhelper/qa/makefile.mk | 26 +-- salhelper/qa/test_api.cxx | 122 +++++---------- salhelper/qa/version.map | 26 --- 14 files changed, 286 insertions(+), 340 deletions(-)
New commits: commit c77bd087b86f22ca5620eaf068537fca712317be Author: Damjan Jovanovic <dam...@apache.org> Date: Sun Aug 30 18:00:24 2015 +0000 Put the main function in the test file instead of a separate missing file. diff --git a/sal/qa/osl/thread/makefile.mk b/sal/qa/osl/thread/makefile.mk index 7998e01..252d31d 100644 --- a/sal/qa/osl/thread/makefile.mk +++ b/sal/qa/osl/thread/makefile.mk @@ -36,7 +36,7 @@ all: .ELSE APP1TARGET = $(TARGET) -APP1OBJS = $(SLO)$/test_thread.obj $(SLO)$/main.obj +APP1OBJS = $(SLO)$/test_thread.obj APP1STDLIBS= $(SALLIB) $(GTESTLIB) $(TESTSHL2LIB) APP1RPATH = NONE APP1TEST = enabled diff --git a/sal/qa/osl/thread/test_thread.cxx b/sal/qa/osl/thread/test_thread.cxx index 38896b5..afa5ead 100644 --- a/sal/qa/osl/thread/test_thread.cxx +++ b/sal/qa/osl/thread/test_thread.cxx @@ -78,3 +78,9 @@ TEST_F(Test, test) { } +int main(int argc, char **argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + commit 0782738ecaed1a6915895ccf20af9e9fbb785563 Author: Damjan Jovanovic <dam...@apache.org> Date: Sun Aug 30 17:35:41 2015 +0000 #i125003# migrate main/sal/qa/osl/thread from cppunit to Google Test and run it on every build. diff --git a/sal/prj/build.lst b/sal/prj/build.lst index 4b568a8..d8d03b8 100644 --- a/sal/prj/build.lst +++ b/sal/prj/build.lst @@ -24,4 +24,5 @@ sa sal\qa\OStringBuffer nmake - all sa_qa_OStringBuffer sa_cppunittester sa_util sa sal\qa\osl\mutex nmake - all sa_qa_osl_mutex sa_cppunittester sa_util NULL sa sal\qa\osl\profile nmake - all sa_qa_osl_profile sa_cppunittester sa_util NULL sa sal\qa\osl\setthreadname nmake - all sa_qa_osl_setthreadname sa_cppunittester sa_util NULL +sa sal\qa\osl\thread nmake - all sa_qa_osl_thread sa_cppunittester sa_util NULL sa sal\qa\rtl\math nmake - all sa_qa_rtl_math sa_cppunittester sa_util NULL diff --git a/sal/qa/osl/thread/makefile.mk b/sal/qa/osl/thread/makefile.mk index 115fc8e..7998e01 100644 --- a/sal/qa/osl/thread/makefile.mk +++ b/sal/qa/osl/thread/makefile.mk @@ -29,20 +29,18 @@ ENABLE_EXCEPTIONS := TRUE .INCLUDE: settings.mk -DLLPRE = # no leading "lib" on .so files - -SHL1TARGET = $(TARGET) -SHL1OBJS = $(SLO)$/test_thread.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 + +APP1TARGET = $(TARGET) +APP1OBJS = $(SLO)$/test_thread.obj $(SLO)$/main.obj +APP1STDLIBS= $(SALLIB) $(GTESTLIB) $(TESTSHL2LIB) +APP1RPATH = NONE +APP1TEST = enabled .INCLUDE: target.mk -ALLTAR: test - -test .PHONY: $(SHL1TARGETN) - testshl2 $(SHL1TARGETN) +.ENDIF # "$(ENABLE_UNIT_TESTS)" != "YES" diff --git a/sal/qa/osl/thread/test_thread.cxx b/sal/qa/osl/thread/test_thread.cxx index f09636f..38896b5 100644 --- a/sal/qa/osl/thread/test_thread.cxx +++ b/sal/qa/osl/thread/test_thread.cxx @@ -26,11 +26,11 @@ #include "sal/config.h" -#include "testshl/simpleheader.hxx" #include "osl/conditn.hxx" #include "osl/thread.hxx" #include "osl/time.h" #include "sal/types.h" +#include "gtest/gtest.h" namespace { @@ -45,41 +45,36 @@ private: virtual void SAL_CALL onTerminated() { m_cond.set(); - CPPUNIT_ASSERT_EQUAL(osl::Condition::result_ok, global.wait()); + ASSERT_EQ(osl::Condition::result_ok, global.wait()); } osl::Condition & m_cond; }; -class Test: public CppUnit::TestFixture { +class Test: public ::testing::Test { public: - // Nondeterministic, best effort test that an osl::Thread can be destroyed - // (and in particular osl_destroyThread---indirectly---be called) before the - // corresponding thread has terminated: - void test() { - for (int i = 0; i < 50; ++i) { - osl::Condition c; - Thread t(c); - CPPUNIT_ASSERT(t.create()); - // Make sure virtual Thread::run/onTerminated are called before - // Thread::~Thread: - CPPUNIT_ASSERT_EQUAL(osl::Condition::result_ok, c.wait()); - } - // Make sure Thread::~Thread is called before each spawned thread - // terminates: - global.set(); - // Give the spawned threads enough time to terminate: - TimeValue const twentySeconds = { 20, 0 }; - osl::Thread::wait(twentySeconds); - } - - CPPUNIT_TEST_SUITE(Test); - CPPUNIT_TEST(test); - CPPUNIT_TEST_SUITE_END(); }; -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests"); +// Nondeterministic, best effort test that an osl::Thread can be destroyed +// (and in particular osl_destroyThread---indirectly---be called) before the +// corresponding thread has terminated: +TEST_F(Test, test) { + for (int i = 0; i < 50; ++i) { + osl::Condition c; + Thread t(c); + ASSERT_TRUE(t.create()); + // Make sure virtual Thread::run/onTerminated are called before + // Thread::~Thread: + ASSERT_EQ(osl::Condition::result_ok, c.wait()); + } + // Make sure Thread::~Thread is called before each spawned thread + // terminates: + global.set(); + // Give the spawned threads enough time to terminate: + TimeValue const twentySeconds = { 20, 0 }; + osl::Thread::wait(twentySeconds); +} + } -NOADDITIONAL; diff --git a/sal/qa/osl/thread/version.map b/sal/qa/osl/thread/version.map deleted file mode 100644 index f12a8b2..0000000 --- a/sal/qa/osl/thread/version.map +++ /dev/null @@ -1,30 +0,0 @@ -#************************************************************** -# -# 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. -# -#************************************************************** - - - -UDK_3_0_0 { - global: - registerAllTestFunction; - - local: - *; -}; commit 3afc077389654c3400d4d7b6d20275f6635cda40 Author: Damjan Jovanovic <dam...@apache.org> Date: Sun Aug 30 17:09:38 2015 +0000 #i125003# generate a non-fatal test failure in the main/sal/qa/osl/condition destructor instead of commenting out a fatal test failure. diff --git a/sal/qa/osl/condition/osl_Condition.cxx b/sal/qa/osl/condition/osl_Condition.cxx index 7231d05..87e4b92 100644 --- a/sal/qa/osl/condition/osl_Condition.cxx +++ b/sal/qa/osl/condition/osl_Condition.cxx @@ -97,8 +97,7 @@ public: ~ConditionThread( ) { - // LLA: do not throw in DTors! - // LLA: CPPUNIT_ASSERT_MESSAGE( "#ConditionThread does not shutdown properly.\n", sal_False == this -> isRunning( ) ); + EXPECT_TRUE( sal_False == this -> isRunning( ) ) << "#ConditionThread does not shutdown properly.\n"; } protected: ::osl::Condition& m_MyCon; commit 245c080c09b207c8e3c5b16c11049f3477069ae1 Author: Damjan Jovanovic <dam...@apache.org> Date: Sun Aug 30 16:59:34 2015 +0000 #i125003# migrate main/sal/qa/ByteSequence from cppunit to Google Test diff --git a/sal/qa/ByteSequence/ByteSequence.cxx b/sal/qa/ByteSequence/ByteSequence.cxx index 7110dc6..6a83482 100644 --- a/sal/qa/ByteSequence/ByteSequence.cxx +++ b/sal/qa/ByteSequence/ByteSequence.cxx @@ -24,167 +24,146 @@ #include "precompiled_sal.hxx" #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 "rtl/byteseq.hxx" #include "sal/types.h" namespace { -class Test: public CppUnit::TestFixture { +class Test: public ::testing::Test { public: - void test_default() { - rtl::ByteSequence s; - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), s.getLength()); - } +}; - void test_size0() { - rtl::ByteSequence s(sal_Int32(0)); - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), s.getLength()); - } +TEST_F(Test, test_default) { + rtl::ByteSequence s; + ASSERT_EQ(sal_Int32(0), s.getLength()); +} - void test_size5() { - rtl::ByteSequence s(5); - sal_Int8 const * p = s.getConstArray(); - CPPUNIT_ASSERT_EQUAL(sal_Int32(5), s.getLength()); - CPPUNIT_ASSERT_EQUAL(sal_Int8(0), p[0]); - CPPUNIT_ASSERT_EQUAL(sal_Int8(0), p[1]); - CPPUNIT_ASSERT_EQUAL(sal_Int8(0), p[2]); - CPPUNIT_ASSERT_EQUAL(sal_Int8(0), p[3]); - CPPUNIT_ASSERT_EQUAL(sal_Int8(0), p[4]); - } +TEST_F(Test, test_size0) { + rtl::ByteSequence s(sal_Int32(0)); + ASSERT_EQ(sal_Int32(0), s.getLength()); +} - void test_noinit0() { - rtl::ByteSequence s(0, rtl::BYTESEQ_NODEFAULT); - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), s.getLength()); - } +TEST_F(Test, test_size5) { + rtl::ByteSequence s(5); + sal_Int8 const * p = s.getConstArray(); + ASSERT_EQ(sal_Int32(5), s.getLength()); + ASSERT_EQ(sal_Int8(0), p[0]); + ASSERT_EQ(sal_Int8(0), p[1]); + ASSERT_EQ(sal_Int8(0), p[2]); + ASSERT_EQ(sal_Int8(0), p[3]); + ASSERT_EQ(sal_Int8(0), p[4]); +} - void test_noinit5() { - rtl::ByteSequence s(5, rtl::BYTESEQ_NODEFAULT); - CPPUNIT_ASSERT_EQUAL(sal_Int32(5), s.getLength()); - } +TEST_F(Test, test_noinit0) { + rtl::ByteSequence s(0, rtl::BYTESEQ_NODEFAULT); + ASSERT_EQ(sal_Int32(0), s.getLength()); +} - void test_elem0() { - rtl::ByteSequence s(0, 0); - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), s.getLength()); - } +TEST_F(Test, test_noinit5) { + rtl::ByteSequence s(5, rtl::BYTESEQ_NODEFAULT); + ASSERT_EQ(sal_Int32(5), s.getLength()); +} - void test_elem5() { - sal_Int8 const a[5] = { 0, 1, 2, 3, 4 }; - rtl::ByteSequence s(a, 5); - sal_Int8 const * p = s.getConstArray(); - CPPUNIT_ASSERT_EQUAL(sal_Int32(5), s.getLength()); - CPPUNIT_ASSERT_EQUAL(sal_Int8(0), p[0]); - CPPUNIT_ASSERT_EQUAL(sal_Int8(1), p[1]); - CPPUNIT_ASSERT_EQUAL(sal_Int8(2), p[2]); - CPPUNIT_ASSERT_EQUAL(sal_Int8(3), p[3]); - CPPUNIT_ASSERT_EQUAL(sal_Int8(4), p[4]); - } +TEST_F(Test, test_elem0) { + rtl::ByteSequence s(0, 0); + ASSERT_EQ(sal_Int32(0), s.getLength()); +} - void test_copy() { - rtl::ByteSequence s1(5); - { - rtl::ByteSequence s2(s1); - CPPUNIT_ASSERT_EQUAL(sal_Int32(5), s2.getLength()); - CPPUNIT_ASSERT_EQUAL(s1.getConstArray(), s2.getConstArray()); - CPPUNIT_ASSERT_EQUAL(s1.getHandle(), s2.getHandle()); - CPPUNIT_ASSERT_EQUAL(sal_Int32(2), s1.getHandle()->nRefCount); - } - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), s1.getHandle()->nRefCount); - } +TEST_F(Test, test_elem5) { + sal_Int8 const a[5] = { 0, 1, 2, 3, 4 }; + rtl::ByteSequence s(a, 5); + sal_Int8 const * p = s.getConstArray(); + ASSERT_EQ(sal_Int32(5), s.getLength()); + ASSERT_EQ(sal_Int8(0), p[0]); + ASSERT_EQ(sal_Int8(1), p[1]); + ASSERT_EQ(sal_Int8(2), p[2]); + ASSERT_EQ(sal_Int8(3), p[3]); + ASSERT_EQ(sal_Int8(4), p[4]); +} - void test_fromC() { - sal_Sequence c = { 1, 1, { 0 } }; - { - rtl::ByteSequence s(&c); - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), s.getLength()); - CPPUNIT_ASSERT_EQUAL( - static_cast< void const * >(c.elements), - static_cast< void const * >(s.getConstArray())); - CPPUNIT_ASSERT_EQUAL(&c, s.getHandle()); - CPPUNIT_ASSERT_EQUAL(sal_Int32(2), c.nRefCount); - } - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), c.nRefCount); +TEST_F(Test, test_copy) { + rtl::ByteSequence s1(5); + { + rtl::ByteSequence s2(s1); + ASSERT_EQ(sal_Int32(5), s2.getLength()); + ASSERT_EQ(s1.getConstArray(), s2.getConstArray()); + ASSERT_EQ(s1.getHandle(), s2.getHandle()); + ASSERT_EQ(sal_Int32(2), s1.getHandle()->nRefCount); } + ASSERT_EQ(sal_Int32(1), s1.getHandle()->nRefCount); +} - void test_noacquire() { - sal_Sequence c = { 2, 1, { 0 } }; - { - rtl::ByteSequence s(&c, rtl::BYTESEQ_NOACQUIRE); - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), s.getLength()); - CPPUNIT_ASSERT_EQUAL( - static_cast< void const * >(c.elements), - static_cast< void const * >(s.getConstArray())); - CPPUNIT_ASSERT_EQUAL(&c, s.getHandle()); - CPPUNIT_ASSERT_EQUAL(sal_Int32(2), c.nRefCount); - } - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), c.nRefCount); +TEST_F(Test, test_fromC) { + sal_Sequence c = { 1, 1, { 0 } }; + { + rtl::ByteSequence s(&c); + ASSERT_EQ(sal_Int32(1), s.getLength()); + ASSERT_EQ( + static_cast< void const * >(c.elements), + static_cast< void const * >(s.getConstArray())); + ASSERT_EQ(&c, s.getHandle()); + ASSERT_EQ(sal_Int32(2), c.nRefCount); } + ASSERT_EQ(sal_Int32(1), c.nRefCount); +} - void test_getArray() { - sal_Int8 const a[5] = { 0, 1, 2, 3, 4 }; - rtl::ByteSequence s1(a, 5); - rtl::ByteSequence s2(s1); - sal_Int8 * p = s2.getArray(); - p[2] = 10; - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), s1.getHandle()->nRefCount); - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), s2.getHandle()->nRefCount); - CPPUNIT_ASSERT_EQUAL(sal_Int8(2), s1.getConstArray()[2]); - CPPUNIT_ASSERT_EQUAL(sal_Int8(10), s2.getConstArray()[2]); +TEST_F(Test, test_noacquire) { + sal_Sequence c = { 2, 1, { 0 } }; + { + rtl::ByteSequence s(&c, rtl::BYTESEQ_NOACQUIRE); + ASSERT_EQ(sal_Int32(1), s.getLength()); + ASSERT_EQ( + static_cast< void const * >(c.elements), + static_cast< void const * >(s.getConstArray())); + ASSERT_EQ(&c, s.getHandle()); + ASSERT_EQ(sal_Int32(2), c.nRefCount); } + ASSERT_EQ(sal_Int32(1), c.nRefCount); +} - void test_same0() { - rtl::ByteSequence s1; - rtl::ByteSequence s2; - CPPUNIT_ASSERT_EQUAL(sal_True, s1 == s2); - CPPUNIT_ASSERT_EQUAL(sal_True, s2 == s1); - CPPUNIT_ASSERT_EQUAL(sal_False, s1 != s2); - CPPUNIT_ASSERT_EQUAL(sal_False, s2 != s1); - } +TEST_F(Test, test_getArray) { + sal_Int8 const a[5] = { 0, 1, 2, 3, 4 }; + rtl::ByteSequence s1(a, 5); + rtl::ByteSequence s2(s1); + sal_Int8 * p = s2.getArray(); + p[2] = 10; + ASSERT_EQ(sal_Int32(1), s1.getHandle()->nRefCount); + ASSERT_EQ(sal_Int32(1), s2.getHandle()->nRefCount); + ASSERT_EQ(sal_Int8(2), s1.getConstArray()[2]); + ASSERT_EQ(sal_Int8(10), s2.getConstArray()[2]); +} - void test_diffLen() { - sal_Int8 const a[5] = { 0, 1, 2, 3, 4 }; - rtl::ByteSequence s1(a, 5); - rtl::ByteSequence s2(a, 4); - CPPUNIT_ASSERT_EQUAL(sal_False, s1 == s2); - CPPUNIT_ASSERT_EQUAL(sal_False, s2 == s1); - CPPUNIT_ASSERT_EQUAL(sal_True, s1 != s2); - CPPUNIT_ASSERT_EQUAL(sal_True, s2 != s1); - } +TEST_F(Test, test_same0) { + rtl::ByteSequence s1; + rtl::ByteSequence s2; + ASSERT_EQ(sal_True, s1 == s2); + ASSERT_EQ(sal_True, s2 == s1); + ASSERT_EQ(sal_False, s1 != s2); + ASSERT_EQ(sal_False, s2 != s1); +} - void test_diffElem() { - sal_Int8 const a1[5] = { 0, 1, 2, 3, 4 }; - rtl::ByteSequence s1(a1, 5); - sal_Int8 const a2[5] = { 0, 1, 10, 3, 4 }; - rtl::ByteSequence s2(a2, 5); - CPPUNIT_ASSERT_EQUAL(sal_False, s1 == s2); - CPPUNIT_ASSERT_EQUAL(sal_False, s2 == s1); - CPPUNIT_ASSERT_EQUAL(sal_True, s1 != s2); - CPPUNIT_ASSERT_EQUAL(sal_True, s2 != s1); - } +TEST_F(Test, test_diffLen) { + sal_Int8 const a[5] = { 0, 1, 2, 3, 4 }; + rtl::ByteSequence s1(a, 5); + rtl::ByteSequence s2(a, 4); + ASSERT_EQ(sal_False, s1 == s2); + ASSERT_EQ(sal_False, s2 == s1); + ASSERT_EQ(sal_True, s1 != s2); + ASSERT_EQ(sal_True, s2 != s1); +} - CPPUNIT_TEST_SUITE(Test); - CPPUNIT_TEST(test_default); - CPPUNIT_TEST(test_size0); - CPPUNIT_TEST(test_size5); - CPPUNIT_TEST(test_noinit0); - CPPUNIT_TEST(test_noinit5); - CPPUNIT_TEST(test_elem0); - CPPUNIT_TEST(test_elem5); - CPPUNIT_TEST(test_copy); - CPPUNIT_TEST(test_fromC); - CPPUNIT_TEST(test_noacquire); - CPPUNIT_TEST(test_getArray); - CPPUNIT_TEST(test_same0); - CPPUNIT_TEST(test_diffLen); - CPPUNIT_TEST(test_diffElem); - CPPUNIT_TEST_SUITE_END(); -}; +TEST_F(Test, test_diffElem) { + sal_Int8 const a1[5] = { 0, 1, 2, 3, 4 }; + rtl::ByteSequence s1(a1, 5); + sal_Int8 const a2[5] = { 0, 1, 10, 3, 4 }; + rtl::ByteSequence s2(a2, 5); + ASSERT_EQ(sal_False, s1 == s2); + ASSERT_EQ(sal_False, s2 == s1); + ASSERT_EQ(sal_True, s1 != s2); + ASSERT_EQ(sal_True, s2 != s1); +} -CPPUNIT_TEST_SUITE_REGISTRATION(Test); } -CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sal/qa/ByteSequence/main.cxx b/sal/qa/ByteSequence/main.cxx new file mode 100644 index 0000000..df14e5b --- /dev/null +++ b/sal/qa/ByteSequence/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/sal/qa/ByteSequence/makefile.mk b/sal/qa/ByteSequence/makefile.mk index 956b8e3..7497219 100644 --- a/sal/qa/ByteSequence/makefile.mk +++ b/sal/qa/ByteSequence/makefile.mk @@ -33,19 +33,20 @@ ENABLE_EXCEPTIONS = TRUE .INCLUDE: settings.mk -CFLAGSCXX += $(CPPUNIT_CFLAGS) - -SHL1IMPLIB = i$(SHL1TARGET) -SHL1OBJS = $(SLO)/ByteSequence.obj -SHL1RPATH = NONE -SHL1STDLIBS = $(CPPUNITLIB) $(SALLIB) -SHL1TARGET = rtl_ByteSequence -SHL1VERSIONMAP = $(PRJ)/qa/export.map -DEF1NAME = $(SHL1TARGET) +.IF "$(ENABLE_UNIT_TESTS)" != "YES" +all: + @echo unit tests are disabled. Nothing to do. + +.ELSE -SLOFILES = $(SHL1OBJS) +APP1OBJS = $(SLO)/ByteSequence.obj $(SLO)/main.obj +APP1RPATH = NONE +APP1STDLIBS = $(GTESTLIB) $(SALLIB) +APP1TARGET = rtl_ByteSequence +APP1TEST = enabled .INCLUDE: target.mk -.INCLUDE: _cppunit.mk -.END +.ENDIF # "$(ENABLE_UNIT_TESTS)" != "YES" + +.END # "$(OOO_SUBSEQUENT_TESTS)" == "" commit 697eb3558a1224d4791adef36d6f0427edb475f5 Author: Damjan Jovanovic <dam...@apache.org> Date: Sun Aug 30 16:41:27 2015 +0000 #i125003# migrate main/salhelper from cppunit to Google Test and run it on every build. diff --git a/salhelper/prj/build.lst b/salhelper/prj/build.lst index 9a21849..cc7b7a4 100644 --- a/salhelper/prj/build.lst +++ b/salhelper/prj/build.lst @@ -1,3 +1,4 @@ shp salhelper : sal NULL shp salhelper usr1 - all shp_mkout NULL shp salhelper\source nmake - all shp_source NULL +shp salhelper\qa nmake - all shp_qa shp_source NULL diff --git a/salhelper/qa/main.cxx b/salhelper/qa/main.cxx new file mode 100644 index 0000000..df14e5b --- /dev/null +++ b/salhelper/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/salhelper/qa/makefile.mk b/salhelper/qa/makefile.mk index 0f902fc..29027d1 100644 --- a/salhelper/qa/makefile.mk +++ b/salhelper/qa/makefile.mk @@ -29,20 +29,18 @@ ENABLE_EXCEPTIONS := TRUE .INCLUDE: settings.mk -CFLAGSCXX += $(CPPUNIT_CFLAGS) - -SHL1TARGET = $(TARGET) -SHL1OBJS = $(SLO)$/test_api.obj -SHL1STDLIBS = $(CPPUNITLIB) $(SALLIB) $(SALHELPERLIB) $(TESTSHL2LIB) -SHL1IMPLIB = i$(SHL1TARGET) -SHL1VERSIONMAP = version.map -DEF1NAME = $(SHL1TARGET) - -SLOFILES = $(SHL1OBJS) +.IF "$(ENABLE_UNIT_TESTS)" != "YES" +all: + @echo unit tests are disabled. Nothing to do. + +.ELSE + +APP1TARGET = $(TARGET) +APP1OBJS = $(SLO)$/test_api.obj $(SLO)$/main.obj +APP1STDLIBS = $(GTESTLIB) $(SALLIB) $(SALHELPERLIB) $(TESTSHL2LIB) +APP1RPATH = NONE +APP1TEST = enabled .INCLUDE: target.mk -ALLTAR: test - -test .PHONY: $(SHL1TARGETN) - cd $(SHL1TARGETN:d) && $(TESTSHL2) $(SHL1TARGETN:f) +.ENDIF # "$(ENABLE_UNIT_TESTS)" != "YES" diff --git a/salhelper/qa/test_api.cxx b/salhelper/qa/test_api.cxx index e393f39..9dcf414 100644 --- a/salhelper/qa/test_api.cxx +++ b/salhelper/qa/test_api.cxx @@ -52,11 +52,11 @@ std::type_info const & getSimpleReferenceObjectTypeInfo() } -#include "testshl/simpleheader.hxx" #include "osl/mutex.hxx" #include "salhelper/condition.hxx" #include "salhelper/dynload.hxx" #include "salhelper/simplereferenceobject.hxx" +#include "gtest/gtest.h" #include <memory> @@ -76,91 +76,62 @@ class DerivedConditionWaiterTimedout: class DerivedSimpleReferenceObject: public salhelper::SimpleReferenceObject {}; -class Test: public CppUnit::TestFixture { +class Test: public ::testing::Test { public: - void testCondition(); - - void testConditionModifier(); - - void testConditionWaiter(); - - void testConditionWaiterTimedout(); - - void testORealDynamicLoader(); - - void testSimpleReferenceObject(); - - void testDerivedCondition(); - - void testDerivedConditionWaiterTimedout(); - - void testDerivedSimpleReferenceObject(); - - CPPUNIT_TEST_SUITE(Test); - CPPUNIT_TEST(testCondition); - CPPUNIT_TEST(testConditionModifier); - CPPUNIT_TEST(testConditionWaiter); - CPPUNIT_TEST(testConditionWaiterTimedout); - CPPUNIT_TEST(testORealDynamicLoader); - CPPUNIT_TEST(testSimpleReferenceObject); - CPPUNIT_TEST(testDerivedCondition); - CPPUNIT_TEST(testDerivedConditionWaiterTimedout); - CPPUNIT_TEST(testDerivedSimpleReferenceObject); - CPPUNIT_TEST_SUITE_END(); }; -void Test::testCondition() { +TEST_F(Test, testCondition) { osl::Mutex mutex; std::auto_ptr< salhelper::Condition > p(new DerivedCondition(mutex)); - CPPUNIT_ASSERT(typeid (*p.get()) != typeid (salhelper::Condition)); - CPPUNIT_ASSERT(typeid (p.get()) == typeid (salhelper::Condition *)); - CPPUNIT_ASSERT( + ASSERT_TRUE(typeid (*p.get()) != typeid (salhelper::Condition)); + ASSERT_TRUE(typeid (p.get()) == typeid (salhelper::Condition *)); + ASSERT_TRUE( typeid (const_cast< salhelper::Condition const * >(p.get())) == typeid (salhelper::Condition const *)); - CPPUNIT_ASSERT( + ASSERT_TRUE( typeid (const_cast< salhelper::Condition volatile * >(p.get())) == typeid (salhelper::Condition volatile *)); - CPPUNIT_ASSERT(typeid (salhelper::Condition *) == getConditionTypeInfo()); + ASSERT_TRUE(typeid (salhelper::Condition *) == getConditionTypeInfo()); } -void Test::testConditionModifier() { +TEST_F(Test, testConditionModifier) { salhelper::ConditionModifier * p = 0; - CPPUNIT_ASSERT(typeid (*p) == typeid (salhelper::ConditionModifier)); - CPPUNIT_ASSERT(typeid (p) == typeid (salhelper::ConditionModifier *)); - CPPUNIT_ASSERT( + ASSERT_TRUE(typeid (*p) == typeid (salhelper::ConditionModifier)); + ASSERT_TRUE(typeid (p) == typeid (salhelper::ConditionModifier *)); + ASSERT_TRUE( typeid (const_cast< salhelper::ConditionModifier const * >(p)) == typeid (salhelper::ConditionModifier const *)); - CPPUNIT_ASSERT( + ASSERT_TRUE( typeid (const_cast< salhelper::ConditionModifier volatile * >(p)) == typeid (salhelper::ConditionModifier volatile *)); - CPPUNIT_ASSERT( + ASSERT_TRUE( typeid (salhelper::ConditionModifier *) == getConditionModifierTypeInfo()); } -void Test::testConditionWaiter() { +TEST_F(Test, testConditionWaiter) { salhelper::ConditionWaiter * p = 0; - CPPUNIT_ASSERT(typeid (*p) == typeid (salhelper::ConditionWaiter)); - CPPUNIT_ASSERT(typeid (p) == typeid (salhelper::ConditionWaiter *)); - CPPUNIT_ASSERT( + ASSERT_TRUE(typeid (*p) == typeid (salhelper::ConditionWaiter)); + ASSERT_TRUE(typeid (p) == typeid (salhelper::ConditionWaiter *)); + ASSERT_TRUE( typeid (const_cast< salhelper::ConditionWaiter const * >(p)) == typeid (salhelper::ConditionWaiter const *)); - CPPUNIT_ASSERT( + ASSERT_TRUE( typeid (const_cast< salhelper::ConditionWaiter volatile * >(p)) == typeid (salhelper::ConditionWaiter volatile *)); - CPPUNIT_ASSERT( + ASSERT_TRUE( typeid (salhelper::ConditionWaiter *) == getConditionWaiterTypeInfo()); } -void Test::testConditionWaiterTimedout() { +TEST_F(Test, testConditionWaiterTimedout) { salhelper::ConditionWaiter::timedout x; - CPPUNIT_ASSERT(typeid (x) == typeid (salhelper::ConditionWaiter::timedout)); - CPPUNIT_ASSERT( + ASSERT_TRUE(typeid (x) == typeid (salhelper::ConditionWaiter::timedout)); + ASSERT_TRUE( typeid (&x) == typeid (salhelper::ConditionWaiter::timedout *)); - CPPUNIT_ASSERT( + ASSERT_TRUE( typeid (const_cast< salhelper::ConditionWaiter::timedout const * >(&x)) == typeid (salhelper::ConditionWaiter::timedout const *)); - CPPUNIT_ASSERT( + ASSERT_TRUE( (typeid (const_cast< salhelper::ConditionWaiter::timedout volatile * >(&x))) == typeid (salhelper::ConditionWaiter::timedout volatile *)); @@ -168,40 +139,40 @@ void Test::testConditionWaiterTimedout() { throw salhelper::ConditionWaiter::timedout(); } catch (salhelper::ConditionWaiter::timedout &) { } catch (...) { - CPPUNIT_FAIL("not caught"); + FAIL() << "not caught"; } } -void Test::testORealDynamicLoader() { +TEST_F(Test, testORealDynamicLoader) { salhelper::ORealDynamicLoader * p = 0; - CPPUNIT_ASSERT(typeid (p) != typeid (salhelper::ORealDynamicLoader)); - CPPUNIT_ASSERT(typeid (p) == typeid (salhelper::ORealDynamicLoader *)); - CPPUNIT_ASSERT( + ASSERT_TRUE(typeid (p) != typeid (salhelper::ORealDynamicLoader)); + ASSERT_TRUE(typeid (p) == typeid (salhelper::ORealDynamicLoader *)); + ASSERT_TRUE( typeid (const_cast< salhelper::ORealDynamicLoader const * >(p)) == typeid (salhelper::ORealDynamicLoader const *)); - CPPUNIT_ASSERT( + ASSERT_TRUE( typeid (const_cast< salhelper::ORealDynamicLoader volatile * >(p)) == typeid (salhelper::ORealDynamicLoader volatile *)); - CPPUNIT_ASSERT( + ASSERT_TRUE( typeid (salhelper::ORealDynamicLoader *) == getORealDynamicLoaderTypeInfo()); } -void Test::testSimpleReferenceObject() { +TEST_F(Test, testSimpleReferenceObject) { salhelper::SimpleReferenceObject * p = new DerivedSimpleReferenceObject; try { - CPPUNIT_ASSERT( + ASSERT_TRUE( typeid (*p) != typeid (salhelper::SimpleReferenceObject)); - CPPUNIT_ASSERT( + ASSERT_TRUE( typeid (p) == typeid (salhelper::SimpleReferenceObject *)); - CPPUNIT_ASSERT( + ASSERT_TRUE( typeid (const_cast< salhelper::SimpleReferenceObject const * >(p)) == typeid (salhelper::SimpleReferenceObject const *)); - CPPUNIT_ASSERT( + ASSERT_TRUE( (typeid (const_cast< salhelper::SimpleReferenceObject volatile * >(p))) == typeid (salhelper::SimpleReferenceObject volatile *)); - CPPUNIT_ASSERT( + ASSERT_TRUE( typeid (salhelper::SimpleReferenceObject *) == getSimpleReferenceObjectTypeInfo()); } catch (...) { @@ -210,37 +181,34 @@ void Test::testSimpleReferenceObject() { } } -void Test::testDerivedCondition() { +TEST_F(Test, testDerivedCondition) { osl::Mutex mutex; std::auto_ptr< salhelper::Condition > p(new DerivedCondition(mutex)); - CPPUNIT_ASSERT(dynamic_cast< DerivedCondition * >(p.get()) != 0); + ASSERT_TRUE(dynamic_cast< DerivedCondition * >(p.get()) != 0); } -void Test::testDerivedConditionWaiterTimedout() { +TEST_F(Test, testDerivedConditionWaiterTimedout) { std::auto_ptr< salhelper::ConditionWaiter::timedout > p( new DerivedConditionWaiterTimedout); - CPPUNIT_ASSERT( + ASSERT_TRUE( dynamic_cast< DerivedConditionWaiterTimedout * >(p.get()) != 0); try { throw DerivedConditionWaiterTimedout(); } catch (salhelper::ConditionWaiter::timedout &) { } catch (...) { - CPPUNIT_FAIL("not caught"); + FAIL() << "not caught"; } } -void Test::testDerivedSimpleReferenceObject() { +TEST_F(Test, testDerivedSimpleReferenceObject) { salhelper::SimpleReferenceObject * p = new DerivedSimpleReferenceObject; try { - CPPUNIT_ASSERT(dynamic_cast< DerivedSimpleReferenceObject * >(p) != 0); + ASSERT_TRUE(dynamic_cast< DerivedSimpleReferenceObject * >(p) != 0); } catch (...) { delete static_cast< DerivedSimpleReferenceObject * >(p); throw; } } -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests"); } - -NOADDITIONAL; diff --git a/salhelper/qa/version.map b/salhelper/qa/version.map deleted file mode 100644 index 9ee1210..0000000 --- a/salhelper/qa/version.map +++ /dev/null @@ -1,26 +0,0 @@ -############################################################### -# -# 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. -# -############################################################### -UDK_3_0_0 { - global: - registerAllTestFunction; - local: - *; -}; commit 051fe77523469dca82d7cee1976c9b4fda860a04 Author: Andrea Pescetti <pesce...@apache.org> Date: Sun Aug 30 16:33:25 2015 +0000 #i126454# Update English dictionary to version 2015.08.01 diff --git a/extensions.lst b/extensions.lst index 7330aaf..7fabb517 100644 --- a/extensions.lst +++ b/extensions.lst @@ -39,7 +39,7 @@ # English dictionary [ language=en.* || language=de || language=it ] - 5ddb509520382d0f2cb897b072904e25 http://sourceforge.net/projects/aoo-extensions/files/17102/14/dict-en.oxt/download "dict-en.oxt" + 65580f36a52c38819db4d9c2a6656526 http://sourceforge.net/projects/aoo-extensions/files/17102/19/dict-en.oxt/download "dict-en.oxt" # English (USA, en_US) dictionary [ language==nl || language==ru ] _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits