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:
csoler 2010-10-03 13:14:28 +00:00
parent 9bdf222418
commit f21cc0d746
6 changed files with 77 additions and 50 deletions

View File

@ -7,15 +7,16 @@ RS_TOP_DIR = ../..
include $(RS_TOP_DIR)/tests/scripts/config.mk
###############################################################
TESTOBJ = ftfileprovidertest.o ftfilecreatortest.o ftextralisttest.o ftdataplextest.o fttransfermoduletest.o ftcrc32test.o
#ftserver1test.o ftserver2test.o ftserver3test.o
TESTOBJ = ftfileprovidertest.o ftfilecreatortest.o ftextralisttest.o ftdataplextest.o fttransfermoduletest.o ftcrc32test.o ftcontrollertest.o ftserver1test.o ftserver2test.o ftserver3test.o
TESTS = ftfileprovidertest ftfilecreatortest ftextralisttest ftdataplextest fttransfermoduletest ftcrc32test
#ftserver1test ftserver2test fttransfermoduletest ftserver3test
TESTS = ftfileprovidertest ftfilecreatortest ftextralisttest ftdataplextest fttransfermoduletest ftcrc32test ftcontrollertest ftserver1test ftserver2test fttransfermoduletest ftserver3test
all: tests
ftcontrollertest : ftcontrollertest.o
$(CC) $(CFLAGS) -o ftcontrollertest ftcontrollertest.o $(LIBS)
ftfilecreatortest : ftfilecreatortest.o
$(CC) $(CFLAGS) -o ftfilecreatortest ftfilecreatortest.o $(LIBS)

View File

@ -27,6 +27,7 @@
* ftServer2Test - Demonstrates how to check for test stuff.
*/
#include "retroshare/rsfiles.h"
#include "ft/ftserver.h"
#include "ft/ftextralist.h"
@ -38,7 +39,7 @@
#include "util/rsdebug.h"
#include "ft/pqitestor.h"
#include "pqitestor.h"
#include "util/rsdir.h"
#include "util/utest.h"
@ -73,7 +74,7 @@ int main(int argc, char **argv)
bool debugStderr = true;
bool loadAll = false;
std::list<std::string> fileList;
std::list<SharedDirInfo> fileList;
std::list<std::string> extraList;
std::list<std::string> peerIds;
std::map<std::string, ftServer *> mFtServers;
@ -120,7 +121,13 @@ int main(int argc, char **argv)
for(; optind < argc; optind++)
{
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....
@ -136,7 +143,7 @@ int main(int argc, char **argv)
std::list<pqiAuthDetails> baseFriendList, friendList;
std::list<pqiAuthDetails>::iterator fit;
P3Hub *testHub = new P3Hub();
P3Hub *testHub = new P3Hub(0,NULL);
testHub->start();
/* Setup Base Friend Info */
@ -191,7 +198,7 @@ int main(int argc, char **argv)
/* add server */
ftServer *server;
server = new ftServer(authMgr, connMgr);
server = new ftServer(connMgr);
mFtServers[*it] = server;
if (!mLoadServer)
{
@ -386,7 +393,7 @@ void *do_server_test_thread(void *data)
}
DirDetails details;
uint32_t flags = DIR_FLAGS_DETAILS | DIR_FLAGS_REMOTE;
flags = DIR_FLAGS_DETAILS | DIR_FLAGS_REMOTE;
void *ref = NULL;
if(!server->RequestDirDetails(ref,details,flags))

View File

@ -44,7 +44,7 @@
#include "util/rsdebug.h"
#include "ft/pqitestor.h"
#include "pqitestor.h"
#include "util/rsdir.h"
#include <sstream>

View File

@ -33,6 +33,7 @@
#endif
#include "retroshare/rsfiles.h"
#include "ft/ftserver.h"
#include "ft/ftextralist.h"
@ -44,7 +45,7 @@
#include "util/rsdebug.h"
#include "ft/pqitestor.h"
#include "pqitestor.h"
#include "util/rsdir.h"
#include "util/utest.h"
@ -79,7 +80,7 @@ int main(int argc, char **argv)
bool debugStderr = true;
bool loadAll = false;
std::list<std::string> fileList;
std::list<SharedDirInfo> fileList;
std::list<std::string> extraList;
std::list<std::string> peerIds;
std::map<std::string, ftServer *> mFtServers;
@ -149,7 +150,11 @@ int main(int argc, char **argv)
for(; optind < argc; optind++)
{
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....

View File

@ -50,7 +50,7 @@
#include "util/rsdebug.h"
#include "ft/pqitestor.h"
#include "pqitestor.h"
#include "util/rsdir.h"
#include "util/utest.h"
@ -86,7 +86,7 @@ int main(int argc, char **argv)
bool loadAll = false;
bool loadOthers = false;
std::list<std::string> fileList;
std::list<SharedDirInfo> fileList;
std::list<std::string> extraList;
std::list<std::string> peerIds;
std::map<std::string, ftServer *> mFtServers;
@ -159,7 +159,13 @@ int main(int argc, char **argv)
for(; optind < argc; optind++)
{
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....
@ -386,10 +392,10 @@ void *do_server_test_thread(void *data)
SizeExpression se(Smaller, minFileSize);
Expression *expr = &se;
std::list<FileDetail> results;
std::list<FileDetail>::iterator it;
std::list<DirDetails> results;
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)
{
@ -400,10 +406,9 @@ void *do_server_test_thread(void *data)
}
/* find the first remote entry */
FileDetail sFile;
DirDetails sFile;
bool foundFile = false;
for(it = results.begin();
(it != results.end()); it++)
for(it = results.begin(); (it != results.end()); it++)
{
std::cerr << "Shared File: " << it->name;
std::cerr << std::endl;

View File

@ -108,44 +108,53 @@ private:
class P3Pipe: public P3Interface
{
public:
P3Pipe() {return; }
virtual ~P3Pipe() {return; }
public:
P3Pipe() {return; }
virtual ~P3Pipe() {return; }
virtual int tick() { return 1; }
virtual int status() { return 1; }
virtual int tick() { return 1; }
virtual int status() { return 1; }
/* Overloaded from P3Interface */
virtual int SearchSpecific(RsCacheRequest *item);
virtual int SendSearchResult(RsCacheItem *item);
virtual int SendFileRequest(RsFileRequest *item);
virtual int SendFileData(RsFileData *item);
virtual int SendRsRawItem(RsRawItem *item);
/* Overloaded from P3Interface */
virtual int SearchSpecific(RsCacheRequest *item);
virtual int SendSearchResult(RsCacheItem *item);
virtual int SendFileRequest(RsFileRequest *item);
virtual int SendFileData(RsFileData *item);
virtual int SendRsRawItem(RsRawItem *item);
virtual RsCacheRequest *RequestedSearch();
virtual RsCacheItem *GetSearchResult();
virtual RsFileRequest *GetFileRequest();
virtual RsFileData *GetFileData();
virtual RsRawItem *GetRsRawItem();
virtual RsCacheRequest *RequestedSearch();
virtual RsCacheItem *GetSearchResult();
virtual RsFileRequest *GetFileRequest();
virtual RsFileData *GetFileData();
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();
int PushRecvdItem(RsItem *item);
/* Lower Interface for PQIHub */
RsItem *PopSentItem();
int PushRecvdItem(RsItem *item);
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<RsCacheItem *> mRecvdRsCacheItems;
std::list<RsFileRequest *> mRecvdRsFileRequests;
std::list<RsFileData *> mRecvdRsFileDatas;
std::list<RsRawItem *> mRecvdRsRawItems;
std::list<RsCacheRequest *> mRecvdRsCacheRequests;
std::list<RsCacheItem *> mRecvdRsCacheItems;
std::list<RsFileRequest *> mRecvdRsFileRequests;
std::list<RsFileData *> mRecvdRsFileDatas;
std::list<RsRawItem *> mRecvdRsRawItems;
};