Module: wine
Branch: master
Commit: 96da5a8a3572d08bbcf4323c3701e7da5f79e523
URL: https://gitlab.winehq.org/wine/wine/-/commit/96da5a8a3572d08bbcf4323c3701e7…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Thu Nov 16 18:50:30 2023 +0100
advapi32/tests: Fix a service stop race condition.
If some Windows services stop while testing EnumServicesStatusW()'s
resume handle support, one possibility is that the still running
services all fit in the specified buffer, invalidating the test so
there is a retry in place.
But in some cases the second call just returns fewer tests than
expected. So retry in that case too.
Wine-Bug: https://bugs.winehq.org//show_bug.cgi?id=53460
---
dlls/advapi32/tests/service.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/dlls/advapi32/tests/service.c b/dlls/advapi32/tests/service.c
index 4e6aebb445d..3fb1bda1d7d 100644
--- a/dlls/advapi32/tests/service.c
+++ b/dlls/advapi32/tests/service.c
@@ -1370,6 +1370,8 @@ static BOOL test_enum_svc(int attempt)
goto retry; /* service start race condition */
ok(ret, "Expected success, got error %lu\n", GetLastError());
ok(needed == 0, "Expected 0 needed bytes as we are done, got %lu\n", needed);
+ if (returned < missing && strcmp(winetest_platform, "wine") && attempt)
+ goto retry; /* service stop race condition */
todo_wine ok(returned == missing, "Expected %lu remaining services, got %lu\n", missing, returned);
ok(resume == 0, "Expected the resume handle to be 0\n");