fn check_screenshot(bt: &BootServices, name: &str) {
    if cfg!(feature = "qemu") {
        // Access the serial port (in a QEMU environment, it should always be there)
        let serial = bt
            .locate_protocol::<Serial>()
            .expect_success("Could not find serial port");
        let serial = unsafe { &mut *serial.get() };

        // Set a large timeout to avoid problems with Travis
        let mut io_mode = *serial.io_mode();
        io_mode.timeout = 10_000_000;
        serial
            .set_attributes(&io_mode)
            .expect_success("Failed to configure serial port timeout");

        // Send a screenshot request to the host
        serial
            .write(b"SCREENSHOT: ")
            .expect_success("Failed to send request");
        let name_bytes = name.as_bytes();
        serial
            .write(name_bytes)
            .expect_success("Failed to send request");
        serial.write(b"\n").expect_success("Failed to send request");

        // Wait for the host's acknowledgement before moving forward
        let mut reply = [0; 3];
        serial
            .read(&mut reply[..])
            .expect_success("Failed to read host reply");

        assert_eq!(&reply[..], b"OK\n", "Unexpected screenshot request reply");
    } else {
        // Outside of QEMU, give the user some time to inspect the output
        bt.stall(3_000_000);
    }
}
/// Ask the test runner to check the current screen output against a reference
///
/// This functionality is very specific to our QEMU-based test runner. Outside
/// of it, we just pause the tests for a couple of seconds to allow visual
/// inspection of the output.
Ask the test runner to check the current screen output against a reference
This functionality is very specific to our QEMU-based test runner. Outside
of it, we just pause the tests for a couple of seconds to allow visual
inspection of the output.
Ask the test runner to check the current screen output against a reference This functionality is very specific to our QEMU - based test runner . Outside of it we just pause the tests for a couple of seconds to allow visual inspection of the output .
fn check_screenshot(bt: &BootServices, name: &str) {
    if cfg!(feature = "qemu") {
        // Access the serial port (in a QEMU environment, it should always be there)
        let serial = bt
            .locate_protocol::<Serial>()
            .expect_success("Could not find serial port");
        let serial = unsafe { &mut *serial.get() };
        // Set a large timeout to avoid problems with Travis
        let mut io_mode = *serial.io_mode();
        io_mode.timeout = 10_000_000;
        serial
            .set_attributes(&io_mode)
            .expect_success("Failed to configure serial port timeout");
        // Send a screenshot request to the host
        serial
            .write(b"SCREENSHOT: ")
            .expect_success("Failed to send request");
        let name_bytes = name.as_bytes();
        serial
            .write(name_bytes)
            .expect_success("Failed to send request");
        serial.write(b"\n").expect_success("Failed to send request");
        // Wait for the host's acknowledgement before moving forward
        let mut reply = [0; 3];
        serial
            .read(&mut reply[..])
            .expect_success("Failed to read host reply");
        assert_eq!(&reply[..], b"OK\n", "Unexpected screenshot request reply");
    } else {
        // Outside of QEMU, give the user some time to inspect the output
        bt.stall(3_000_000);
    }
}
fn check_screenshot ( bt : & BootServices , name : & str ) { if cfg ! ( feature " " ) { // Access the serial port (in a QEMU environment, it should always be there) let serial = bt . locate_protocol :: < Serial > ( ) . expect_success ( " " ) ; let serial = unsafe { & mut * serial . get ( ) } ; // Set a large timeout to avoid problems with Travis let mut io_mode = * serial . io_mode ( ) ; io_mode . timeout = 10_000_000 ; serial . set_attributes ( & io_mode ) . expect_success ( " " ) ; // Send a screenshot request to the host serial . write ( b" " ) . expect_success ( " " ) ; let name_bytes = name . as_bytes ( ) ; serial . write ( name_bytes ) . expect_success ( " " ) ; serial . write ( b" \n " ) . expect_success ( " " ) ; // Wait for the host's acknowledgement before moving forward let mut reply = [ 0 ; 3 ] ; serial . read ( & mut reply [ .. ] ) . expect_success ( " " ) ; assert_eq ! ( reply [ ] b" \n " " " ) ; } else { // Outside of QEMU, give the user some time to inspect the output bt . stall ( 3_000_000 ) ; } }
Ask the test runner to check the current screen output against a reference
This functionality is very specific to our QEMU-based test runner.
Ask the test runner to check the current screen output against a reference This functionality is very specific to our QEMU - based test runner .
bt
&BootServices
name
&str