From 0a0a3046ad01ee4f3aa436485ae48cbff9d74272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be> Date: Sun, 23 Jan 2011 15:07:37 +0100 Subject: Added test suite registration checker. diff --git a/BuildTools/CheckTests.py b/BuildTools/CheckTests.py new file mode 100755 index 0000000..0ea56bd --- /dev/null +++ b/BuildTools/CheckTests.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python + +import os, sys, re + +foundUnregisteredTests = False + +for (path, dirs, files) in os.walk(".") : + if not "3rdParty" in path : + for filename in [os.path.join(path, file) for file in files if file.endswith("Test.cpp") and file != "IdleQuerierTest.cpp" and file != "NotifierTest.cpp" and file != "ClientTest.cpp" and file != "ConnectivityTest.cpp" and file != "ReconnectTest.cpp"] : + file = open(filename, "r") + isRegistered = False + registeredTests = set() + declaredTests = set() + for line in file.readlines() : + m = re.match("\s*CPPUNIT_TEST_SUITE_REGISTRATION\((.*)\)", line) + if m : + isRegistered = True + m = re.match("\s*CPPUNIT_TEST\((.*)\)", line) + if m : + registeredTests.add(m.group(1)) + continue + m = re.match("\s*void (test.*)\(\)", line) + if m : + declaredTests.add(m.group(1)) + if not isRegistered : + print filename + ": Registration missing" + foundUnregisteredTests = True + if registeredTests - declaredTests != set([]) : + print filename + ": " + str(registeredTests - declaredTests) + foundUnregisteredTests = True + file.close() + +sys.exit(foundUnregisteredTests) diff --git a/Swift/Controllers/UnitTest/PreviousStatusStoreTest.cpp b/Swift/Controllers/UnitTest/PreviousStatusStoreTest.cpp index 10fb2fa..9489e5b 100644 --- a/Swift/Controllers/UnitTest/PreviousStatusStoreTest.cpp +++ b/Swift/Controllers/UnitTest/PreviousStatusStoreTest.cpp @@ -40,3 +40,5 @@ public: private: PreviousStatusStore* store_; }; + +CPPUNIT_TEST_SUITE_REGISTRATION(PreviousStatusStoreTest); diff --git a/Swiften/Elements/UnitTest/StanzasTest.cpp b/Swiften/Elements/UnitTest/StanzasTest.cpp deleted file mode 100644 index b4cc74d..0000000 --- a/Swiften/Elements/UnitTest/StanzasTest.cpp +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#include "Swiften/Elements/Message.h" -#include "Swiften/Elements/IQ.h" -#include "Swiften/Elements/Presence.h" diff --git a/Swiften/History/UnitTest/SQLiteHistoryManagerTest.cpp b/Swiften/History/UnitTest/SQLiteHistoryManagerTest.cpp index 223920e..0092e0f 100644 --- a/Swiften/History/UnitTest/SQLiteHistoryManagerTest.cpp +++ b/Swiften/History/UnitTest/SQLiteHistoryManagerTest.cpp @@ -14,15 +14,15 @@ using namespace Swift; class SQLiteHistoryManagerTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(SQLiteHistoryManagerTest); - CPPUNIT_TEST(testAddMessage); - CPPUNIT_TEST(testAddMessage_TwoMessages); - CPPUNIT_TEST(testGetIDForJID_SameJID); - CPPUNIT_TEST(testGetIDForJID_DifferentJIDs); - CPPUNIT_TEST(getJIDFromID); - CPPUNIT_TEST(getJIDFromID_UnexistingID); - CPPUNIT_TEST(getIDFromJID); - CPPUNIT_TEST(getIDFromJID_UnexistingJID); - CPPUNIT_TEST_SUITE_END(); + //CPPUNIT_TEST(testAddMessage); + //CPPUNIT_TEST(testAddMessage_TwoMessages); + //CPPUNIT_TEST(testGetIDForJID_SameJID); + //CPPUNIT_TEST(testGetIDForJID_DifferentJIDs); + //CPPUNIT_TEST(getJIDFromID); + //CPPUNIT_TEST(getJIDFromID_UnexistingID); + //CPPUNIT_TEST(getIDFromJID); + //CPPUNIT_TEST(getIDFromJID_UnexistingJID); + //CPPUNIT_TEST_SUITE_END(); public: SQLiteHistoryManagerTest() {} diff --git a/Swiften/Roster/UnitTest/OfflineRosterFilterTest.cpp b/Swiften/Roster/UnitTest/OfflineRosterFilterTest.cpp deleted file mode 100644 index 6c9a582..0000000 --- a/Swiften/Roster/UnitTest/OfflineRosterFilterTest.cpp +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - diff --git a/Swiften/SASL/UnitTest/DIGESTMD5ClientAuthenticatorTest.cpp b/Swiften/SASL/UnitTest/DIGESTMD5ClientAuthenticatorTest.cpp index 8daea4f..72c2b64 100644 --- a/Swiften/SASL/UnitTest/DIGESTMD5ClientAuthenticatorTest.cpp +++ b/Swiften/SASL/UnitTest/DIGESTMD5ClientAuthenticatorTest.cpp @@ -17,8 +17,7 @@ class DIGESTMD5ClientAuthenticatorTest : public CppUnit::TestFixture { CPPUNIT_TEST(testGetInitialResponse); CPPUNIT_TEST(testGetResponse); CPPUNIT_TEST(testGetResponse_WithAuthorizationID); - /*CPPUNIT_TEST(testSetChallenge); - CPPUNIT_TEST(testSetChallenge_InvalidBlabBla);*/ + //CPPUNIT_TEST(testSetChallenge); CPPUNIT_TEST_SUITE_END(); public: diff --git a/Swiften/SConscript b/Swiften/SConscript index 8474610..c325d03 100644 --- a/Swiften/SConscript +++ b/Swiften/SConscript @@ -196,7 +196,6 @@ if env["SCONS_STAGE"] == "build" : File("Elements/UnitTest/IQTest.cpp"), File("Elements/UnitTest/StanzaTest.cpp"), File("Elements/UnitTest/FormTest.cpp"), - File("Elements/UnitTest/StanzasTest.cpp"), File("EventLoop/UnitTest/EventLoopTest.cpp"), File("EventLoop/UnitTest/SimpleEventLoopTest.cpp"), File("FileTransfer/UnitTest/SOCKS5BytestreamServerSessionTest.cpp"), @@ -249,7 +248,6 @@ if env["SCONS_STAGE"] == "build" : File("Queries/UnitTest/IQRouterTest.cpp"), File("Queries/UnitTest/RequestTest.cpp"), File("Queries/UnitTest/ResponderTest.cpp"), - File("Roster/UnitTest/OfflineRosterFilterTest.cpp"), File("Roster/UnitTest/RosterTest.cpp"), File("Roster/UnitTest/XMPPRosterImplTest.cpp"), File("Roster/UnitTest/XMPPRosterControllerTest.cpp"), -- cgit v0.10.2-6-g49f6