Skip to content

Racy qemu pexpect test #168

@lool

Description

@lool

We've recently added a test to verify that a password change was properly enforced, along with a qemu test.

However it failed in a recent CI run:

/usr/lib/python3/dist-packages/pexpect/expect.py:144: TIMEOUT
---------------------------- Captured stdout setup -----------------------------
Formatting '/tmp/tmpjbzf0_dl/disk1.qcow', fmt=qcow size=4294967296 backing_file=/__w/qcom-deb-images/qcom-deb-images/disk-ufs.img backing_fmt=raw
=========================== short test summary info ============================
FAILED ci/qemu_test.py::test_password_reset_required - pexpect.exceptions.TIMEOUT: Timeout exceeded.
<pexpect.pty_spawn.spawn object at 0xf0f8f8d58c20>
command: /usr/bin/qemu-system-aarch64
args: ['/usr/bin/qemu-system-aarch64', '-cpu', 'cortex-a57', '-m', '2048', '-M', 'virt', '-drive', 'if=none,file=/tmp/tmpjbzf0_dl/disk1.qcow,format=qcow,id=disk1', '-device', 'virtio-scsi-pci,id=scsi1', '-device', 'scsi-hd,bus=scsi1.0,drive=disk1,physical_block_size=4096,logical_block_size=4096', '-nographic', '-bios', '/usr/share/AAVMF/AAVMF_CODE.fd']
buffer (last 100 chars): b'plicable law.\r\r\n'
before (last 100 chars): b'\nDebian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent\r\r\npermitted by applicable law.\r\r\n'
after: <class 'pexpect.exceptions.TIMEOUT'>

the contents of buffer and before suggest the prompt is reached, but it's probably garbled by some other boot message, and pexpect doesn't match and times out.

We need some out of band signaling that boot is complete. Since we have adbd, we could use this.

I've found that adding -netdev user,id=net0,hostfwd=tcp::5555-:5555 -device virtio-net-pci,netdev=net0 to qemu-system allowed the instance to be visible in adb devices, and then I could adb shell into it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingworkflowsCI logic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions