[gjs: 4/5] build: Add support to Unity builds and add a CI job testing it




commit efb28b8c58051923baf2830a9531a5427b37924d
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Thu May 6 19:27:06 2021 +0200

    build: Add support to Unity builds and add a CI job testing it

 .gitlab-ci.yml                                        | 14 +++++++++++++-
 gjs/atoms.h                                           |  2 +-
 installed-tests/js/libgjstesttools/gjs-test-tools.cpp |  2 +-
 meson.build                                           |  1 +
 4 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 80f855d4..14d76d27 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -97,7 +97,7 @@ sanitizer_thread_gcc:
     - asan # TSAN needs CAP_SYS_PTRACE
   image: registry.gitlab.gnome.org/gnome/gjs:fedora.mozjs78-debug
   variables:
-    TASK_ID: "fedora-x86_64-gcc-default-ubsan_asan-check"
+    TASK_ID: "fedora-x86_64-gcc-default-ubsan_tsan-check"
     CONFIG_OPTS: -Db_sanitize=thread
     TEST_OPTS: --timeout-multiplier=2 --suite=thread-safe
   except:
@@ -135,6 +135,18 @@ build_minimal:
   except:
     - schedules
 
+build_unity:
+  <<: *build
+  stage: test
+  image: registry.gitlab.gnome.org/gnome/gjs:fedora.mozjs78
+  variables:
+    TASK_ID: "fedora-x86_64-gcc-default-unity-check"
+    CONFIG_OPTS: >-
+      -Dprofiler=disabled
+      --unity on --unity-size=10
+  except:
+    - schedules
+
 # Generates
 # The Code Coverage Report
 coverage-automatic:
diff --git a/gjs/atoms.h b/gjs/atoms.h
index 25c9904d..0a699965 100644
--- a/gjs/atoms.h
+++ b/gjs/atoms.h
@@ -115,7 +115,7 @@ class GjsAtoms {
 #undef DECLARE_SYMBOL_ATOM_MEMBER
 };
 
-#ifndef GJS_USE_ATOM_FOREACH
+#if !defined(GJS_USE_ATOM_FOREACH) && !defined(USE_UNITY_BUILD)
 #    undef FOR_EACH_ATOM
 #    undef FOR_EACH_SYMBOL_ATOM
 #endif
diff --git a/installed-tests/js/libgjstesttools/gjs-test-tools.cpp 
b/installed-tests/js/libgjstesttools/gjs-test-tools.cpp
index fad74a30..e52b6e66 100644
--- a/installed-tests/js/libgjstesttools/gjs-test-tools.cpp
+++ b/installed-tests/js/libgjstesttools/gjs-test-tools.cpp
@@ -215,7 +215,7 @@ void gjs_test_tools_run_dispose_other_thread(GObject* object, GError** error) {
         },
         object, error);
     // cppcheck-suppress leakNoVarFunctionCall
-    g_clear_pointer(&thread, g_thread_join);
+    g_thread_join(thread);
 }
 
 /**
diff --git a/meson.build b/meson.build
index d71c57a6..8d11ec84 100644
--- a/meson.build
+++ b/meson.build
@@ -303,6 +303,7 @@ if build_readline
         cxx.check_header('readline/readline.h', prefix: '#include <cstdio>',
             required: readline.found()))
 endif
+header_conf.set('USE_UNITY_BUILD', get_option('unity'))
 header_conf.set('HAVE_SYS_SYSCALL_H', cxx.check_header('sys/syscall.h'))
 header_conf.set('HAVE_UNISTD_H', cxx.check_header('unistd.h'))
 header_conf.set('HAVE_SIGNAL_H', cxx.check_header('signal.h',


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