(t *testing.T)
| 338 | } |
| 339 | |
| 340 | func TestQueryWorkingSetCurrentProcess(t *testing.T) { |
| 341 | // allocate a page so we have a known committed address to query |
| 342 | const size = 4096 |
| 343 | addr, err := windows.VirtualAlloc(0, size, windows.MEM_COMMIT|windows.MEM_RESERVE, windows.PAGE_READWRITE) |
| 344 | if err != nil { |
| 345 | t.Fatalf("VirtualAlloc failed: %v", err) |
| 346 | } |
| 347 | defer windows.VirtualFree(addr, 0, windows.MEM_RELEASE) |
| 348 | |
| 349 | ws := []sys.MemoryWorkingSetExInformation{ |
| 350 | {VirtualAddress: addr}, |
| 351 | } |
| 352 | |
| 353 | result := QueryWorkingSet(windows.CurrentProcess(), ws) |
| 354 | if result == nil { |
| 355 | t.Fatal("QueryWorkingSet returned nil for a valid committed page") |
| 356 | } |
| 357 | if len(result) != 1 { |
| 358 | t.Fatalf("expected 1 result, got %d", len(result)) |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | func TestQueryWorkingSetBatchAddresses(t *testing.T) { |
| 363 | const pageSize = 4096 |
nothing calls this directly
no test coverage detected