[+] Add extended file watcher tests (with whole directory test)

[+] Updated AuLoop IsSignaled API // Temp disabling benchmark
[+] Added some linux benchmark figures
[*] Update submodules
[+] Linux NoToolKit script
This commit is contained in:
Reece Wilson 2022-04-11 20:14:39 +01:00
parent c54cf7f329
commit 2637035e5e
9 changed files with 93 additions and 18 deletions

@ -1 +1 @@
Subproject commit 4fa7f61b8f57e1c55b69661f75356beeb289f63c Subproject commit 32fa7e6e2ce9d755dfe8aec7b41671f4a5153434

@ -1 +1 @@
Subproject commit 603c68f3cac297fa2a32c2209f4f327e7fa3de94 Subproject commit 2de033a575a3f151fbab7a776f6339d7b15272b6

@ -1 +1 @@
Subproject commit e3dd28450807c05c7e5c2a878d8506c839b4857e Subproject commit a4e296c86744973cf5212e094d8e7d8b88195f00

@ -1 +1 @@
Subproject commit 07b229a4bbe3d92b0ca6697732eca10b46c2b1e0 Subproject commit f30d2db9a2185043ec847b1e566c00dc44c1a24c

5
Linux_x64_NoToolkit Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
cd Build_Scripts
./linux_x64 "$@"
cd ..

View File

@ -33,6 +33,13 @@ Test 2)
26 MB/s or 208Mb/s 26 MB/s or 208Mb/s
29/03/2022 (under vm vdisk and with nt caching) 29/03/2022 (under vm vdisk and with nt caching)
Test 3)
Input parameters: 1k cycles, 32B RNG
With 4k ops and 64ms average
~= 0.016ms per blocking read/write
10/04/2022 (linux)
*/ */
TEST(FS, WriteRead) TEST(FS, WriteRead)
{ {
@ -103,24 +110,85 @@ TEST(FS, Watcher)
auto watcher = AuIOFS::NewWatcherUnique(); auto watcher = AuIOFS::NewWatcherUnique();
ASSERT_TRUE(watcher); ASSERT_TRUE(watcher);
AuIOFS::WatchedFile file; AuIOFS::WatchRequest request;
file.path = "~/Watcher.txt"; request.watch.path = "~/Watcher.txt";
ASSERT_TRUE(watcher->AddWatch(file)); ASSERT_TRUE(AuListFromArgs(request.events,
AuIOFS::EWatchEvent::eSelfModify,
AuIOFS::EWatchEvent::eSelfDelete,
AuIOFS::EWatchEvent::eFileDelete,
AuIOFS::EWatchEvent::eFileModify,
AuIOFS::EWatchEvent::eFileCreate));
ASSERT_TRUE(watcher->AddWatch(request));
ASSERT_FALSE(watcher->AsLoopSource()->IsSignaled()); ASSERT_FALSE(watcher->AsLoopSource()->IsSignaled());
ASSERT_TRUE(AuIOFS::WriteString("~/Watcher.txt", "testing2")); ASSERT_TRUE(AuIOFS::WriteString("~/Watcher.txt", "testing2"));
ASSERT_TRUE(watcher->AsLoopSource()->IsSignaled()); ASSERT_TRUE(watcher->AsLoopSource()->IsSignaled());
ASSERT_TRUE(watcher->AsLoopSource()->IsSignaled()); ASSERT_TRUE(watcher->AsLoopSource()->IsSignaled());
ASSERT_TRUE(watcher->QueryUpdates().size());
auto updates = watcher->QueryUpdates();
ASSERT_FALSE(watcher->AsLoopSource()->IsSignaled()); ASSERT_FALSE(watcher->AsLoopSource()->IsSignaled());
ASSERT_TRUE(updates.size());
AuLogDbg("First pass updates: {}", updates.size());
for (const auto &update : updates)
{
AuLogDbg(" {}: {}", AuIOFS::EWatchEventToString(update.event), update.file);
}
ASSERT_TRUE(AuIOFS::WriteString("~/Watcher.txt", "testing2")); ASSERT_TRUE(AuIOFS::WriteString("~/Watcher.txt", "testing2"));
ASSERT_TRUE(watcher->AsLoopSource()->IsSignaled());
ASSERT_TRUE(watcher->QueryUpdates().size()); updates = watcher->QueryUpdates();
ASSERT_TRUE(updates.size());
AuLogDbg("Second pass updates: {}", updates.size());
for (const auto &update : updates)
{
AuLogDbg(" {}: {}", AuIOFS::EWatchEventToString(update.event), update.file);
}
ASSERT_TRUE(AuIOFS::WriteString("~/Watcher2.txt", "testing2")); ASSERT_TRUE(AuIOFS::WriteString("~/Watcher2.txt", "testing2"));
ASSERT_FALSE(watcher->AsLoopSource()->IsSignaled()); ASSERT_FALSE(watcher->AsLoopSource()->IsSignaled());
// Test for basic file mk and rm
AuIOFS::DirMk("~/WatcherDir");
request.watch.path = "~/WatcherDir";
ASSERT_TRUE(watcher->AddWatch(request));
// I don't know?
updates = watcher->QueryUpdates();
AuLogDbg("Hello World?: {}", updates.size());
for (const auto &update : updates)
{
AuLogDbg(" {}: {} {}", AuIOFS::EWatchEventToString(update.event), update.file, update.watch.path);
} }
// ..
ASSERT_TRUE(AuIOFS::WriteString("~/WatcherDir/Poke.TXT", "...?"));
updates = watcher->QueryUpdates();
ASSERT_TRUE(updates.size());
AuLogDbg("Created a file called 'Poke.TXT': {}", updates.size());
for (const auto &update : updates)
{
AuLogDbg(" {}: {} {}", AuIOFS::EWatchEventToString(update.event), update.file, update.watch.path);
}
AuIOFS::Remove("~/WatcherDir/Poke.TXT");
updates = watcher->QueryUpdates();
ASSERT_TRUE(updates.size());
AuLogDbg("Removed a file called 'Poke.TXT': {}", updates.size());
for (const auto &update : updates)
{
AuLogDbg(" {}: {} {}", AuIOFS::EWatchEventToString(update.event), update.file, update.watch.path);
}
}
static void PrintSystemRoot() static void PrintSystemRoot()
{ {
AuString path; AuString path;

View File

@ -55,7 +55,8 @@ TEST(Loop, Semaphore)
ASSERT_TRUE(loop->Commit()); ASSERT_TRUE(loop->Commit());
// Dispatch any (IE: semaphore A) non-blocking // Dispatch any (IE: semaphore A) non-blocking
ASSERT_TRUE(loop->IsSignaled()); ASSERT_TRUE(loop->IsSignaledPeek());
ASSERT_TRUE(loop->WaitAny(0));
// Reuse semaphore A // Reuse semaphore A
semaA->AddOne(); // *1 semaA->AddOne(); // *1
@ -84,7 +85,7 @@ TEST(Loop, Semaphore)
ASSERT_TRUE(loop->WaitAll(100)); ASSERT_TRUE(loop->WaitAll(100));
} }
#if 0
TEST(Loop, Performance) TEST(Loop, Performance)
{ {
SysBenchmark("Loop Performance A"); SysBenchmark("Loop Performance A");
@ -218,6 +219,7 @@ TEST(Loop, Performance)
semaA->AddOne(); // account for initial starting count of 1 semaA->AddOne(); // account for initial starting count of 1
} }
} }
#endif
void RunTests() void RunTests()
{ {

2
Vendor/nlohmannjson vendored

@ -1 +1 @@
Subproject commit 66f6b4b6a0b897e91f7fdd5f6058a8c62137895f Subproject commit 3b16057ffaaed250cf207233f9238392ea0245ee