mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 08:23:05 -05:00
tst: fsbench: rdwr test
This commit is contained in:
parent
d12234bb01
commit
f82cad712a
@ -19,9 +19,9 @@
|
|||||||
#include <strsafe.h>
|
#include <strsafe.h>
|
||||||
#include <tlib/testsuite.h>
|
#include <tlib/testsuite.h>
|
||||||
|
|
||||||
ULONG OptFileCount = 1000;
|
static ULONG OptFileCount = 1000;
|
||||||
ULONG OptListCount = 100;
|
static ULONG OptListCount = 100;
|
||||||
ULONG OptRdwrCount = 10000;
|
static ULONG OptRdwrCount = 100;
|
||||||
|
|
||||||
static void file_create_dotest(ULONG CreateDisposition)
|
static void file_create_dotest(ULONG CreateDisposition)
|
||||||
{
|
{
|
||||||
@ -130,6 +130,8 @@ static void rdwr_dotest(ULONG CreateDisposition, ULONG CreateFlags)
|
|||||||
BOOL Success;
|
BOOL Success;
|
||||||
DWORD BytesTransferred;
|
DWORD BytesTransferred;
|
||||||
WCHAR FileName[MAX_PATH];
|
WCHAR FileName[MAX_PATH];
|
||||||
|
ULONG Iterations = 1000;
|
||||||
|
|
||||||
|
|
||||||
GetSystemInfo(&SystemInfo);
|
GetSystemInfo(&SystemInfo);
|
||||||
Buffer = _aligned_malloc(SystemInfo.dwPageSize, SystemInfo.dwPageSize);
|
Buffer = _aligned_malloc(SystemInfo.dwPageSize, SystemInfo.dwPageSize);
|
||||||
@ -145,14 +147,26 @@ static void rdwr_dotest(ULONG CreateDisposition, ULONG CreateFlags)
|
|||||||
0);
|
0);
|
||||||
ASSERT(INVALID_HANDLE_VALUE != Handle);
|
ASSERT(INVALID_HANDLE_VALUE != Handle);
|
||||||
|
|
||||||
|
if (CREATE_NEW == CreateDisposition)
|
||||||
|
{
|
||||||
|
BytesTransferred = SetFilePointer(Handle, Iterations * SystemInfo.dwPageSize, 0, FILE_BEGIN);
|
||||||
|
ASSERT(Iterations * SystemInfo.dwPageSize == BytesTransferred);
|
||||||
|
SetEndOfFile(Handle);
|
||||||
|
}
|
||||||
|
|
||||||
for (ULONG Index = 0; OptRdwrCount > Index; Index++)
|
for (ULONG Index = 0; OptRdwrCount > Index; Index++)
|
||||||
{
|
{
|
||||||
if (CREATE_NEW == CreateDisposition)
|
BytesTransferred = SetFilePointer(Handle, 0, 0, FILE_BEGIN);
|
||||||
Success = WriteFile(Handle, Buffer, SystemInfo.dwPageSize, &BytesTransferred, 0);
|
ASSERT(0 == BytesTransferred);
|
||||||
else
|
for (ULONG I = 0; Iterations > I; I++)
|
||||||
Success = ReadFile(Handle, Buffer, SystemInfo.dwPageSize, &BytesTransferred, 0);
|
{
|
||||||
ASSERT(Success);
|
if (CREATE_NEW == CreateDisposition)
|
||||||
ASSERT(SystemInfo.dwPageSize == BytesTransferred);
|
Success = WriteFile(Handle, Buffer, SystemInfo.dwPageSize, &BytesTransferred, 0);
|
||||||
|
else
|
||||||
|
Success = ReadFile(Handle, Buffer, SystemInfo.dwPageSize, &BytesTransferred, 0);
|
||||||
|
ASSERT(Success);
|
||||||
|
ASSERT(SystemInfo.dwPageSize == BytesTransferred);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Success = CloseHandle(Handle);
|
Success = CloseHandle(Handle);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user