(t *testing.T)
| 360 | } |
| 361 | |
| 362 | func TestQueryWorkingSetBatchAddresses(t *testing.T) { |
| 363 | const pageSize = 4096 |
| 364 | const pages = 8 |
| 365 | |
| 366 | addr, err := windows.VirtualAlloc(0, pageSize*pages, windows.MEM_COMMIT|windows.MEM_RESERVE, windows.PAGE_READWRITE) |
| 367 | if err != nil { |
| 368 | t.Fatalf("VirtualAlloc failed: %v", err) |
| 369 | } |
| 370 | defer windows.VirtualFree(addr, 0, windows.MEM_RELEASE) |
| 371 | |
| 372 | ws := make([]sys.MemoryWorkingSetExInformation, pages) |
| 373 | for i := range ws { |
| 374 | ws[i].VirtualAddress = addr + uintptr(i*pageSize) |
| 375 | } |
| 376 | |
| 377 | result := QueryWorkingSet(windows.CurrentProcess(), ws) |
| 378 | if result == nil { |
| 379 | t.Fatal("QueryWorkingSet returned nil for batch of valid pages") |
| 380 | } |
| 381 | if len(result) != pages { |
| 382 | t.Fatalf("expected %d results, got %d", pages, len(result)) |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | func TestQueryWorkingSetNilOnNilPool(t *testing.T) { |
| 387 | // temporarily nil the pool to simulate init failure |
nothing calls this directly
no test coverage detected