mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 23:49:35 -05:00
partial resurrectin of ft tests
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3595 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
9bdf222418
commit
f21cc0d746
@ -7,15 +7,16 @@ RS_TOP_DIR = ../..
|
|||||||
include $(RS_TOP_DIR)/tests/scripts/config.mk
|
include $(RS_TOP_DIR)/tests/scripts/config.mk
|
||||||
###############################################################
|
###############################################################
|
||||||
|
|
||||||
TESTOBJ = ftfileprovidertest.o ftfilecreatortest.o ftextralisttest.o ftdataplextest.o fttransfermoduletest.o ftcrc32test.o
|
TESTOBJ = ftfileprovidertest.o ftfilecreatortest.o ftextralisttest.o ftdataplextest.o fttransfermoduletest.o ftcrc32test.o ftcontrollertest.o ftserver1test.o ftserver2test.o ftserver3test.o
|
||||||
#ftserver1test.o ftserver2test.o ftserver3test.o
|
|
||||||
|
|
||||||
|
|
||||||
TESTS = ftfileprovidertest ftfilecreatortest ftextralisttest ftdataplextest fttransfermoduletest ftcrc32test
|
TESTS = ftfileprovidertest ftfilecreatortest ftextralisttest ftdataplextest fttransfermoduletest ftcrc32test ftcontrollertest ftserver1test ftserver2test fttransfermoduletest ftserver3test
|
||||||
#ftserver1test ftserver2test fttransfermoduletest ftserver3test
|
|
||||||
|
|
||||||
all: tests
|
all: tests
|
||||||
|
|
||||||
|
ftcontrollertest : ftcontrollertest.o
|
||||||
|
$(CC) $(CFLAGS) -o ftcontrollertest ftcontrollertest.o $(LIBS)
|
||||||
|
|
||||||
ftfilecreatortest : ftfilecreatortest.o
|
ftfilecreatortest : ftfilecreatortest.o
|
||||||
$(CC) $(CFLAGS) -o ftfilecreatortest ftfilecreatortest.o $(LIBS)
|
$(CC) $(CFLAGS) -o ftfilecreatortest ftfilecreatortest.o $(LIBS)
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
* ftServer2Test - Demonstrates how to check for test stuff.
|
* ftServer2Test - Demonstrates how to check for test stuff.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "retroshare/rsfiles.h"
|
||||||
#include "ft/ftserver.h"
|
#include "ft/ftserver.h"
|
||||||
|
|
||||||
#include "ft/ftextralist.h"
|
#include "ft/ftextralist.h"
|
||||||
@ -38,7 +39,7 @@
|
|||||||
|
|
||||||
#include "util/rsdebug.h"
|
#include "util/rsdebug.h"
|
||||||
|
|
||||||
#include "ft/pqitestor.h"
|
#include "pqitestor.h"
|
||||||
#include "util/rsdir.h"
|
#include "util/rsdir.h"
|
||||||
#include "util/utest.h"
|
#include "util/utest.h"
|
||||||
|
|
||||||
@ -73,7 +74,7 @@ int main(int argc, char **argv)
|
|||||||
bool debugStderr = true;
|
bool debugStderr = true;
|
||||||
bool loadAll = false;
|
bool loadAll = false;
|
||||||
|
|
||||||
std::list<std::string> fileList;
|
std::list<SharedDirInfo> fileList;
|
||||||
std::list<std::string> extraList;
|
std::list<std::string> extraList;
|
||||||
std::list<std::string> peerIds;
|
std::list<std::string> peerIds;
|
||||||
std::map<std::string, ftServer *> mFtServers;
|
std::map<std::string, ftServer *> mFtServers;
|
||||||
@ -120,7 +121,13 @@ int main(int argc, char **argv)
|
|||||||
for(; optind < argc; optind++)
|
for(; optind < argc; optind++)
|
||||||
{
|
{
|
||||||
std::cerr << "Adding: " << argv[optind] << std::endl;
|
std::cerr << "Adding: " << argv[optind] << std::endl;
|
||||||
fileList.push_back(std::string(argv[optind]));
|
|
||||||
|
SharedDirInfo info ;
|
||||||
|
info.shareflags = RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_BROWSABLE ;
|
||||||
|
info.filename = std::string(argv[optind]);
|
||||||
|
info.virtualname = info.filename ;
|
||||||
|
|
||||||
|
fileList.push_back(info) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We need to setup a series 2 - 4 different ftServers....
|
/* We need to setup a series 2 - 4 different ftServers....
|
||||||
@ -136,7 +143,7 @@ int main(int argc, char **argv)
|
|||||||
std::list<pqiAuthDetails> baseFriendList, friendList;
|
std::list<pqiAuthDetails> baseFriendList, friendList;
|
||||||
std::list<pqiAuthDetails>::iterator fit;
|
std::list<pqiAuthDetails>::iterator fit;
|
||||||
|
|
||||||
P3Hub *testHub = new P3Hub();
|
P3Hub *testHub = new P3Hub(0,NULL);
|
||||||
testHub->start();
|
testHub->start();
|
||||||
|
|
||||||
/* Setup Base Friend Info */
|
/* Setup Base Friend Info */
|
||||||
@ -191,7 +198,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
/* add server */
|
/* add server */
|
||||||
ftServer *server;
|
ftServer *server;
|
||||||
server = new ftServer(authMgr, connMgr);
|
server = new ftServer(connMgr);
|
||||||
mFtServers[*it] = server;
|
mFtServers[*it] = server;
|
||||||
if (!mLoadServer)
|
if (!mLoadServer)
|
||||||
{
|
{
|
||||||
@ -386,7 +393,7 @@ void *do_server_test_thread(void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DirDetails details;
|
DirDetails details;
|
||||||
uint32_t flags = DIR_FLAGS_DETAILS | DIR_FLAGS_REMOTE;
|
flags = DIR_FLAGS_DETAILS | DIR_FLAGS_REMOTE;
|
||||||
void *ref = NULL;
|
void *ref = NULL;
|
||||||
|
|
||||||
if(!server->RequestDirDetails(ref,details,flags))
|
if(!server->RequestDirDetails(ref,details,flags))
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
#include "util/rsdebug.h"
|
#include "util/rsdebug.h"
|
||||||
|
|
||||||
#include "ft/pqitestor.h"
|
#include "pqitestor.h"
|
||||||
#include "util/rsdir.h"
|
#include "util/rsdir.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include "retroshare/rsfiles.h"
|
||||||
#include "ft/ftserver.h"
|
#include "ft/ftserver.h"
|
||||||
|
|
||||||
#include "ft/ftextralist.h"
|
#include "ft/ftextralist.h"
|
||||||
@ -44,7 +45,7 @@
|
|||||||
|
|
||||||
#include "util/rsdebug.h"
|
#include "util/rsdebug.h"
|
||||||
|
|
||||||
#include "ft/pqitestor.h"
|
#include "pqitestor.h"
|
||||||
#include "util/rsdir.h"
|
#include "util/rsdir.h"
|
||||||
#include "util/utest.h"
|
#include "util/utest.h"
|
||||||
|
|
||||||
@ -79,7 +80,7 @@ int main(int argc, char **argv)
|
|||||||
bool debugStderr = true;
|
bool debugStderr = true;
|
||||||
bool loadAll = false;
|
bool loadAll = false;
|
||||||
|
|
||||||
std::list<std::string> fileList;
|
std::list<SharedDirInfo> fileList;
|
||||||
std::list<std::string> extraList;
|
std::list<std::string> extraList;
|
||||||
std::list<std::string> peerIds;
|
std::list<std::string> peerIds;
|
||||||
std::map<std::string, ftServer *> mFtServers;
|
std::map<std::string, ftServer *> mFtServers;
|
||||||
@ -149,7 +150,11 @@ int main(int argc, char **argv)
|
|||||||
for(; optind < argc; optind++)
|
for(; optind < argc; optind++)
|
||||||
{
|
{
|
||||||
std::cerr << "Adding: " << argv[optind] << std::endl;
|
std::cerr << "Adding: " << argv[optind] << std::endl;
|
||||||
fileList.push_back(std::string(argv[optind]));
|
SharedDirInfo info ;
|
||||||
|
info.shareflag = RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_BROWSABLE ;
|
||||||
|
info.filename = string(argv[optind]);
|
||||||
|
info.virtualname = string(argv[optind]);
|
||||||
|
fileList.push_back(info) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We need to setup a series 2 - 4 different ftServers....
|
/* We need to setup a series 2 - 4 different ftServers....
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
|
|
||||||
#include "util/rsdebug.h"
|
#include "util/rsdebug.h"
|
||||||
|
|
||||||
#include "ft/pqitestor.h"
|
#include "pqitestor.h"
|
||||||
#include "util/rsdir.h"
|
#include "util/rsdir.h"
|
||||||
#include "util/utest.h"
|
#include "util/utest.h"
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ int main(int argc, char **argv)
|
|||||||
bool loadAll = false;
|
bool loadAll = false;
|
||||||
bool loadOthers = false;
|
bool loadOthers = false;
|
||||||
|
|
||||||
std::list<std::string> fileList;
|
std::list<SharedDirInfo> fileList;
|
||||||
std::list<std::string> extraList;
|
std::list<std::string> extraList;
|
||||||
std::list<std::string> peerIds;
|
std::list<std::string> peerIds;
|
||||||
std::map<std::string, ftServer *> mFtServers;
|
std::map<std::string, ftServer *> mFtServers;
|
||||||
@ -159,7 +159,13 @@ int main(int argc, char **argv)
|
|||||||
for(; optind < argc; optind++)
|
for(; optind < argc; optind++)
|
||||||
{
|
{
|
||||||
std::cerr << "Adding: " << argv[optind] << std::endl;
|
std::cerr << "Adding: " << argv[optind] << std::endl;
|
||||||
fileList.push_back(std::string(argv[optind]));
|
|
||||||
|
SharedDirInfo info ;
|
||||||
|
info.filename = std::string(argv[optind]);
|
||||||
|
info.virtualname = info.filename ;
|
||||||
|
info.shareflags = RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_BROWSABLE ;
|
||||||
|
|
||||||
|
fileList.push_back(info) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We need to setup a series 2 - 4 different ftServers....
|
/* We need to setup a series 2 - 4 different ftServers....
|
||||||
@ -386,10 +392,10 @@ void *do_server_test_thread(void *data)
|
|||||||
SizeExpression se(Smaller, minFileSize);
|
SizeExpression se(Smaller, minFileSize);
|
||||||
Expression *expr = &se;
|
Expression *expr = &se;
|
||||||
|
|
||||||
std::list<FileDetail> results;
|
std::list<DirDetails> results;
|
||||||
std::list<FileDetail>::iterator it;
|
std::list<DirDetails>::iterator it;
|
||||||
|
|
||||||
oServer->SearchBoolExp(expr, results);
|
oServer->SearchBoolExp(expr, results, RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_BROWSABLE);
|
||||||
|
|
||||||
if (results.size() < 1)
|
if (results.size() < 1)
|
||||||
{
|
{
|
||||||
@ -400,10 +406,9 @@ void *do_server_test_thread(void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* find the first remote entry */
|
/* find the first remote entry */
|
||||||
FileDetail sFile;
|
DirDetails sFile;
|
||||||
bool foundFile = false;
|
bool foundFile = false;
|
||||||
for(it = results.begin();
|
for(it = results.begin(); (it != results.end()); it++)
|
||||||
(it != results.end()); it++)
|
|
||||||
{
|
{
|
||||||
std::cerr << "Shared File: " << it->name;
|
std::cerr << "Shared File: " << it->name;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
@ -108,44 +108,53 @@ private:
|
|||||||
|
|
||||||
class P3Pipe: public P3Interface
|
class P3Pipe: public P3Interface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
P3Pipe() {return; }
|
P3Pipe() {return; }
|
||||||
virtual ~P3Pipe() {return; }
|
virtual ~P3Pipe() {return; }
|
||||||
|
|
||||||
virtual int tick() { return 1; }
|
virtual int tick() { return 1; }
|
||||||
virtual int status() { return 1; }
|
virtual int status() { return 1; }
|
||||||
|
|
||||||
/* Overloaded from P3Interface */
|
/* Overloaded from P3Interface */
|
||||||
virtual int SearchSpecific(RsCacheRequest *item);
|
virtual int SearchSpecific(RsCacheRequest *item);
|
||||||
virtual int SendSearchResult(RsCacheItem *item);
|
virtual int SendSearchResult(RsCacheItem *item);
|
||||||
virtual int SendFileRequest(RsFileRequest *item);
|
virtual int SendFileRequest(RsFileRequest *item);
|
||||||
virtual int SendFileData(RsFileData *item);
|
virtual int SendFileData(RsFileData *item);
|
||||||
virtual int SendRsRawItem(RsRawItem *item);
|
virtual int SendRsRawItem(RsRawItem *item);
|
||||||
|
|
||||||
virtual RsCacheRequest *RequestedSearch();
|
virtual RsCacheRequest *RequestedSearch();
|
||||||
virtual RsCacheItem *GetSearchResult();
|
virtual RsCacheItem *GetSearchResult();
|
||||||
virtual RsFileRequest *GetFileRequest();
|
virtual RsFileRequest *GetFileRequest();
|
||||||
virtual RsFileData *GetFileData();
|
virtual RsFileData *GetFileData();
|
||||||
virtual RsRawItem *GetRsRawItem();
|
virtual RsRawItem *GetRsRawItem();
|
||||||
|
|
||||||
/* Lower Interface for PQIHub */
|
virtual RsFileChunkMapRequest* GetFileChunkMapRequest() ;
|
||||||
|
virtual int SendFileChunkMapRequest(RsFileChunkMapRequest*) ;
|
||||||
|
virtual RsFileChunkMap* GetFileChunkMap() ;
|
||||||
|
virtual int SendFileChunkMap(RsFileChunkMap*) ;
|
||||||
|
virtual RsFileCRC32MapRequest* GetFileCRC32MapRequest() ;
|
||||||
|
virtual int SendFileCRC32MapRequest(RsFileCRC32MapRequest*) ;
|
||||||
|
virtual RsFileCRC32Map* GetFileCRC32Map() ;
|
||||||
|
virtual int SendFileCRC32Map(RsFileCRC32Map*) ;
|
||||||
|
|
||||||
RsItem *PopSentItem();
|
/* Lower Interface for PQIHub */
|
||||||
int PushRecvdItem(RsItem *item);
|
|
||||||
|
RsItem *PopSentItem();
|
||||||
|
int PushRecvdItem(RsItem *item);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int SendAllItem(RsItem *item);
|
int SendAllItem(RsItem *item);
|
||||||
|
|
||||||
RsMutex pipeMtx;
|
RsMutex pipeMtx;
|
||||||
|
|
||||||
std::list<RsItem *> mSentItems;
|
std::list<RsItem *> mSentItems;
|
||||||
|
|
||||||
std::list<RsCacheRequest *> mRecvdRsCacheRequests;
|
std::list<RsCacheRequest *> mRecvdRsCacheRequests;
|
||||||
std::list<RsCacheItem *> mRecvdRsCacheItems;
|
std::list<RsCacheItem *> mRecvdRsCacheItems;
|
||||||
std::list<RsFileRequest *> mRecvdRsFileRequests;
|
std::list<RsFileRequest *> mRecvdRsFileRequests;
|
||||||
std::list<RsFileData *> mRecvdRsFileDatas;
|
std::list<RsFileData *> mRecvdRsFileDatas;
|
||||||
std::list<RsRawItem *> mRecvdRsRawItems;
|
std::list<RsRawItem *> mRecvdRsRawItems;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user