[+] FS devices test

[*] Updated Aurora Runtime, ROXTL, and fixed network test regression during refactor fixup
This commit is contained in:
Reece Wilson 2024-07-25 13:19:27 +01:00
parent 08473f7819
commit 22f5dbefd6
22 changed files with 154 additions and 75 deletions

@ -1 +1 @@
Subproject commit 9a8abc002383677ecf23848fefc32b1238dce349
Subproject commit fb1935fa915c280de61e06e953b09c8021543b41

@ -1 +1 @@
Subproject commit d717f605083ed1d0d28f54f6554930a74fdbd846
Subproject commit d2200907daf70d85c2033c384bd5a76ec008668e

@ -1 +1 @@
Subproject commit 3c6d5a020be96eb579f9b1edc51be17ca7dc2c48
Subproject commit ecf8dc6f0b997cdc2e89cafb7df69f91b3ee0c11

View File

@ -222,7 +222,7 @@ local processTests = function()
auForEach(experiments, function(experimentDirectory)
local testName = dirName(experimentDirectory)
auStartProject({name = testName, projectType = "ConsoleApp", src = experimentDirectory, inc = experimentDirectory, root = experimentDirectory})
auStartProject({name = testName, projectType = "ConsoleApp", src = experimentDirectory, inc = experimentDirectory, root = experimentDirectory, dest = "!"})
auLinkAndRefProject("AuroraRuntime")

@ -1 +1 @@
Subproject commit d7386a591a6acf78092ae7be17e9b3ec8e668f0d
Subproject commit d8544bc9662b946fce56fa10168be0b11f08148c

View File

@ -79,11 +79,11 @@ TEST(Process, RunSystemLoopSourceStdOut)
if (length)
{
AuLogDbg("STDOUT {}", AuString(stdoutPipe.begin(), stdoutPipe.begin() + length));
transaction->StartRead(0, AuUnsafeRaiiToShared(&readView)); // NOTE: removed assert bc the final read +1 may result in an instant nonblocking error under NT
transaction->StartRead(0, readView); // NOTE: removed assert bc the final read +1 may result in an instant nonblocking error under NT
}
}));
ASSERT_TRUE(transaction->StartRead(0, AuUnsafeRaiiToShared(&readView)));
ASSERT_TRUE(transaction->StartRead(0, readView));
auto loop = AuLoop::NewLoopQueue();

View File

@ -493,9 +493,9 @@ TEST(Adapters, Print)
AuNet::EIPProtocolToString(pAdapter->GetFamily()),
pAdapter->GetName(),
pAdapter->GetDevice(),
pAdapter->GetAddress().ToString(),
pAdapter->GetBroadcastAddress().ToString(),
pAdapter->GetGateway().ToString(),
pAdapter->GetAddress()->ToString(),
pAdapter->GetBroadcastAddress()->ToString(),
pAdapter->GetGateway()->ToString(),
dns);
}
}

View File

@ -114,6 +114,12 @@ TEST(DemoPanic, ASDASd)
//SysPanic("bye bye {}", 234);
}
TEST(DemoPanic, AA)
{
SysAssert(*(AuUInt32*)AuUInt(0x1FF) == 0x1337);
//SysPanic("bye bye {}", 234);
}
// tests/demos:
// TODO: function name demangling]
@ -123,5 +129,6 @@ void RunTests()
{
Aurora::RuntimeStartInfo info;
info.console.fio.bEnableLogging = false;
info.debug.bIsExceptionThrowFatal = true;
Aurora::RuntimeStart(info);
}

View File

@ -17,6 +17,18 @@
#include <shared_mutex>
static void DemoCopyNoProblem(AuFutexMutex mutex, AuFutexSemaphore semaphore)
{
}
static void Demo1()
{
AuFutexMutex mutex;
AuFutexSemaphore semaphore;
DemoCopyNoProblem(mutex, semaphore);
}
TEST(Allocationless, SOO)
{
{
@ -33,6 +45,7 @@ TEST(Allocationless, SOO)
{
AuCondMutex condMutex;
AuCond condVariable(AuUnsafeRaiiToShared(condMutex.AsPointer()));
AuFlexibleConditionVariable anyWaitableInterfaceCV;
AuMutex mutex;
AuBinarySemaphore event(false, true, false);
AuSemaphore semaphore;
@ -41,6 +54,12 @@ TEST(Allocationless, SOO)
AuRWRenterableLock rwLock2;
}
{
AuFutexSemaphore sema;
AuFutexCountdown countdown;
AuBarrier barrier(4);
}
#if defined(TO_PROVE_A_POINT) && defined(AURORA_ARCH_X64)
@ -348,6 +367,8 @@ TEST(Mutex, Benchmark)
}
/*
TODO: add updated 2024 values!
Windows 7, i9 9900k (Q4 2018) @ 5GHz under KVM (v5.16.16), modified OVMF/EDK II, and modified QEMU:
08:13:17 [Debug] | [Benchmark] Mutex Benchmark 1'000'000 took 10.23965ms
08:13:17 [Debug] | [Benchmark] Mutex 2 Benchmark 1'000'000 [no-new] took 8.14648ms
@ -951,10 +972,10 @@ TEST(Thread, GracefulExitNoFree)
ASSERT_TRUE(thread->Run());
// Set flag and sync/join under a watchdog
thread->Exit();
thread->Terminate();
// Has exited?
ASSERT_TRUE(thread->AsWaitable()->TryLock());
ASSERT_TRUE(thread->GetShutdownWaitable()->TryLock());
}
/**
@ -984,10 +1005,10 @@ TEST(Thread, ForcefulExitNoFree)
ASSERT_TRUE(thread->Run());
// Set flag and sync/join under a watchdog
thread->Exit();
thread->Terminate();
// Has exited?
ASSERT_TRUE(thread->AsWaitable()->TryLock());
ASSERT_TRUE(thread->GetShutdownWaitable()->TryLock());
}
// TODO: sample and test code for:

View File

@ -214,11 +214,11 @@ TEST(IPC, AsyncPipe)
AuRng::RngFillRange(writeBuffer);
AuMemoryViewRead writeView(writeBuffer);
ASSERT_TRUE(transactionA->StartWrite(0, AuUnsafeRaiiToShared(&writeView)));
ASSERT_TRUE(transactionA->StartWrite(0, writeView));
AuByteBuffer readBuffer(512);
AuMemoryViewWrite readView(readBuffer);
ASSERT_TRUE(transactionB->StartRead(0, AuUnsafeRaiiToShared(&readView)));
ASSERT_TRUE(transactionB->StartRead(0, readView));
// Create loop to sync against the two outstanding IO requests
auto loop = AuLoop::NewLoopQueue();

View File

@ -208,8 +208,8 @@ TEST(IO, WriteMassive200MBFileBenchmarkDisk)
//SysAssert(length == 200 * 1024 * 40);
}));
AuMemoryViewRead readView(rngbuffer);
ASSERT_TRUE(pTransaction->StartWrite(0, AuUnsafeRaiiToShared(&readView)));
AuMemoryViewRead readView(rngbuffer /*, my control block*/);
ASSERT_TRUE(pTransaction->StartWrite(0, readView));
AuLogDbg("AIO 1: waiting....");
ASSERT_TRUE(pTransaction->Wait(0));
@ -323,8 +323,8 @@ TEST(IO, ReadFileThroughpPipeProcessor2MBReadsEQ)
SysAssert(length == 512 * 1024 * 40);
}));
AuMemoryViewRead readView(rngbuffer);
ASSERT_TRUE(pTransaction->StartWrite(0, AuUnsafeRaiiToShared(&readView)));
AuMemoryViewRead readView(rngbuffer /*, my control block*/);
ASSERT_TRUE(pTransaction->StartWrite(0, readView));
AuLogDbg("AIO 1: waiting....");
ASSERT_TRUE(pTransaction->Wait(0));
@ -435,8 +435,8 @@ TEST(IO, ReadFileThroughpPipeProcessorDefaultConfigEQ)
AuLogDbg("AIO 1 callback: {} {}", offset, length);
}));
AuMemoryViewRead readView(rngbuffer);
ASSERT_TRUE(pTransaction->StartWrite(0, AuUnsafeRaiiToShared(&readView)));
AuMemoryViewRead readView(rngbuffer /*, my control block*/);
ASSERT_TRUE(pTransaction->StartWrite(0, readView));
AuLogDbg("AIO 1: waiting....");
ASSERT_TRUE(pTransaction->Wait(0));
@ -540,8 +540,8 @@ static void ReadFileThroughpPipeProcessorCongested(int i)
SysAssert(length == 512 * 1024 * 40);
}));
AuMemoryViewRead readView(rngbuffer);
ASSERT_TRUE(pTransaction->StartWrite(0, AuUnsafeRaiiToShared(&readView)));
AuMemoryViewRead readView(rngbuffer /*, my control block*/);
ASSERT_TRUE(pTransaction->StartWrite(0, readView));
AuLogDbg("AIO 1: waiting....");
ASSERT_TRUE(pTransaction->Wait(0));

View File

@ -7,6 +7,7 @@
***/
#include <AuroraRuntime.hpp>
#include <gtest/gtest.h>
#include <Aurora/IO/FS/Devices.hpp>
/*
Blocking read/write test
@ -47,7 +48,11 @@ TEST(FS, WriteRead)
AuByteBuffer inputblob;
AuRng::RngFillBuffer(rngbuffer);
#if 0
for (int i = 0; i < 1000; i++)
#else
for (int i = 0; i < 10; i++)
#endif
{
inputblob.writePtr = inputblob.readPtr = inputblob.base;
// Write and read back the RNG blob from a read/writable CWD
@ -247,8 +252,8 @@ TEST(FS, Async)
AuLogDbg("AIO 1 callback: {} {}", offset, length);
}));
AuMemoryViewRead readView(rngbuffer);
ASSERT_TRUE(transaction->StartWrite(0, AuUnsafeRaiiToShared(&readView)));
AuMemoryViewRead readView(rngbuffer /*, my parent shared control block*/);
ASSERT_TRUE(transaction->StartWrite(0, readView));
AuLogDbg("AIO 1: waiting....");
ASSERT_TRUE(transaction->Wait(0));
@ -273,8 +278,8 @@ TEST(FS, AsyncAltWait)
AuLogDbg("AIO 2 callback: {} {}", offset, length);
}));
AuMemoryViewRead readView(rngbuffer);
ASSERT_TRUE(transaction->StartWrite(0, AuUnsafeRaiiToShared(&readView)));
AuMemoryViewRead readView(rngbuffer /*, my parent shared control block*/);
ASSERT_TRUE(transaction->StartWrite(0, readView));
AuLogDbg("AIO 2: waiting....");
ASSERT_TRUE(transaction->NewLoopSource()->WaitOn());
@ -285,72 +290,72 @@ TEST(FS, AsyncAltWait)
static void PrintSystemRoot()
{
AuString path;
if (AuIOFS::GetAppData(path))
if (auto optPath = AuIOFS::GetAppData())
{
AuLogInfo("Found /platform/user app directory, {}", path);
AuLogInfo("Found /platform/user app directory, {}", optPath.Value());
}
else
{
AuLogInfo("Couldn't find /platform/user");
}
if (AuIOFS::GetWritableAppdata(path))
if (auto optPath = AuIOFS::GetWritableAppdata())
{
AuLogInfo("Found system extension application specific storage, {}", path);
AuLogInfo("Found system extension application specific storage, {}", optPath.Value());
}
else
{
AuLogInfo("Couldn't find system extension application specific storage");
}
if (AuIOFS::GetRootAppdata(path))
if (auto optPath = AuIOFS::GetRootAppdata())
{
AuLogInfo("Found privileged application specific storage, {}", path);
AuLogInfo("Found privileged application specific storage, {}", optPath.Value());
}
else
{
AuLogInfo("Couldn't find privileged application specific storage");
}
if (AuIOFS::GetPackagePath(path))
if (auto optPath = AuIOFS::GetPackagePath())
{
AuLogInfo("Found package directory, {}", path);
AuLogInfo("Found package directory, {}", optPath.Value());
}
else
{
AuLogInfo("Couldn't find package directory");
}
if (AuIOFS::GetProfileDomain(path))
if (auto optPath = AuIOFS::GetProfileDomain())
{
AuLogInfo("Found profile directory, {}", path);
AuLogInfo("Found profile directory, {}", optPath.Value());
}
else
{
AuLogInfo("Couldn't find profile directory");
}
if (AuIOFS::GetSystemDomain(path))
if (auto optPath = AuIOFS::GetSystemDomain())
{
AuLogInfo("Found system share directory, {}", path);
AuLogInfo("Found system share directory, {}", optPath.Value());
}
else
{
AuLogInfo("Couldn't find system share directory");
}
if (AuIOFS::GetUserHome(path))
if (auto optPath = AuIOFS::GetUserHome())
{
AuLogInfo("Found user home, {}", path);
AuLogInfo("Found user home, {}", optPath.Value());
}
else
{
AuLogInfo("Couldn't find user home directory");
}
if (AuIOFS::GetUserProgramsFolder(path))
if (auto optPath = AuIOFS::GetUserProgramsFolder())
{
AuLogInfo("Found users installable programs home, {}", path);
AuLogInfo("Found users installable programs home, {}", optPath.Value());
}
else
{
@ -368,7 +373,7 @@ TEST(FS, TestBlock)
if (AuCmdLine::HasValue("block"))
{
AuLogDbg("Blocking file...");
ASSERT_TRUE(AuFS::BlockFile(AuCmdLine::GetValue("block")));
ASSERT_TRUE(AuFS::BlockFile(AuCmdLine::GetValue("block").Value()));
}
}
@ -377,7 +382,7 @@ TEST(FS, TestUnblock)
if (AuCmdLine::HasValue("unblock"))
{
AuLogDbg("Unblocking file...");
ASSERT_TRUE(AuFS::UnblockFile(AuCmdLine::GetValue("unblock")));
ASSERT_TRUE(AuFS::UnblockFile(AuCmdLine::GetValue("unblock").Value()));
}
}
@ -386,7 +391,7 @@ TEST(FS, TestTrust)
if (AuCmdLine::HasValue("trust"))
{
AuLogDbg("Trusting file...");
ASSERT_TRUE(AuFS::TrustFile(AuCmdLine::GetValue("trust")));
ASSERT_TRUE(AuFS::TrustFile(AuCmdLine::GetValue("trust").Value()));
}
}
@ -396,7 +401,7 @@ TEST(FS, TestCompress)
if (AuCmdLine::HasValue("compress"))
{
AuLogDbg("Compressing file...");
ASSERT_TRUE(AuFS::Compress(AuCmdLine::GetValue("compress")));
ASSERT_TRUE(AuFS::Compress(AuCmdLine::GetValue("compress").Value()));
}
}
@ -405,7 +410,7 @@ TEST(FS, TestDecompress)
if (AuCmdLine::HasValue("decompress"))
{
AuLogDbg("Decompressing file...");
ASSERT_TRUE(AuFS::Decompress(AuCmdLine::GetValue("decompress")));
ASSERT_TRUE(AuFS::Decompress(AuCmdLine::GetValue("decompress").Value()));
}
}
@ -413,11 +418,60 @@ TEST(FS, TestListAttr)
{
if (AuCmdLine::HasValue("attrs"))
{
auto list = AuFS::FileAttrsList(AuCmdLine::GetValue("attrs"));
auto list = AuFS::FileAttrsList(AuCmdLine::GetValue("attrs").Value());
AuLogDbg("Found attrs: {}", list);
}
}
TEST(FS, ListDevices)
{
{
auto aStr = AuFS::GetLogicalMountFromPath(".");
auto bStr = AuFS::GetDeviceFromPath(".");
AuLogDbg("Current disk sector size: {}/{} on {} of {}",
AuFS::GetLogicalSectorSizeFromPath("."),
AuFS::GetPhysicalSectorSizeFromPath("."),
aStr ? aStr.value() : AuString {},
bStr ? bStr.value() : AuString {});
}
AuLogDbg("Root: {}", AuFS::GetRootFromPath("."));
{
auto devices = AuFS::GetFSDevices();
for (const auto &device : devices)
{
AuLogDbg("Device: {}, ", device.devicePath);
AuLogDbg("\t{}: {}", "UUID", device.uuid.to_string());
AuLogDbg("\t{}: {}", "Type", AuFS::EFSDeviceTypeToString(device.type));
AuLogDbg("\t{}: {}", "Bus", AuFS::EFSBusTypeToString(device.bus));
AuLogDbg("\t{}: {}", "Product", device.productModel);
AuLogDbg("\t{}: {}", "Label", device.altLabel ? device.altLabel.Value() : AuString {});
AuLogDbg("\t{}: {}", "Description", device.altProductDescription ? device.altProductDescription.Value() : AuString {});
AuLogDbg("\t{}: {}", "Size (MB)", device.uFSDeviceSizeInBytes / 1024ull / 1024ull);
for (const auto &partition : device.partitions)
{
AuLogDbg("\t\t{}: {}", "Name", partition.name ? partition.name.Value() : AuString {});
AuLogDbg("\t\t{}: {}", "UUID", partition.uuid.to_string());
AuLogDbg("\t\t{}: {}", "Dev Path", partition.devicePath);
AuLogDbg("\t\t{}: {}", "Mount Path", partition.logicalMount);
AuLogDbg("\t\t{}: {}", "Is readonly?", partition.bIsReadOnly);
AuLogDbg("\t\t{}: {}/{} MB", "Used ", partition.space.uLogicalUsed / 1024ull / 1024ull, partition.space.uLogicalSize / 1024ull / 1024ull);
AuLogDbg("\t\t{}: {},{} MB", "Logical Placement", partition.offset.uLogicalOffset / 1024ull / 1024ull, partition.offset.uLogicalSize / 1024ull / 1024ull);
AuLogDbg("\t\t{}: {}", "Mount Points", partition.filesystemMountPoints);
AuLogDbg("");
}
if (device.partitions.empty())
{
AuLogDbg("");
}
}
}
}
void RunTests()
{
Aurora::RuntimeStartInfo info;

View File

@ -32,7 +32,7 @@ static void TestPath(const AuString &handleString)
AuMemoryViewRead writeView(writeBuffer);
AuRng::RngFillRange(writeBuffer);
SysAssert(transactionB->StartWrite(0, AuUnsafeRaiiToShared(&writeView)));
SysAssert(transactionB->StartWrite(0, writeView));
// Create loop to sync against the outstanding IO requests
auto loop = AuLoop::NewLoopQueue();

View File

@ -124,6 +124,7 @@ TEST(Net, TLSGoogle)
static AuSPtr<AuNet::ISocket> gDriverSocket;
pRealDriver->OnPreestablishFunctional = [&](const AuSPtr<AuNet::ISocket> &socket) -> bool
{
AuLogDbg("pre established");
#define ENABLE_TLS
#if defined(ENABLE_TLS)
Aurora::IO::TLS::TLSMeta tlsMeta;
@ -141,6 +142,7 @@ TEST(Net, TLSGoogle)
pRealDriver->OnEstablishFunctional = [&]()
{
AuLogDbg("established");
auto pChannel = gDriverSocket->ToChannel();
pChannel->AsStreamWriter()->Write(AuMemoryViewRead("GET / HTTP/1.1\r\nConnection: close\r\nHost: www.bing.com\r\n\r\n", 57));
};

View File

@ -285,12 +285,14 @@ TEST(Net, DnsTLSGoogle)
AuNet::NetSocketConnect nsConnect;
AuNet::NetSocketConnectByHost byHost;
nsConnect.pDriver = pDriver;
nsConnect.byHost = byHost;
byHost.netHostname = AuNet::NetHostname("google.com");
byHost.uPort = 443;
byHost.protocol = AuNet::ETransportProtocol::eProtocolTCP;
nsConnect.pDriver = pDriver;
nsConnect.byHost = byHost;
auto pSocket = pNetProcessor->GetSocketService()->Connect(nsConnect);
ASSERT_TRUE(bool(pSocket));

View File

@ -36,22 +36,15 @@ TEST(UDP, DatagramServer)
{
AuLogDbg("[UDP] On packet");
struct Packet : AuMemoryViewRead
{
AuByteBuffer buffer;
};
auto pPacket = AuMakeSharedPanic<Packet>();
pPacket->buffer.Write<AuUInt32>(0xAAAABBBB);
pPacket->buffer.Write<AuUInt32>(0x13371337);
pPacket->buffer.Write("Hello World");
pPacket->buffer.Write<AuUInt32>(0xAAAABBBB);
pPacket->buffer.Write<AuUInt32>(0x13371337);
pPacket->buffer.WriteFrom(*pInboundPacket);
pPacket->ptr = pPacket->buffer.readPtr;
pPacket->length = pPacket->buffer.RemainingBytes();
SysAssert(!pPacket->buffer.flagWriteError);
pSocket->SendPacket(client, pPacket, {});
auto pPacket = AuMemory::NewSharableResizableBuffer();
pPacket->Write<AuUInt32>(0xAAAABBBB);
pPacket->Write<AuUInt32>(0x13371337);
pPacket->Write("Hello World");
pPacket->Write<AuUInt32>(0xAAAABBBB);
pPacket->Write<AuUInt32>(0x13371337);
pPacket->WriteFrom(*pInboundPacket);
SysAssert(!pPacket->flagWriteError);
pSocket->SendPacket(client, *pPacket, {});
};
pDriver->OnErrorFunctional = [](const AuNet::NetError &error)

@ -1 +1 @@
Subproject commit 9d43b27f7a873596496a2ea70721b3f9eb82df01
Subproject commit fa6de7f4382f5c8fb8b9e32eea28a2eb44966c32

2
Vendor/brotli vendored

@ -1 +1 @@
Subproject commit ccec9628e49208173c9a8829ff66d0d7f6ceff5f
Subproject commit d01a4caaa80c0072fe1b6bf073814b9400667fcc

2
Vendor/fmt vendored

@ -1 +1 @@
Subproject commit 09935d82390440cebf80ac427548049d79d29ff7
Subproject commit 57593a123be5a1fcb3e1fbcdd5e9e38779f8cede

2
Vendor/liblzma vendored

@ -1 +1 @@
Subproject commit d0797bfea81c0f46184905d8169b7aefd3e479b5
Subproject commit 165c4e97a6f8693edf665b42151d627d03ade6b6

2
Vendor/nlohmannjson vendored

@ -1 +1 @@
Subproject commit 0457de21cffb298c22b629e538036bfeb96130b7
Subproject commit 8c391e04fe4195d8be862c97f38cfe10e2a3472e

2
Vendor/zstd vendored

@ -1 +1 @@
Subproject commit db5a7cf8ed516f1b454e2ae121f0271d55f5beb8
Subproject commit a7b124025fc5d0d2338f9826ecda95005a698a7d