The main goal is to get WineTest reports to state that the test was skipped because rtworkq.dll is missing rather than because of a possibly unrelated API.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- Restating differently, currently looking at a WineTest report (or test.winehq.org) I see that the test was skipped on Vista because of a missing API and I am left to guess whether rtworkq.dll was available at all.
This patch takes out the guessing part even if nothing can be tested (so far). --- dlls/rtworkq/tests/rtworkq.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/dlls/rtworkq/tests/rtworkq.c b/dlls/rtworkq/tests/rtworkq.c index 627e024d761..6337eb35f3d 100644 --- a/dlls/rtworkq/tests/rtworkq.c +++ b/dlls/rtworkq/tests/rtworkq.c @@ -25,6 +25,9 @@
#include "wine/test.h"
+/* functions that are not present on all versions of Windows */ +static HRESULT (WINAPI * pCoGetApartmentType)(APTTYPE *type, APTTYPEQUALIFIER *qualifier); + static void test_platform_init(void) { APTTYPEQUALIFIER qualifier; @@ -32,13 +35,13 @@ static void test_platform_init(void) HRESULT hr;
/* Startup initializes MTA. */ - hr = CoGetApartmentType(&apttype, &qualifier); + hr = pCoGetApartmentType(&apttype, &qualifier); ok(hr == CO_E_NOTINITIALIZED, "Unexpected hr %#x.\n", hr);
hr = RtwqStartup(); ok(hr == S_OK, "Failed to start up, hr %#x.\n", hr);
- hr = CoGetApartmentType(&apttype, &qualifier); + hr = pCoGetApartmentType(&apttype, &qualifier); ok(hr == S_OK || broken(FAILED(hr)) /* Win8 */, "Unexpected hr %#x.\n", hr); if (SUCCEEDED(hr)) ok(apttype == APTTYPE_MTA && qualifier == APTTYPEQUALIFIER_IMPLICIT_MTA, @@ -47,14 +50,14 @@ static void test_platform_init(void) hr = RtwqShutdown(); ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
- hr = CoGetApartmentType(&apttype, &qualifier); + hr = pCoGetApartmentType(&apttype, &qualifier); ok(hr == CO_E_NOTINITIALIZED, "Unexpected hr %#x.\n", hr);
/* Try with STA initialized before startup. */ hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); ok(hr == S_OK, "Failed to initialize, hr %#x.\n", hr);
- hr = CoGetApartmentType(&apttype, &qualifier); + hr = pCoGetApartmentType(&apttype, &qualifier); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(apttype == APTTYPE_MAINSTA && qualifier == APTTYPEQUALIFIER_NONE, "Unexpected apartment type %d, qualifier %d.\n", apttype, qualifier); @@ -62,7 +65,7 @@ static void test_platform_init(void) hr = RtwqStartup(); ok(hr == S_OK, "Failed to start up, hr %#x.\n", hr);
- hr = CoGetApartmentType(&apttype, &qualifier); + hr = pCoGetApartmentType(&apttype, &qualifier); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(apttype == APTTYPE_MAINSTA && qualifier == APTTYPEQUALIFIER_NONE, "Unexpected apartment type %d, qualifier %d.\n", apttype, qualifier); @@ -76,7 +79,7 @@ static void test_platform_init(void) hr = RtwqStartup(); ok(hr == S_OK, "Failed to start up, hr %#x.\n", hr);
- hr = CoGetApartmentType(&apttype, &qualifier); + hr = pCoGetApartmentType(&apttype, &qualifier); ok(hr == S_OK || broken(FAILED(hr)) /* Win8 */, "Unexpected hr %#x.\n", hr); if (SUCCEEDED(hr)) ok(apttype == APTTYPE_MTA && qualifier == APTTYPEQUALIFIER_IMPLICIT_MTA, @@ -85,14 +88,14 @@ static void test_platform_init(void) hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); ok(hr == S_OK, "Failed to initialize, hr %#x.\n", hr);
- hr = CoGetApartmentType(&apttype, &qualifier); + hr = pCoGetApartmentType(&apttype, &qualifier); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(apttype == APTTYPE_MAINSTA && qualifier == APTTYPEQUALIFIER_NONE, "Unexpected apartment type %d, qualifier %d.\n", apttype, qualifier);
CoUninitialize();
- hr = CoGetApartmentType(&apttype, &qualifier); + hr = pCoGetApartmentType(&apttype, &qualifier); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(apttype == APTTYPE_MTA && qualifier == APTTYPEQUALIFIER_IMPLICIT_MTA, "Unexpected apartment type %d, qualifier %d.\n", apttype, qualifier); @@ -103,5 +106,13 @@ static void test_platform_init(void)
START_TEST(rtworkq) { + HMODULE hOle32 = GetModuleHandleA("ole32"); + pCoGetApartmentType = (void*)GetProcAddress(hOle32, "CoGetApartmentType"); + if (!pCoGetApartmentType) + { + win_skip("CoGetApartmentType() is missing\n"); + return; + } + test_platform_init(); }
On 4/21/21 9:18 PM, Francois Gouget wrote:
The main goal is to get WineTest reports to state that the test was skipped because rtworkq.dll is missing rather than because of a possibly unrelated API.
Signed-off-by: Francois Gouget fgouget@codeweavers.com
Restating differently, currently looking at a WineTest report (or test.winehq.org) I see that the test was skipped on Vista because of a missing API and I am left to guess whether rtworkq.dll was available at all.
This patch takes out the guessing part even if nothing can be tested (so far).
Is it possible to test for target dll first, before going through imports?
It did work somehow before, test page shows n/a for Vista/Win7, mentioning rtworkq.dll correctly. CoGetApartmentType() exists on Win7+, and rtworkq.dll on Win8+, so your change only applies to Vista?
So, if we have to, can we fix winetest logic instead, inferring "main" module from test executable name as a first test, or some other way?
On Thu, 22 Apr 2021, Nikolay Sivov wrote: [...]
Is it possible to test for target dll first, before going through imports?
It did work somehow before, test page shows n/a for Vista/Win7, mentioning rtworkq.dll correctly. CoGetApartmentType() exists on Win7+, and rtworkq.dll on Win8+, so your change only applies to Vista?
So, if we have to, can we fix winetest logic instead, inferring "main" module from test executable name as a first test, or some other way?
That's what WineTest used to do and it is very unreliable and caused many other problems: https://bugs.winehq.org/show_bug.cgi?id=45032
Now (e618fb526d06) WineTest does not blindly trust the result from this test and instead runs xxx_test.exe --list and then checks the CreateProcess() error code to detect why the executable could not be run. That's how WineTest now knows that there is an entry point missing.
But whether CreateProcess() reports the missing dll or the missing API first is not up to us.