diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2025-05-25 10:14:14 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2025-05-25 10:14:14 +0900 |
commit | edc958f6e74feb036c90bfa55f40df1c55c37153 (patch) | |
tree | 65b5a135e019ae03a4ddfaf52051f93dc0554f1d | |
parent | 08705a9e9ab8fc7286aabf45d75a3a680f804dd7 (diff) | |
download | ktorrent-feat/cmake-tester.tar.gz ktorrent-feat/cmake-tester.zip |
Add cmake rules for utests and fix tester programfeat/cmake-tester
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/libktorrent/kademlia/rpcmsg.h | 3 | ||||
-rw-r--r-- | src/libktorrent/mse/bigint.h | 3 | ||||
-rw-r--r-- | src/libktorrent/mse/functions.h | 10 | ||||
-rw-r--r-- | src/libktorrent/mse/rc4encryptor.h | 5 | ||||
-rw-r--r-- | src/utests/CMakeLists.txt | 18 | ||||
-rw-r--r-- | src/utests/main.cpp | 2 | ||||
-rw-r--r-- | src/utests/upnpparseresponsetest.cpp | 2 |
8 files changed, 35 insertions, 9 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a380326..8987cae 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,3 +17,4 @@ add_subdirectory( libktorrent ) add_subdirectory( plugins ) add_subdirectory( apps ) add_subdirectory( scripts ) +add_subdirectory( utests ) diff --git a/src/libktorrent/kademlia/rpcmsg.h b/src/libktorrent/kademlia/rpcmsg.h index acdae14..be8f418 100644 --- a/src/libktorrent/kademlia/rpcmsg.h +++ b/src/libktorrent/kademlia/rpcmsg.h @@ -24,6 +24,7 @@ #include <util/constants.h> #include "key.h" #include "database.h" +#include <libktorrent_export.h> namespace bt { @@ -128,7 +129,7 @@ namespace dht */ MsgBase* MakeRPCMsg(bt::BDictNode* dict,RPCServer* srv); - MsgBase* MakeRPCMsgTest(bt::BDictNode* dict,dht::Method req_method); + LIBKTORRENT_EXPORT MsgBase* MakeRPCMsgTest(bt::BDictNode* dict,dht::Method req_method); class ErrMsg : public MsgBase { diff --git a/src/libktorrent/mse/bigint.h b/src/libktorrent/mse/bigint.h index 39bb865..5cd1940 100644 --- a/src/libktorrent/mse/bigint.h +++ b/src/libktorrent/mse/bigint.h @@ -24,6 +24,7 @@ #include <util/constants.h> #include <stdio.h> #include <gmp.h> +#include <libktorrent_export.h> using bt::Uint8; using bt::Uint16; @@ -39,7 +40,7 @@ namespace mse * Class which can hold an arbitrary large integer. This will be a very important part of our * MSE implementation. */ - class BigInt + class LIBKTORRENT_EXPORT BigInt { public: /** diff --git a/src/libktorrent/mse/functions.h b/src/libktorrent/mse/functions.h index 95e8e5d..a5e7cab 100644 --- a/src/libktorrent/mse/functions.h +++ b/src/libktorrent/mse/functions.h @@ -20,6 +20,8 @@ #ifndef MSEFUNCTIONS_H #define MSEFUNCTIONS_H +#include <libktorrent_export.h> + namespace bt { class SHA1Hash; @@ -29,11 +31,11 @@ namespace mse { class BigInt; - void GeneratePublicPrivateKey(BigInt & pub,BigInt & priv); - BigInt DHSecret(const BigInt & our_priv,const BigInt & peer_pub); - bt::SHA1Hash EncryptionKey(bool a,const BigInt & s,const bt::SHA1Hash & skey); + LIBKTORRENT_EXPORT void GeneratePublicPrivateKey(BigInt & pub,BigInt & priv); + LIBKTORRENT_EXPORT BigInt DHSecret(const BigInt & our_priv,const BigInt & peer_pub); + LIBKTORRENT_EXPORT bt::SHA1Hash EncryptionKey(bool a,const BigInt & s,const bt::SHA1Hash & skey); - void DumpBigInt(const TQString & name,const BigInt & bi); + LIBKTORRENT_EXPORT void DumpBigInt(const TQString & name,const BigInt & bi); } #endif diff --git a/src/libktorrent/mse/rc4encryptor.h b/src/libktorrent/mse/rc4encryptor.h index 650b54e..c36b9c6 100644 --- a/src/libktorrent/mse/rc4encryptor.h +++ b/src/libktorrent/mse/rc4encryptor.h @@ -22,6 +22,7 @@ #include <util/sha1hash.h> #include <util/constants.h> +#include <libktorrent_export.h> using bt::Uint8; using bt::Uint32; @@ -31,7 +32,7 @@ namespace mse /** * Helper class to do the actual encryption / decryption */ - class RC4 + class LIBKTORRENT_EXPORT RC4 { Uint8 i,j; Uint8 s[256]; @@ -50,7 +51,7 @@ namespace mse * This class has a static encryption buffer, which makes it not thread safe * because the buffer is not protected by mutexes. */ - class RC4Encryptor + class LIBKTORRENT_EXPORT RC4Encryptor { RC4 enc,dec; public: diff --git a/src/utests/CMakeLists.txt b/src/utests/CMakeLists.txt new file mode 100644 index 0000000..7eebbbe --- /dev/null +++ b/src/utests/CMakeLists.txt @@ -0,0 +1,18 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/src + ${CMAKE_SOURCE_DIR}/src/libktorrent +) + + +##### ktorrent (executable) + +tde_add_check_executable( ktutester AUTOMOC + SOURCES + unittest.cpp testrunner.cpp main.cpp upnpparsedescriptiontest.cpp upnpparseresponsetest.cpp + dhtmsgparsetest.cpp biginttest.cpp rc4test.cpp difflehellmantest.cpp + LINK + ktupnp-static + ktorrent-shared tdecore-shared tdeui-shared tdeio-shared DCOP-shared +) diff --git a/src/utests/main.cpp b/src/utests/main.cpp index 7618cac..f9feb89 100644 --- a/src/utests/main.cpp +++ b/src/utests/main.cpp @@ -28,6 +28,7 @@ #include "biginttest.h" #include "rc4test.h" #include "difflehellmantest.h" +#include <tqfile.h> using namespace kt; using namespace bt; @@ -38,6 +39,7 @@ using namespace utest; int main(int argc,char** argv) { Globals::instance().setDebugMode(true); + TQFile::remove("ktutester.log"); Globals::instance().initLog("ktutester.log"); TestRunner tr; tr.addTest(new UPnPParseDescriptionTest()); diff --git a/src/utests/upnpparseresponsetest.cpp b/src/utests/upnpparseresponsetest.cpp index 97102cf..a096b59 100644 --- a/src/utests/upnpparseresponsetest.cpp +++ b/src/utests/upnpparseresponsetest.cpp @@ -38,7 +38,7 @@ namespace utest bool UPnPParseResponseTest::doTest() { - static const char* test_ps = "M-SEARCH * HTTP/1.1\r\n" + static const char* test_ps = "HTTP/1.1\r\n" "HOST: 239.255.255.250:1900\r\n" "ST:urn:schemas-upnp-org:device:InternetGatewayDevice:1\r\n" "MAN:\"ssdp:discover\"\r\n" |