testsuite: Don't always loop in memorytexture tests
authorBenjamin Otte <otte@redhat.com>
Thu, 8 Jun 2023 23:09:52 +0000 (01:09 +0200)
committerBenjamin Otte <otte@redhat.com>
Thu, 8 Jun 2023 23:12:32 +0000 (01:12 +0200)
When running the tests, only run the random (and potentially large) size
download test once instead of 10 times.

There's no real benefit in doing that, both because it's unlikely to
fail only in the 2nd or 9th run and because the sizes are picked
randomly.

This also speeds up the test massively as the download test was
dominating the runtime.

testsuite/gdk/memorytexture.c

index 138eb6844b51e7edd7efae124b0f2996712d4b96..d0004003ecd2b3be532b9a4d60fc312bc73e042b 100644 (file)
@@ -1144,7 +1144,8 @@ should_skip_download_test (GdkMemoryFormat format,
 static void
 test_download (gconstpointer data,
                unsigned int  width,
-               unsigned int  height)
+               unsigned int  height,
+               gsize         n_runs)
 {
   GdkMemoryFormat format;
   TextureMethod method;
@@ -1157,7 +1158,7 @@ test_download (gconstpointer data,
   if (should_skip_download_test (format, method))
     return;
 
-  for (i = 0; i < N; i++)
+  for (i = 0; i < n_runs; i++)
     {
       GdkRGBA color;
 
@@ -1184,7 +1185,7 @@ test_download (gconstpointer data,
 static void
 test_download_1x1 (gconstpointer data)
 {
-  test_download (data, 1, 1);
+  test_download (data, 1, 1, N);
 }
 
 static void
@@ -1203,7 +1204,7 @@ test_download_random (gconstpointer data)
     }
   while (width * height >= 1024 * 1024);
 
-  test_download (data, width, height);
+  test_download (data, width, height, 1);
 }
 
 static void