Rémi Bernon : dinput8/tests: Don't try running more tests after a win_skip.

Alexandre Julliard julliard at winehq.org
Thu Sep 30 16:04:42 CDT 2021


Module: wine
Branch: master
Commit: 3bc1263e5a9ce23b4744d9b14bb194be06aeb42f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=3bc1263e5a9ce23b4744d9b14bb194be06aeb42f

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Thu Sep 30 10:37:31 2021 +0200

dinput8/tests: Don't try running more tests after a win_skip.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dinput8/tests/hid.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c
index ce2a3792593..533c4a8ca42 100644
--- a/dlls/dinput8/tests/hid.c
+++ b/dlls/dinput8/tests/hid.c
@@ -4593,7 +4593,7 @@ struct device_desc
     HIDP_CAPS hid_caps;
 };
 
-static void test_device_types( void )
+static BOOL test_device_types(void)
 {
 #include "psh_hid_macros.h"
     static const unsigned char unknown_desc[] =
@@ -4837,11 +4837,12 @@ static void test_device_types( void )
     DIDEVCAPS caps = {.dwSize = sizeof(DIDEVCAPS)};
     WCHAR cwd[MAX_PATH], tempdir[MAX_PATH];
     IDirectInputDevice8W *device;
+    BOOL success = TRUE;
     IDirectInput8W *di;
     ULONG i, ref;
     HRESULT hr;
 
-    for (i = 0; i < ARRAY_SIZE(device_desc); ++i)
+    for (i = 0; i < ARRAY_SIZE(device_desc) && success; ++i)
     {
         winetest_push_context( "desc[%d]", i );
         GetCurrentDirectoryW( ARRAY_SIZE(cwd), cwd );
@@ -4852,7 +4853,7 @@ static void test_device_types( void )
         if (!dinput_driver_start( device_desc[i].report_desc_buf, device_desc[i].report_desc_len,
                                   &device_desc[i].hid_caps ))
         {
-            i = ARRAY_SIZE(device_desc);
+            success = FALSE;
             goto done;
         }
 
@@ -4860,7 +4861,7 @@ static void test_device_types( void )
         if (FAILED(hr))
         {
             win_skip( "DirectInput8Create returned %#x\n", hr );
-            i = ARRAY_SIZE(device_desc);
+            success = FALSE;
             goto done;
         }
 
@@ -4870,7 +4871,7 @@ static void test_device_types( void )
         {
             win_skip( "device not found, skipping tests\n" );
             IDirectInput8_Release( di );
-            i = ARRAY_SIZE(device_desc);
+            success = FALSE;
             goto done;
         }
 
@@ -4918,6 +4919,8 @@ static void test_device_types( void )
         SetCurrentDirectoryW( cwd );
         winetest_pop_context();
     }
+
+    return success;
 }
 
 static void test_force_feedback_joystick( void )
@@ -5345,9 +5348,11 @@ START_TEST( hid )
     test_hid_driver( 1, TRUE );
 
     CoInitialize( NULL );
-    test_device_types();
-    test_simple_joystick();
-    test_force_feedback_joystick();
+    if (test_device_types())
+    {
+        test_simple_joystick();
+        test_force_feedback_joystick();
+    }
     CoUninitialize();
 
     UnmapViewOfFile( test_data );




More information about the wine-cvs mailing list