[*] Update AuProcess [test] for IO handle update

This commit is contained in:
Reece Wilson 2023-07-29 10:51:23 +01:00
parent 8fa8fff482
commit 138aa9a8a5
3 changed files with 14 additions and 14 deletions

@ -1 +1 @@
Subproject commit 247e702712c7d6851d77e04fc14ab17cbd12e41c Subproject commit 3ff5d8a74e97d0c13e85132b43a1665fd13eb8ff

View File

@ -209,9 +209,9 @@ TEST(IPC, AsyncPipe)
// //
AuByteBuffer writeBuffer(512); AuByteBuffer writeBuffer(512);
AuMemoryViewRead writeView(writeBuffer);
AuRng::RngFillRange(writeBuffer); AuRng::RngFillRange(writeBuffer);
AuMemoryViewRead writeView(writeBuffer);
ASSERT_TRUE(transactionA->StartWrite(0, AuUnsafeRaiiToShared(&writeView))); ASSERT_TRUE(transactionA->StartWrite(0, AuUnsafeRaiiToShared(&writeView)));
AuByteBuffer readBuffer(512); AuByteBuffer readBuffer(512);

View File

@ -30,7 +30,7 @@ TEST(Map, FSNoLock)
auto pStream = AuProcess::GetGlobalProcessSpace(); auto pStream = AuProcess::GetGlobalProcessSpace();
ASSERT_TRUE(bool(pStream)); ASSERT_TRUE(bool(pStream));
auto obj = pStream->MapFileByObject(fsMap, 0, size, AuIOFS::EFileOpenMode::eRead, AuFS::EFileAdvisoryLockLevel::eBlockWrite); auto obj = pStream->MapFileByObject(fsMap->GetHandle(), 0, size, AuIOFS::EFileOpenMode::eRead, AuFS::EFileAdvisoryLockLevel::eBlockWrite);
ASSERT_TRUE(bool(obj)); ASSERT_TRUE(bool(obj));
ASSERT_TRUE(AuMemcmp(obj->GetBasePointer(), rngbuffer.base, size) == 0); ASSERT_TRUE(AuMemcmp(obj->GetBasePointer(), rngbuffer.base, size) == 0);
@ -58,7 +58,7 @@ TEST(Map, FSNestedReadLock)
auto pStream = AuProcess::GetGlobalProcessSpace(); auto pStream = AuProcess::GetGlobalProcessSpace();
ASSERT_TRUE(bool(pStream)); ASSERT_TRUE(bool(pStream));
auto obj = pStream->MapFileByObject(fsMap, 0, size, AuIOFS::EFileOpenMode::eRead, AuFS::EFileAdvisoryLockLevel::eBlockWrite); auto obj = pStream->MapFileByObject(fsMap->GetHandle(), 0, size, AuIOFS::EFileOpenMode::eRead, AuFS::EFileAdvisoryLockLevel::eBlockWrite);
ASSERT_TRUE(bool(obj)); ASSERT_TRUE(bool(obj));
ASSERT_TRUE(AuMemcmp(obj->GetBasePointer(), rngbuffer.base, size) == 0); ASSERT_TRUE(AuMemcmp(obj->GetBasePointer(), rngbuffer.base, size) == 0);
@ -86,7 +86,7 @@ TEST(Map, FSNestedReadLock2)
auto pStream = AuProcess::GetGlobalProcessSpace(); auto pStream = AuProcess::GetGlobalProcessSpace();
ASSERT_TRUE(bool(pStream)); ASSERT_TRUE(bool(pStream));
auto obj = pStream->MapFileByObject(fsMap, 0, size, AuIOFS::EFileOpenMode::eRead, AuFS::EFileAdvisoryLockLevel::eBlockWrite); auto obj = pStream->MapFileByObject(fsMap->GetHandle(), 0, size, AuIOFS::EFileOpenMode::eRead, AuFS::EFileAdvisoryLockLevel::eBlockWrite);
ASSERT_TRUE(bool(obj)); ASSERT_TRUE(bool(obj));
ASSERT_TRUE(AuMemcmp(obj->GetBasePointer(), rngbuffer.base, size) == 0); ASSERT_TRUE(AuMemcmp(obj->GetBasePointer(), rngbuffer.base, size) == 0);
@ -114,7 +114,7 @@ TEST(Map, FSNestedReadLockFail1)
auto pStream = AuProcess::GetGlobalProcessSpace(); auto pStream = AuProcess::GetGlobalProcessSpace();
ASSERT_TRUE(bool(pStream)); ASSERT_TRUE(bool(pStream));
auto obj = pStream->MapFileByObject(fsMap, 0, size, AuIOFS::EFileOpenMode::eWrite, AuFS::EFileAdvisoryLockLevel::eBlockWrite); auto obj = pStream->MapFileByObject(fsMap->GetHandle(), 0, size, AuIOFS::EFileOpenMode::eWrite, AuFS::EFileAdvisoryLockLevel::eBlockWrite);
ASSERT_TRUE(!bool(obj)); ASSERT_TRUE(!bool(obj));
} }
} }
@ -180,12 +180,12 @@ TEST(Reserve, TestMap2SubSections)
auto pStream = AuProcess::ReserveAddressSpace(size * 2); auto pStream = AuProcess::ReserveAddressSpace(size * 2);
ASSERT_TRUE(bool(pStream)); ASSERT_TRUE(bool(pStream));
auto obj = pStream->MapFileByObjectEx(0, fsMap, 0, size, AuIOFS::EFileOpenMode::eRead, AuFS::EFileAdvisoryLockLevel::eBlockWrite); auto obj = pStream->MapFileByObjectEx(0, fsMap->GetHandle(), 0, size, AuIOFS::EFileOpenMode::eRead, AuFS::EFileAdvisoryLockLevel::eBlockWrite);
ASSERT_TRUE(bool(obj)); ASSERT_TRUE(bool(obj));
ASSERT_TRUE(AuMemcmp(obj->GetBasePointer(), rngbuffer.base, size) == 0); ASSERT_TRUE(AuMemcmp(obj->GetBasePointer(), rngbuffer.base, size) == 0);
auto obj2 = pStream->MapFileByObjectEx(size, fsMap, 0, size, AuIOFS::EFileOpenMode::eRead, AuFS::EFileAdvisoryLockLevel::eBlockWrite); auto obj2 = pStream->MapFileByObjectEx(size, fsMap->GetHandle(), 0, size, AuIOFS::EFileOpenMode::eRead, AuFS::EFileAdvisoryLockLevel::eBlockWrite);
ASSERT_TRUE(bool(obj2)); ASSERT_TRUE(bool(obj2));
ASSERT_TRUE(AuMemcmp(obj2->GetBasePointer(), rngbuffer.base, size) == 0); ASSERT_TRUE(AuMemcmp(obj2->GetBasePointer(), rngbuffer.base, size) == 0);
@ -228,12 +228,12 @@ TEST(Reserve, TestReMap2SubSections)
auto pStream = AuProcess::ReserveAddressSpace(size * 2); auto pStream = AuProcess::ReserveAddressSpace(size * 2);
ASSERT_TRUE(bool(pStream)); ASSERT_TRUE(bool(pStream));
auto obj = pStream->MapFileByObjectEx(0, fsMap, 0, size, AuIOFS::EFileOpenMode::eRead, AuFS::EFileAdvisoryLockLevel::eBlockWrite); auto obj = pStream->MapFileByObjectEx(0, fsMap->GetHandle(), 0, size, AuIOFS::EFileOpenMode::eRead, AuFS::EFileAdvisoryLockLevel::eBlockWrite);
ASSERT_TRUE(bool(obj)); ASSERT_TRUE(bool(obj));
ASSERT_TRUE(AuMemcmp(obj->GetBasePointer(), rngbuffer.base, size) == 0); ASSERT_TRUE(AuMemcmp(obj->GetBasePointer(), rngbuffer.base, size) == 0);
auto obj2 = pStream->MapFileByObjectEx(size, fsMap, 0, size, AuIOFS::EFileOpenMode::eRead, AuFS::EFileAdvisoryLockLevel::eBlockWrite); auto obj2 = pStream->MapFileByObjectEx(size, fsMap->GetHandle(), 0, size, AuIOFS::EFileOpenMode::eRead, AuFS::EFileAdvisoryLockLevel::eBlockWrite);
ASSERT_TRUE(bool(obj2)); ASSERT_TRUE(bool(obj2));
ASSERT_TRUE(AuMemcmp(obj2->GetBasePointer(), rngbuffer.base, size) == 0); ASSERT_TRUE(AuMemcmp(obj2->GetBasePointer(), rngbuffer.base, size) == 0);
@ -242,7 +242,7 @@ TEST(Reserve, TestReMap2SubSections)
obj->Unmap(); obj->Unmap();
auto obj3 = pStream->MapFileByObjectEx(0, fsMap2, 0, size, AuIOFS::EFileOpenMode::eRead, AuFS::EFileAdvisoryLockLevel::eBlockWrite); auto obj3 = pStream->MapFileByObjectEx(0, fsMap2->GetHandle(), 0, size, AuIOFS::EFileOpenMode::eRead, AuFS::EFileAdvisoryLockLevel::eBlockWrite);
ASSERT_TRUE(bool(obj3)); ASSERT_TRUE(bool(obj3));
ASSERT_TRUE(AuMemcmp(obj3->GetBasePointer(), rngbuffer2.base, size) == 0); ASSERT_TRUE(AuMemcmp(obj3->GetBasePointer(), rngbuffer2.base, size) == 0);
@ -283,19 +283,19 @@ TEST(Reserve, TestReMap2SubSections_Fail)
auto pStream = AuProcess::ReserveAddressSpace(size * 2); auto pStream = AuProcess::ReserveAddressSpace(size * 2);
ASSERT_TRUE(bool(pStream)); ASSERT_TRUE(bool(pStream));
auto obj = pStream->MapFileByObjectEx(0, fsMap, 0, size, AuIOFS::EFileOpenMode::eRead, AuFS::EFileAdvisoryLockLevel::eBlockWrite); auto obj = pStream->MapFileByObjectEx(0, fsMap->GetHandle(), 0, size, AuIOFS::EFileOpenMode::eRead, AuFS::EFileAdvisoryLockLevel::eBlockWrite);
ASSERT_TRUE(bool(obj)); ASSERT_TRUE(bool(obj));
ASSERT_TRUE(AuMemcmp(obj->GetBasePointer(), rngbuffer.base, size) == 0); ASSERT_TRUE(AuMemcmp(obj->GetBasePointer(), rngbuffer.base, size) == 0);
auto obj2 = pStream->MapFileByObjectEx(size, fsMap, 0, size, AuIOFS::EFileOpenMode::eRead, AuFS::EFileAdvisoryLockLevel::eBlockWrite); auto obj2 = pStream->MapFileByObjectEx(size, fsMap->GetHandle(), 0, size, AuIOFS::EFileOpenMode::eRead, AuFS::EFileAdvisoryLockLevel::eBlockWrite);
ASSERT_TRUE(bool(obj2)); ASSERT_TRUE(bool(obj2));
ASSERT_TRUE(AuMemcmp(obj2->GetBasePointer(), rngbuffer.base, size) == 0); ASSERT_TRUE(AuMemcmp(obj2->GetBasePointer(), rngbuffer.base, size) == 0);
ASSERT_EQ(obj2->GetBasePointer(), obj->GetPointer(size)); ASSERT_EQ(obj2->GetBasePointer(), obj->GetPointer(size));
auto obj3 = pStream->MapFileByObjectEx(0, fsMap2, 0, size, AuIOFS::EFileOpenMode::eRead, AuFS::EFileAdvisoryLockLevel::eBlockWrite); auto obj3 = pStream->MapFileByObjectEx(0, fsMap2->GetHandle(), 0, size, AuIOFS::EFileOpenMode::eRead, AuFS::EFileAdvisoryLockLevel::eBlockWrite);
ASSERT_FALSE(bool(obj3)); ASSERT_FALSE(bool(obj3));
} }
} }