Ge van Geldorp wrote:
>> From: Reece Dunn [mailto:mscl...@googlemail.com] 
>>
>> Do you know why you need to do a SetForegroundWindow there to 
>> make the tests succeed?
>> Why is the input being sent to a different window?
>> Why does it vary from platform-to-platform and machine-to-machine?
>>     
>
> It's a timing issue. It doesn't just vary from machine-to-machine but even
> from testrun-to-testrun (e.g. gvg-wxpprosp2 failed on 29 Jan but passed on
> 27 Jan). This is on VMs which get reset to a snapshot before running the
> tests, so the machine starts each test run identically.
>
> Gé.
>   
I think the main problem is that the thread might run parallel with some
other test code.

That is why I would suggest to wait for the thread to finish at the end
of the test.

I made a patch and attached it to this email. I can't reproduce the
failure on my system, so I can't test if the patch helps. It would be
cool, if someone could test, if my patch fix the issue.

Best regards,
Florian Köberle
>From 163e560696f8f2d9340fdbafb38fc12363099128 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Florian=20K=C3=B6berle?= <flor...@fkoeberle.de>
Date: Fri, 30 Jan 2009 11:41:31 +0100
Subject: Make sure that the test thread doesn't run while other tests are running.

---
 dlls/user32/tests/menu.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/tests/menu.c b/dlls/user32/tests/menu.c
index 6ee28a3..d019b92 100644
--- a/dlls/user32/tests/menu.c
+++ b/dlls/user32/tests/menu.c
@@ -1892,6 +1892,8 @@ static void test_menu_input(void) {
             break;
         while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
     }
+    // Make sure that the thread doesn't run while other tests are running
+    ok (WAIT_OBJECT_0 == WaitForSingleObject(hThread, 10000), "Test thread did not terminate within 10 seconds.");
     DestroyWindow(hWnd);
 }
 
-- 
1.5.4.3



Reply via email to