Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logs cut off after screenshot test #336

Merged

Conversation

nicholasbishop
Copy link
Contributor

OVMF sets up the stdout handle such that writes go to all serial devices
(as well as the visual console when not running headless). This is
convenient since the logger writes to stdout, so connecting a serial
device to QEMU's stdout writes logs from the test runner to the host.

However, once a serial device is opened in exclusive mode it is
disconnected from stdout. Since the test runner needs to open a serial
device in exclusive mode, a single serial device isn't sufficient --
once the device is opened in exclusive mode it will stop receiving logs.

So, open two serial devices for the QEMU test. The first one is
connected to the host's stdout, and serves just to transport logs. The
second one is connected to a pipe, and used to receive the SCREENSHOT
command and send the response. That second will also receive logs up
until the test runner opens the handle in exclusive mode, but we can
just read and ignore those lines.

Fixes #327

OVMF sets up the stdout handle such that writes go to all serial devices
(as well as the visual console when not running headless). This is
convenient since the logger writes to stdout, so connecting a serial
device to QEMU's stdout writes logs from the test runner to the host.

However, once a serial device is opened in exclusive mode it is
disconnected from stdout. Since the test runner needs to open a serial
device in exclusive mode, a single serial device isn't sufficient --
once the device is opened in exclusive mode it will stop receiving logs.

So, open two serial devices for the QEMU test. The first one is
connected to the host's stdout, and serves just to transport logs. The
second one is connected to a pipe, and used to receive the SCREENSHOT
command and send the response. That second will also receive logs up
until the test runner opens the handle in exclusive mode, but we can
just read and ignore those lines.

Fixes rust-osdev#327
@GabrielMajeri
Copy link
Collaborator

Works perfectly, thanks!

@GabrielMajeri GabrielMajeri merged commit 7682eba into rust-osdev:master Jan 2, 2022
@nicholasbishop nicholasbishop deleted the bishop-fix-missing-logs-2 branch January 3, 2022 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

uefi-test-runner serial logs are cut off after the screenshot test
2 participants