kernel32/tests: Reduce the size of the console buffer to speed up the tests.

Francois Gouget fgouget at
Mon Feb 11 08:36:15 CST 2013


This solves the timeouts on the new WineTestBot. It turns out that it's 
the ReadConsoleOutputCharacter() or ReadConsoleOutputAttribute() calls 
that are slow in QEmu, which is pretty strange since they don't even 
change anything on-screen. Furthermore they are only slow in the Windows 
7 VM, not in the Windows XP one.

What causes the overall test to be slow is that the test checks the 
whole buffer after various operations to make sure only the parts 
that are supposed to be changed where changed and that everything 
else was left alone. But the buffer is 300 lines long by default. So 
this patch reduces it to 28 lines which yields a rough 10x speed up.

 dlls/kernel32/tests/console.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c
index e5fb29b..947f84c 100644
--- a/dlls/kernel32/tests/console.c
+++ b/dlls/kernel32/tests/console.c
@@ -2642,6 +2642,18 @@ START_TEST(console)
     ok(ret, "Getting sb info\n");
     if (!ret) return;
+    /* Reduce the size of the buffer to the visible area plus 3 lines to speed
+     * up the tests.
+     */
+    trace("Visible area: %dx%d - %dx%d Buffer size: %dx%d\n", sbi.srWindow.Left, sbi.srWindow.Top, sbi.srWindow.Right, sbi.srWindow.Bottom, sbi.dwSize.X, sbi.dwSize.Y);
+    sbi.dwSize.Y = size = (sbi.srWindow.Bottom + 1) + 3;
+    ret = SetConsoleScreenBufferSize(hConOut, sbi.dwSize);
+    ok(ret, "Setting sb info\n");
+    ret = GetConsoleScreenBufferInfo(hConOut, &sbi);
+    ok(ret, "Getting sb info\n");
+    ok(sbi.dwSize.Y == size, "Unexpected buffer size: %d instead of %d\n", sbi.dwSize.Y, size);
+    if (!ret) return;
     /* Non interactive tests */
     testCursor(hConOut, sbi.dwSize);
     /* test parameters (FIXME: test functionality) */

More information about the wine-patches mailing list