[+] 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

@ -12,12 +12,12 @@
Blocking read/write test
Test 1)
Input parameters: 1k cycles, 32B RNG
Input parameters: 1k cycles, 32B RNG
With 4k ops and 1600ms average
~= 0.4ms per blocking read/write
Test 2)
Input parameters: 1k cycles, 64KiB RNG
Input parameters: 1k cycles, 64KiB RNG
Result: FS.WriteRead (9248 ms)
> 9248 / 4 (ops)
@ -29,10 +29,17 @@ Test 2)
> 27 * 1000 (kB / s)
27000
> 27000 / 1024 (mB / s)
26.3671875
26.3671875
26 MB/s or 208Mb/s
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)
{
@ -65,7 +72,7 @@ TEST(FS, WriteCopyRead)
AuIOFS::Remove("./test_rng_blob_2");
ASSERT_TRUE(AuIOFS::Copy("./test_rng_blob_1", "./test_rng_blob_2"));
ASSERT_TRUE(AuIOFS::ReadFile("./test_rng_blob_2", inputblob));
ASSERT_EQ(inputblob, rngbuffer);
}
@ -103,24 +110,85 @@ TEST(FS, Watcher)
auto watcher = AuIOFS::NewWatcherUnique();
ASSERT_TRUE(watcher);
AuIOFS::WatchedFile file;
file.path = "~/Watcher.txt";
ASSERT_TRUE(watcher->AddWatch(file));
AuIOFS::WatchRequest request;
request.watch.path = "~/Watcher.txt";
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_TRUE(AuIOFS::WriteString("~/Watcher.txt", "testing2"));
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_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(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_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()
{
AuString path;

View File

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

View File

@ -12,7 +12,7 @@ static void PrintLocale()
{
auto locale = AuLocale::GetLocale();
AuLogInfo("Localization information...");
AuLogInfo("language: {}, country : {}, codeset : {})", locale.language, locale.country, locale.codeset);
AuLogInfo("language: {}, country: {}, codeset: {})", locale.language, locale.country, locale.codeset);
}
TEST(TranslateEncoding, utf16to8)

2
Vendor/nlohmannjson vendored

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