added test for extaddr finder

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3209 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2010-06-25 20:16:55 +00:00
parent 825ba0af79
commit ec493a5e8b
2 changed files with 41 additions and 1 deletions

View File

@ -9,9 +9,10 @@ include $(RS_TOP_DIR)/tests/scripts/config.mk
TESTOBJ = net_test.o dht_test.o net_test1.o netiface_test.o dht_test.o TESTOBJ = net_test.o dht_test.o net_test1.o netiface_test.o dht_test.o
TESTOBJ += pkt_test.o testconnect.o pqiarchive_test.o pqiperson_test.o TESTOBJ += pkt_test.o testconnect.o pqiarchive_test.o pqiperson_test.o
TESTOBJ += extaddrfinder_test.o
#conn_test.o #conn_test.o
TESTS = net_test net_test1 netiface_test pqiarchive_test pqiperson_test TESTS = net_test net_test1 netiface_test pqiarchive_test pqiperson_test extaddrfinder_test
MANUAL_TESTS = dht_test MANUAL_TESTS = dht_test
#conn_test #conn_test
@ -45,6 +46,8 @@ pqiarchive_test: pqiarchive_test.o pkt_test.o
pqiperson_test: pqiperson_test.o testconnect.o pqiperson_test: pqiperson_test.o testconnect.o
$(CC) $(CFLAGS) -o pqiperson_test pqiperson_test.o testconnect.o $(LIBS) $(CC) $(CFLAGS) -o pqiperson_test pqiperson_test.o testconnect.o $(LIBS)
extaddrfinder_test: extaddrfinder_test.o
$(CC) $(CFLAGS) -o extaddrfinder_test extaddrfinder_test.o $(LIBS)
clobber: remove_extra_files clobber: remove_extra_files

View File

@ -0,0 +1,37 @@
#include "util/utest.h"
#include <iostream>
#include "pqi/pqinetwork.h"
#include <tcponudp/extaddrfinder.h>
#include <pqi/authgpg.h>
INITTEST();
int main()
{
std::cerr << "Testing the ext address finder service. This might take up to 10 secs..." << std::endl ;
ExtAddrFinder fnd ;
in_addr addr ;
uint32_t tries = 0 ;
while(! fnd.hasValidIP( &addr ))
{
sleep(1) ;
if(++tries > 20)
{
std::cerr << "Failed !" << std::endl ;
CHECK(false) ;
}
}
std::cerr << "Found the following IP: " << inet_ntoa(addr) << std::endl ;
FINALREPORT("extaddrfinder_test");
return TESTRESULT() ;
}