[glib/3v1n0/allocation-benchmarks] CI: run benchmarks instead of tests




commit e83bf90fd0c1a59d7b209a501584f2cbd3c3162b
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Thu Jul 7 16:47:24 2022 +0200

    CI: run benchmarks instead of tests

 .gitlab-ci.yml           |  2 ++
 .gitlab-ci/run-tests.sh  |  1 +
 .gitlab-ci/test-msvc.bat |  2 +-
 tests/allocators-tests.c | 13 ++++++-------
 4 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8fe839a758..1f5d44fbda 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -261,6 +261,7 @@ cross-android_arm64:
     # FIXME: add --werror
     - meson ${MESON_COMMON_OPTIONS} --cross-file=.gitlab-ci/cross_file_android_arm64_31.txt _build
     - ninja -C _build
+    - meson test -C _build --benchmark -v --timeout-multiplier 10
 
 cross-mingw64:
   extends:
@@ -271,6 +272,7 @@ cross-mingw64:
     # FIXME: Add --werror
     - meson ${MESON_COMMON_OPTIONS} --cross-file=/opt/cross_file_mingw64.txt _build
     - ninja -C _build
+    - meson test -C _build --benchmark -v --timeout-multiplier 10
   artifacts:
     reports:
       junit: "_build/meson-logs/testlog.junit.xml"
diff --git a/.gitlab-ci/run-tests.sh b/.gitlab-ci/run-tests.sh
index 86402dcaf4..441e015a1b 100755
--- a/.gitlab-ci/run-tests.sh
+++ b/.gitlab-ci/run-tests.sh
@@ -2,6 +2,7 @@
 
 meson test \
         -C _build \
+        --benchmark -v \
         --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
         --no-suite flaky \
         "$@"
diff --git a/.gitlab-ci/test-msvc.bat b/.gitlab-ci/test-msvc.bat
index 37976d4d00..ccee8c8322 100644
--- a/.gitlab-ci/test-msvc.bat
+++ b/.gitlab-ci/test-msvc.bat
@@ -17,7 +17,7 @@ meson %args% _build || goto :error
 ninja -C _build || goto :error
 
 :: FIXME: dont ignore test errors
-meson test -C _build --timeout-multiplier %MESON_TEST_TIMEOUT_MULTIPLIER% --no-suite flaky
+meson test -C _build --benchmark -v --timeout-multiplier %MESON_TEST_TIMEOUT_MULTIPLIER% --no-suite flaky
 
 :: FIXME: can we get code coverage support?
 
diff --git a/tests/allocators-tests.c b/tests/allocators-tests.c
index b60b04edae..328e40977f 100644
--- a/tests/allocators-tests.c
+++ b/tests/allocators-tests.c
@@ -20,10 +20,9 @@
  */
 
 #include <glib.h>
-#include <math.h>
 
 #define SIMPLE_TYPE_ITERATIONS 100000000
-#define POINTERS_ARRAY_SIZE 1000000
+#define POINTERS_ARRAY_SIZE 10000
 #define MAX_ALLOCATED_SIZE (POINTERS_ARRAY_SIZE * 512)
 
 #ifdef G_USE_SYSTEM_ALLOCATOR
@@ -58,7 +57,7 @@
     time_elapsed = g_test_timer_elapsed ();                                          \
     g_test_minimized_result (time_elapsed,                                           \
                              "Allocated and free'd %u instances of %s "              \
-                             "(size: %" G_GSIZE_FORMAT " using %s in %6.3f seconds", \
+                             "(size: %" G_GSIZE_FORMAT " using %s in %6.5f seconds", \
                              N, #type, (gsize) type_size, #allocator, time_elapsed); \
   }
 
@@ -79,7 +78,7 @@
                                                                                      \
     g_test_minimized_result (time_elapsed,                                           \
                              "Allocated %u instances of %s (size: %" G_GSIZE_FORMAT  \
-                             ") using %s in %6.3f seconds",                          \
+                             ") using %s in %6.5f seconds",                          \
                              N, #type, (gsize) type_size, #allocator, time_elapsed); \
                                                                                      \
     g_test_timer_start ();                                                           \
@@ -91,11 +90,11 @@
     total_time += time_elapsed;                                                      \
                                                                                      \
     g_test_minimized_result (time_elapsed,                                           \
-                             "Free'd %u instances of %s in %6.3f seconds",           \
+                             "Free'd %u instances of %s in %6.5f seconds",           \
                              N, #type, time_elapsed);                                \
     g_test_minimized_result (total_time,                                             \
                              "Allocated and Free'd %u instances of %s using %s "     \
-                             "in %6.3f seconds",                                     \
+                             "in %6.5f seconds",                                     \
                              N, #type, #allocator, total_time);                      \
   }
 
@@ -149,7 +148,7 @@
     time_elapsed = g_test_timer_elapsed ();                                           \
     g_test_minimized_result (time_elapsed,                                            \
                              "Allocated and free'd %u instances of mixed types "      \
-                             "(step: %s) using %s in %6.3f seconds",                  \
+                             "(step: %s) using %s in %6.5f seconds",                  \
                              N, #max_steps, #allocator, time_elapsed);                \
   }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]