Skip to content

Commit 190a5fd

Browse files
committed
cmd/runqemubuildlet: pass command arguments correctly
The spaces are not necessary, as each argument is passed correctly to the command. Add Stdout/Stderr output from qemu. For golang/go#47018 Change-Id: Ia908bf2cc639cc7d2a60bff137bc2e714a3ec6ef Reviewed-on: https://go-review.googlesource.com/c/build/+/334953 Trust: Alexander Rakoczy <[email protected]> Run-TryBot: Alexander Rakoczy <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent 9e3716b commit 190a5fd

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

cmd/runqemubuildlet/main.go

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,16 @@ func main() {
3535
for ctx.Err() == nil {
3636
cmd := windows10Cmd(*windows10Path)
3737
log.Printf("Starting VM: %s", cmd.String())
38+
cmd.Stdout = os.Stdout
39+
cmd.Stderr = os.Stderr
3840
if err := cmd.Start(); err != nil {
3941
log.Printf("cmd.Start() = %v. Retrying in 10 seconds.", err)
4042
time.Sleep(10 * time.Second)
4143
continue
4244
}
4345
if err := internal.WaitOrStop(ctx, cmd, os.Interrupt, time.Minute); err != nil {
44-
log.Printf("waitOrStop(_, %v, %v, %v) = %v", cmd, os.Interrupt, time.Minute, err)
46+
log.Printf("waitOrStop(_, %v, %v, %v) = %v. Retrying in 10 seconds.", cmd, os.Interrupt, time.Minute, err)
47+
time.Sleep(10 * time.Second)
4548
}
4649
}
4750
}
@@ -63,29 +66,29 @@ func defaultWindowsDir() string {
6366
// to be started.
6467
func windows10Cmd(base string) *exec.Cmd {
6568
c := exec.Command(filepath.Join(base, "sysroot-macos-arm64/bin/qemu-system-aarch64"),
66-
fmt.Sprintf("-L %s", filepath.Join(base, "UTM.app/Contents/Resources/qemu")),
67-
"-device ramfb",
68-
"-cpu max",
69-
"-smp cpus=8,sockets=1,cores=8,threads=1", // This works well with M1 Mac Minis.
70-
"-machine virt,highmem=off",
71-
"-accel hvf",
72-
"-accel tcg,tb-size=1536",
73-
"-boot menu=on",
74-
"-m 12288",
75-
`-name "Virtual Machine"`,
76-
"-device qemu-xhci,id=usb-bus",
77-
"-device usb-tablet,bus=usb-bus.0",
78-
"-device usb-mouse,bus=usb-bus.0",
79-
"-device usb-kbd,bus=usb-bus.0",
80-
fmt.Sprintf("-bios %s", filepath.Join(base, "Images/QEMU_EFI.fd")),
81-
"-device nvme,drive=drive0,serial=drive0,bootindex=0",
82-
fmt.Sprintf(`-drive "if=none,media=disk,id=drive0,file=%s,cache=writethrough"`, filepath.Join(base, "Images/win10.qcow2")),
83-
"-device usb-storage,drive=drive2,removable=true,bootindex=1",
84-
fmt.Sprintf(`-drive "if=none,media=cdrom,id=drive2,file=%s,cache=writethrough"`, filepath.Join(base, "Images/virtio.iso")),
85-
"-device virtio-net-pci,netdev=net0",
86-
"-netdev user,id=net0",
69+
"-L", filepath.Join(base, "UTM.app/Contents/Resources/qemu"),
70+
"-cpu", "max",
71+
"-smp", "cpus=8,sockets=1,cores=8,threads=1", // This works well with M1 Mac Minis.
72+
"-machine", "virt,highmem=off",
73+
"-accel", "hvf",
74+
"-accel", "tcg,tb-size=1536",
75+
"-boot", "menu=on",
76+
"-m", "12288",
77+
"-name", "Virtual Machine",
78+
"-device", "qemu-xhci,id=usb-bus",
79+
"-device", "ramfb",
80+
"-device", "usb-tablet,bus=usb-bus.0",
81+
"-device", "usb-mouse,bus=usb-bus.0",
82+
"-device", "usb-kbd,bus=usb-bus.0",
83+
"-device", "virtio-net-pci,netdev=net0",
84+
"-netdev", "user,id=net0",
85+
"-bios", filepath.Join(base, "Images/QEMU_EFI.fd"),
86+
"-device", "nvme,drive=drive0,serial=drive0,bootindex=0",
87+
"-drive", fmt.Sprintf("if=none,media=disk,id=drive0,file=%s,cache=writethrough", filepath.Join(base, "Images/win10.qcow2")),
88+
"-device", "usb-storage,drive=drive2,removable=true,bootindex=1",
89+
"-drive", fmt.Sprintf("if=none,media=cdrom,id=drive2,file=%s,cache=writethrough", filepath.Join(base, "Images/virtio.iso")),
8790
"-snapshot", // critical to avoid saving state between runs.
88-
"-vnc :3",
91+
"-vnc", ":3",
8992
)
9093
c.Env = append(os.Environ(),
9194
fmt.Sprintf("DYLD_LIBRARY_PATH=%s", filepath.Join(base, "sysroot-macos-arm64/lib")),

0 commit comments

Comments
 (0)