Skip to content

Commit 4d8e9f9

Browse files
xtask: Fix screenshot test on Windows
This is a partial revert of 12a7b44. We still only have one serial device, but on the host it is connected to a pipe rather than stdio. For some reason on Windows, messages sent to QEMU via stdin don't work, but it works fine via pipe. Fixes #647
1 parent 8fa4645 commit 4d8e9f9

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

xtask/src/qemu.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -520,10 +520,11 @@ pub fn run_qemu(arch: UefiArch, opt: &QemuOpt) -> Result<()> {
520520
cmd.arg(drive_arg);
521521

522522
let qemu_monitor_pipe = Pipe::new(tmp_dir, "qemu-monitor")?;
523+
let serial_pipe = Pipe::new(tmp_dir, "serial")?;
523524

524525
// Open a serial device connected to stdio. This is used for
525526
// printing logs and to receive and reply to commands.
526-
cmd.args(["-serial", "stdio"]);
527+
cmd.args(["-serial", serial_pipe.qemu_arg()]);
527528

528529
// Map the QEMU monitor to a pair of named pipes
529530
cmd.args(["-qmp", qemu_monitor_pipe.qemu_arg()]);
@@ -556,14 +557,11 @@ pub fn run_qemu(arch: UefiArch, opt: &QemuOpt) -> Result<()> {
556557
let mut child = ChildWrapper(cmd.spawn().context("failed to launch qemu")?);
557558

558559
let monitor_io = qemu_monitor_pipe.open_io()?;
559-
let child_io = Io::new(
560-
child.0.stdout.take().unwrap(),
561-
child.0.stdin.take().unwrap(),
562-
);
560+
let serial_io = serial_pipe.open_io()?;
563561

564562
// Capture the result to check it, but first wait for the child to
565563
// exit.
566-
let res = process_qemu_io(monitor_io, child_io, tmp_dir);
564+
let res = process_qemu_io(monitor_io, serial_io, tmp_dir);
567565
let status = child.0.wait()?;
568566

569567
if let Some(echo_service) = echo_service {

0 commit comments

Comments
 (0)