跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

cpu_windows_amd64_test.go

44 行 · 1.4 KB历史下载
1// SPDX-FileCopyrightText: Copyright The Lima Authors
2// SPDX-License-Identifier: Apache-2.0
3
4package qemu
5
6import (
7 "testing"
8
9 "github.com/coreos/go-semver/semver"
10
11 "github.com/lima-vm/lima/v2/pkg/limatype"
12)
13
14func TestWHPXQEMU64Features(t *testing.T) {
15 for bits, want := range map[uint64]string{
16 0: "qemu64",
17 0x60: "qemu64", // AMD SSE4a and XOP do not imply SSE4.2.
18 0x0c: "qemu64,+ssse3,+sse4.1",
19 0x9c: "qemu64,+ssse3,+sse4.1,+sse4.2,+popcnt",
20 } {
21 if got := whpxQEMU64Model(bits); got != want {
22 t.Errorf("WHPX feature mask %#x: got %q, want %q", bits, got, want)
23 }
24 }
25}
26
27func TestWindowsCPUResolution(t *testing.T) {
28 arch := limatype.X8664
29 y := limatype.LimaYAML{Arch: &arch}
30 // New and existing instances with no explicit CPU override both resolve
31 // against the current host each time their QEMU command is generated.
32 if got, want := resolveCPUType(&y, semver.New("11.1.0")), whpxQEMU64(); got != want {
33 t.Fatalf("default for QEMU 11.1.0: got %q, want %q", got, want)
34 }
35 if got := resolveCPUType(&y, semver.New("11.1.1")); got != "host" {
36 t.Fatalf("default for QEMU 11.1.1: got %q", got)
37 }
38 for _, override := range []string{"qemu64", "qemu64,+sse4.2", "Nehalem"} {
39 y.VMOpts = limatype.VMOpts{limatype.QEMU: limatype.QEMUOpts{CPUType: limatype.CPUType{arch: override}}}
40 if got := resolveCPUType(&y, semver.New("11.1.0")); got != override {
41 t.Fatalf("explicit CPU type %q changed to %q", override, got)
42 }
43 }
44}