[PATCH 1/4] ntdll/tests: Add more tests if we have real VM counters.
Akihiro Sagawa
sagawa.aki at gmail.com
Sun Jun 4 08:37:34 CDT 2017
Signed-off-by: Akihiro Sagawa <sagawa.aki at gmail.com>
---
dlls/ntdll/tests/info.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
index f1de206..4198d9c 100644
--- a/dlls/ntdll/tests/info.c
+++ b/dlls/ntdll/tests/info.c
@@ -1069,6 +1069,9 @@ static void test_query_process_vm(void)
VM_COUNTERS pvi;
ULONG old_size = FIELD_OFFSET(VM_COUNTERS,PrivatePageCount);
HANDLE process;
+ SIZE_T prev_size;
+ const SIZE_T alloc_size = 64 << 20; /* 64 MB */
+ void *ptr;
status = pNtQueryInformationProcess(NULL, ProcessVmCounters, NULL, sizeof(pvi), NULL);
ok( status == STATUS_ACCESS_VIOLATION || status == STATUS_INVALID_HANDLE,
@@ -1119,6 +1122,22 @@ static void test_query_process_vm(void)
ok( pvi.PagefileUsage > 0, "Expected a PagefileUsage > 0\n");
CloseHandle(process);
+
+ /* Check if we have real counters */
+ status = pNtQueryInformationProcess(GetCurrentProcess(), ProcessVmCounters, &pvi, sizeof(pvi), NULL);
+ ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
+ prev_size = pvi.VirtualSize;
+ if (winetest_debug > 1)
+ dump_vm_counters("VM counters before VirtualAlloc", &pvi);
+ ptr = VirtualAlloc(NULL, alloc_size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
+ ok( ptr != NULL, "VirtualAlloc failed, err %u\n", GetLastError());
+ status = pNtQueryInformationProcess(GetCurrentProcess(), ProcessVmCounters, &pvi, sizeof(pvi), NULL);
+ ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
+ if (winetest_debug > 1)
+ dump_vm_counters("VM counters after VirtualAlloc", &pvi);
+ todo_wine ok( pvi.VirtualSize >= prev_size + alloc_size,
+ "Expected to be greater than %lu, got %lu\n", prev_size + alloc_size, pvi.VirtualSize);
+ VirtualFree( ptr, 0, MEM_RELEASE);
}
static void test_query_process_io(void)
--
2.7.4
More information about the wine-patches
mailing list