[+] Added LSTimer tests
[*] Added timeout in IPC bc a comment says 500ms
This commit is contained in:
parent
85df64a76c
commit
15d2e6ec3c
@ -1 +1 @@
|
||||
Subproject commit b424a3b434c000b4235706b1165d54966c9d44b8
|
||||
Subproject commit 7dca8ecd29def1f1921da6fad5bb34f4a50f00a0
|
@ -228,7 +228,7 @@ TEST(IPC, AsyncPipe)
|
||||
ASSERT_TRUE(loop->Commit());
|
||||
|
||||
// Wait for 100 MS
|
||||
ASSERT_TRUE(loop->WaitAll(0));
|
||||
ASSERT_TRUE(loop->WaitAll(100));
|
||||
|
||||
ASSERT_EQ(writeBuffer, readBuffer);
|
||||
|
||||
|
@ -10,10 +10,10 @@
|
||||
|
||||
TEST(Loop, Semaphore)
|
||||
{
|
||||
auto semaA = Aurora::Loop::NewLSSemaphore(1);
|
||||
auto semaB = Aurora::Loop::NewLSSemaphore(0);
|
||||
auto semac = Aurora::Loop::NewLSSemaphore(0);
|
||||
auto loop = Aurora::Loop::NewLoopQueue();
|
||||
auto semaA = AuLoop::NewLSSemaphore(1);
|
||||
auto semaB = AuLoop::NewLSSemaphore(0);
|
||||
auto semac = AuLoop::NewLSSemaphore(0);
|
||||
auto loop = AuLoop::NewLoopQueue();
|
||||
|
||||
// Add initial loop sources
|
||||
ASSERT_TRUE(loop->SourceAdd(semaA));
|
||||
@ -21,26 +21,26 @@ TEST(Loop, Semaphore)
|
||||
ASSERT_TRUE(loop->SourceAddWithTimeout(semac, 2000));
|
||||
|
||||
|
||||
auto semACallback = AuMakeShared<Aurora::Loop::ILoopSourceSubscriberFunctional>([](const AuSPtr<Aurora::Loop::ILoopSource> &source) -> bool
|
||||
auto semACallback = AuMakeShared<Aurora::Loop::ILoopSourceSubscriberFunctional>([](const AuSPtr<AuLoop::ILoopSource> &source) -> bool
|
||||
{
|
||||
AuLogInfo("Hello from semaphore a's work queue");
|
||||
return false; // dont evict, we'll reuse this *1 (search for me)
|
||||
});
|
||||
|
||||
auto semBCallback = AuMakeShared<Aurora::Loop::ILoopSourceSubscriberFunctional>([](const AuSPtr<Aurora::Loop::ILoopSource> &source) -> bool
|
||||
auto semBCallback = AuMakeShared<Aurora::Loop::ILoopSourceSubscriberFunctional>([](const AuSPtr<AuLoop::ILoopSource> &source) -> bool
|
||||
{
|
||||
AuLogInfo("Hello from semaphore b's work queue");
|
||||
return true; // evict
|
||||
});
|
||||
|
||||
|
||||
auto semCCallback = AuMakeShared<Aurora::Loop::ILoopSourceSubscriberExFunctional>([](const AuSPtr<Aurora::Loop::ILoopSource> &source, AuUInt8 pos) -> bool
|
||||
auto semCCallback = AuMakeShared<Aurora::Loop::ILoopSourceSubscriberExFunctional>([](const AuSPtr<AuLoop::ILoopSource> &source, AuUInt8 pos) -> bool
|
||||
{
|
||||
AuLogInfo("This should not have been triggered from C");
|
||||
return false;
|
||||
},
|
||||
|
||||
[](const AuSPtr<Aurora::Loop::ILoopSource> &source) -> void
|
||||
[](const AuSPtr<AuLoop::ILoopSource> &source) -> void
|
||||
{
|
||||
AuLogInfo("C timedout succesfully!");
|
||||
});
|
||||
@ -85,6 +85,76 @@ TEST(Loop, Semaphore)
|
||||
ASSERT_TRUE(loop->WaitAll(100));
|
||||
}
|
||||
|
||||
TEST(Loop, Timer0)
|
||||
{
|
||||
SysBenchmark("Hello?");
|
||||
auto timer = AuLoop::NewLSTimer(AuTime::CurrentClockMS() + 100, 100, 2);
|
||||
|
||||
// Create loop to sync against the two outstanding IO requests
|
||||
auto loop = AuLoop::NewLoopQueue();
|
||||
|
||||
// Add initial loop sources
|
||||
ASSERT_TRUE(loop->SourceAdd(timer));
|
||||
ASSERT_TRUE(loop->Commit());
|
||||
|
||||
}
|
||||
|
||||
TEST(Loop, Timer)
|
||||
{
|
||||
auto timer = AuLoop::NewLSTimer(AuTime::CurrentClockMS() + 500);
|
||||
|
||||
// Create loop to sync against the two outstanding IO requests
|
||||
auto loop = AuLoop::NewLoopQueue();
|
||||
|
||||
// Add initial loop sources
|
||||
ASSERT_TRUE(loop->SourceAdd(timer));
|
||||
ASSERT_TRUE(loop->Commit());
|
||||
|
||||
//
|
||||
ASSERT_FALSE(loop->WaitAll(50));
|
||||
ASSERT_TRUE(loop->WaitAll(550));
|
||||
}
|
||||
|
||||
TEST(Loop, Timer2)
|
||||
{
|
||||
auto timer = AuLoop::NewLSTimer(AuTime::CurrentClockMS() + 100, 100, 2);
|
||||
|
||||
// Create loop to sync against the two outstanding IO requests
|
||||
auto loop = AuLoop::NewLoopQueue();
|
||||
|
||||
// Add initial loop sources
|
||||
ASSERT_TRUE(loop->SourceAdd(timer));
|
||||
ASSERT_TRUE(loop->Commit());
|
||||
|
||||
// Test for incremental ticks
|
||||
ASSERT_FALSE(loop->WaitAll(5));
|
||||
ASSERT_TRUE(loop->WaitAll(100));
|
||||
ASSERT_FALSE(loop->WaitAll(5));
|
||||
ASSERT_TRUE(loop->WaitAll(100));
|
||||
ASSERT_FALSE(loop->WaitAll(5));
|
||||
ASSERT_FALSE(loop->WaitAll(100));
|
||||
}
|
||||
|
||||
TEST(Loop, Timer3)
|
||||
{
|
||||
auto timer = AuLoop::NewLSTimer(AuTime::CurrentClockMS() + 100, 100, 2);
|
||||
|
||||
// Create loop to sync against the two outstanding IO requests
|
||||
auto loop = AuLoop::NewLoopQueue();
|
||||
|
||||
// Add initial loop sources
|
||||
ASSERT_TRUE(loop->SourceAdd(timer));
|
||||
ASSERT_TRUE(loop->Commit());
|
||||
|
||||
// Test for incremental ticks
|
||||
ASSERT_FALSE(loop->WaitAny(5));
|
||||
ASSERT_TRUE(loop->WaitAny(100));
|
||||
ASSERT_FALSE(loop->WaitAny(5));
|
||||
ASSERT_TRUE(loop->WaitAny(100));
|
||||
ASSERT_FALSE(loop->WaitAny(5));
|
||||
ASSERT_FALSE(loop->WaitAny(100));
|
||||
}
|
||||
|
||||
#if 0
|
||||
TEST(Loop, Performance)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user