https://bugs.winehq.org/show_bug.cgi?id=48108
Bug ID: 48108 Summary: kernel32:comm - QEmu's serial baud rate emulation is broken Product: Wine-Testbot Version: unspecified Hardware: x86 OS: Linux Status: NEW Severity: normal Priority: P2 Component: unknown Assignee: wine-bugs@winehq.org Reporter: fgouget@codeweavers.com Distribution: ---
kernel32:comm got a failure when running on Wine on the TestBot VM:
comm.c:932: Test failed: OutQueue should not be empty
This happens in test_waittxempty():
// Open the serial device hcom = test_OpenComm(TRUE); // Here it is already set to 150 bps because that's how a // previous test left it ... // Write 17 bytes in overlaped mode. // At 150 bauds this should take at least 900 ms res = WriteFile(hcom, tbuf, sizeof(tbuf), &bytes, &ovl_write); // Leaving us plenty of time to get to ClearCommError(hcom, &errors, &stat); ... // And here we expect the serial device to still have data to send. // But because QEmu sends the data at > 400 kbps this often fails ok(stat.cbOutQue != 0, "OutQueue should not be empty\n");
That QEmu does not enforce the set baud rate can also be verified from the command line:
# stty -F /dev/ttyS0 speed 9600 baud; line = 0; -brkint -imaxbel # dd if=/dev/zero of=/dev/ttyS0 bs=1 count=10000 10000+0 records in 10000+0 records out 10000 bytes (10 kB, 9.8 KiB) copied, 0.224432 s, 44.6 kB/s
# stty -F /dev/ttyS0 300 # stty -F /dev/ttyS0 speed 300 baud; line = 0; -brkint -imaxbel # dd if=/dev/zero of=/dev/ttyS0 bs=1 count=10000 10000+0 records in 10000+0 records out 10000 bytes (10 kB, 9.8 KiB) copied, 0.679127 s, 14.7 kB/s
Back to the kernel32:comm failure: * It did not happen for a long time and started happening on the debian10 VM on 2019-10-03. That corresponds to the time I added the winetest user to the dialout group, thus giving it access to /dev/ttyS0. * The same issue happens in the Windows VMs, but the ok() call has a broken() clause which hides the issue there.
So: 1. The bug needs to be reported to QEmu. 2. See why speeds below 9600 bps are not allowed. 3. We may want a better check for this issue: directly check that the baud rate is respected. This would allow us to skip tests that depend on the baud rate and ditch the broken() clause. 4. If the above does not work out the serial device should be removed from the Wine QEmu VMs.