* feat: add experimental Apple Silicon support with Nivfold Integrate the standalone Nivfold protocol 1 runner; tested against Nivfold f436fb6. The Windows Reims vGPU runtime remains independent. * fix: open QQ invites and VM SSH on macOS * fix: move VM, View and Help to the macOS menu bar * feat(macos): add resumable Apple restore image downloads Expose the compatible restore image in the VM wizard and Images page, validate downloads before caching, and fix macOS memory reporting and plugin SVG rendering. * fix(macos): localize the native application menu * fix(macos): address native desktop review findings
29 lines
900 B
Go
29 lines
900 B
Go
package host
|
|
|
|
import (
|
|
"math"
|
|
"testing"
|
|
)
|
|
|
|
func TestDarwinMemoryUsageExcludesReclaimablePages(t *testing.T) {
|
|
const page = 16384
|
|
for _, tc := range []struct {
|
|
name string
|
|
total, anon, purge, wired, compressed uint64
|
|
want uint64
|
|
ok bool
|
|
}{
|
|
{"cache is excluded", 100 * page, 40, 5, 15, 10, 60 * page, true},
|
|
{"purgeable cannot underflow", 100 * page, 10, 15, 3, 2, 5 * page, true},
|
|
{"usage exceeds physical RAM", 100 * page, 80, 0, 40, 0, 0, false},
|
|
{"counter overflow", 100 * page, math.MaxUint64, 0, 2, 0, 0, false},
|
|
} {
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
got, ok := darwinMemoryBytes(tc.total, page, tc.anon, tc.purge, tc.wired, tc.compressed)
|
|
if got != tc.want || ok != tc.ok {
|
|
t.Fatalf("usage = (%d, %v), want (%d, %v)", got, ok, tc.want, tc.ok)
|
|
}
|
|
})
|
|
}
|
|
}
|