Merge pull request #195 from michael-loki/fix_utp_tests

Fix UTPTest test failures
This commit is contained in:
Jeff 2019-01-03 17:06:51 -05:00 committed by GitHub
commit a4751224d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 12 deletions

View File

@ -116,7 +116,7 @@ if(NOT DEBIAN)
endif(NOT DEBIAN) endif(NOT DEBIAN)
if(ASAN) if(ASAN)
set(DEBUG_FLAGS ${DEBUG_FLAGS} -fsanitize=address -fno-omit-frame-pointer) set(DEBUG_FLAGS ${DEBUG_FLAGS} -fsanitize=thread -fno-omit-frame-pointer)
set(OPTIMIZE_FLAGS "-O0") set(OPTIMIZE_FLAGS "-O0")
endif(ASAN) endif(ASAN)

View File

@ -55,7 +55,7 @@ namespace llarp
} }
uint32_t uint32_t
Logic::call_later(struct llarp_timeout_job job) Logic::call_later(const llarp_timeout_job& job)
{ {
llarp_timeout_job j; llarp_timeout_job j;
j.user = job.user; j.user = job.user;

View File

@ -44,7 +44,7 @@ namespace llarp
queue_job(struct llarp_thread_job job); queue_job(struct llarp_thread_job job);
uint32_t uint32_t
call_later(struct llarp_timeout_job job); call_later(const llarp_timeout_job& job);
void void
cancel_call(uint32_t id); cancel_call(uint32_t id);

View File

@ -102,30 +102,25 @@ struct UTPTest : public ::testing::Test
bool success = false; bool success = false;
llarp_ev_loop* netLoop; llarp_ev_loop* netLoop;
std::unique_ptr< llarp::Logic > logic;
llarp_time_t oldRCLifetime; llarp_time_t oldRCLifetime;
std::unique_ptr< llarp::Logic > logic;
UTPTest() UTPTest()
: crypto(llarp::Crypto::sodium{}) : crypto(llarp::Crypto::sodium{})
, Alice(crypto) , Alice(crypto)
, Bob(crypto) , Bob(crypto)
, netLoop(nullptr) , netLoop(nullptr)
, oldRCLifetime(llarp::RouterContact::Lifetime)
{ {
}
void
SetUp()
{
oldRCLifetime = llarp::RouterContact::Lifetime;
llarp::RouterContact::IgnoreBogons = true; llarp::RouterContact::IgnoreBogons = true;
llarp::RouterContact::Lifetime = 500; llarp::RouterContact::Lifetime = 500;
llarp_ev_loop_alloc(&netLoop); llarp_ev_loop_alloc(&netLoop);
logic.reset(new llarp::Logic()); logic.reset(new llarp::Logic());
} }
void ~UTPTest()
TearDown()
{ {
Alice.TearDown(); Alice.TearDown();
Bob.TearDown(); Bob.TearDown();