Compare commits

...

30 Commits

Author SHA1 Message Date
Marco Trevisan
0ad8a7e09e Merge branch 'wip/3v1n0/ci-sanitizer-tests' into 'main'
Draft: CI: Add Memory and Thread Sanitizer jobs

Closes #3356

See merge request GNOME/glib!4062
2024-07-15 21:24:53 +00:00
Philip Withnall
d3cb9d638d Merge branch 'traverse-diagrams' into 'main'
docs(GNode): Traversal diagrams, color & dark-mode

See merge request GNOME/glib!4157
2024-07-15 15:58:45 +00:00
Philip Withnall
a931a75c4f docs(GNode): Traversal diagrams, color & dark-mode
* Create a dark-mode variant of each traversal diagram, with the
  traversal path colorized `--primary` blue, instead of the original
  black.
* Apply the same colorizations to the light-mode diagrams, but
  using the light-theme `--primary` blue.
* Add SPDX license/copyright comments to all eight SVG files.
* Add new files to documentation configs in `glib.toml.in`.
* Update documentation comment in `gnode.c` to embed both color
  variants via picture tags, instead of markdown image embeds.
* Add alt text to all four images.
* Add additional blank lines to documentation comment, so that
  a. First item in bulleted list does not get folded into
     preceding intro paragraph
  b. Intro paragraph and diagrams are not part of first paragraph
     in documentation. (This also gets them out of the top-level
     table-of-contents/index list, where they previously appeared
     in full.)
* (Accidental change I didn't realize I was making): Convert line
  endings in breadth-first diagram from CRLF to LF.
2024-07-15 15:58:45 +00:00
Marco Trevisan (Treviño)
165646473e gio/tests/gdbus-export: Ensure we call all the callbacks on return
Ensure we don't do an user-after-free access, as reported by ASAN:

  ==3704==ERROR: AddressSanitizer: stack-use-after-return on address
   0x70a58f8631c0 at pc 0x000000405144 bp 0x7fffff62c7a0 sp 0x7fffff62c798
   READ of size 4 at 0x70a58f8631c0 thread T0
    #0 0x405143 in on_object_unregistered ../../GNOME/glib/gio/tests/gdbus-export.c:597
    #1 0x70a592e858d8 in call_destroy_notify_data_in_idle ../../GNOME/glib/gio/gdbusconnection.c:244
    #2 0x70a5940016a4 in g_idle_dispatch ../../GNOME/glib/glib/gmain.c:6221
    #3 0x70a59401095b in g_main_dispatch ../../GNOME/glib/glib/gmain.c:3348
    #4 0x70a59401095b in g_main_context_dispatch_unlocked ../../GNOME/glib/glib/gmain.c:4197
    #5 0x70a59401ba17 in g_main_context_iterate_unlocked ../../GNOME/glib/glib/gmain.c:4262
    #6 0x70a59401cc73 in g_main_context_iteration ../../GNOME/glib/glib/gmain.c:4327
    #7 0x405658 in test_threaded_unregistration_iteration ../../GNOME/glib/gio/tests/gdbus-export.c:1878
    #8 0x405658 in test_threaded_unregistration ../../GNOME/glib/gio/tests/gdbus-export.c:1952
    #9 0x70a5940dfb04 in test_case_run ../../GNOME/glib/glib/gtestutils.c:2988
    #10 0x70a5940dfb04 in g_test_run_suite_internal ../../GNOME/glib/glib/gtestutils.c:3090
    #11 0x70a5940df893 in g_test_run_suite_internal ../../GNOME/glib/glib/gtestutils.c:3109
    #12 0x70a5940df893 in g_test_run_suite_internal ../../GNOME/glib/glib/gtestutils.c:3109
    #13 0x70a5940e0bc9 in g_test_run_suite ../../GNOME/glib/glib/gtestutils.c:3189
    #14 0x70a5940e0d1f in g_test_run ../../GNOME/glib/glib/gtestutils.c:2275
    #15 0x40eb72 in session_bus_run ../../GNOME/glib/gio/tests/gdbus-sessionbus.c:69
    #16 0x403a2c in main ../../GNOME/glib/gio/tests/gdbus-export.c:1990
    #17 0x70a591d9f149 in __libc_start_call_main (/lib64/libc.so.6+0x28149) (BuildId: 0d710e9d9dc10c500b8119c85da75004183618e2)
    #18 0x70a591d9f20a in __libc_start_main_impl (/lib64/libc.so.6+0x2820a) (BuildId: 0d710e9d9dc10c500b8119c85da75004183618e2)
    #19 0x403b44 in _start (/tmp/_build/gio/tests/gdbus-export+0x403b44) (BuildId: f6312e919c3d94e4c49270b0dfc5c870e1ba550b)

Address 0x70a58f8631c0 is located in stack of thread T0 at offset 192 in frame
    #0 0x40525f in test_threaded_unregistration ../../GNOME/glib/gio/tests/gdbus-export.c:1936

  This frame has 7 object(s):
    [32, 40) 'local_error' (line 1835)
    [64, 72) 'unregister_thread' (line 1836)
    [96, 104) 'value' (line 1838)
    [128, 136) 'value_str' (line 1839)
    [160, 168) 'call_result' (line 1840)
    [192, 204) 'object_registration_data' (line 1834) <== Memory access at offset 192 is inside this variable
    [224, 240) 'data' (line 1833)
2024-05-24 18:20:36 +02:00
Marco Trevisan (Treviño)
04e61e3427 gio/tests/gdbus-connection: Fix typo 2024-05-24 18:16:45 +02:00
Marco Trevisan (Treviño)
409deb0935 ci: Ignore lcov errors on source missing
When using dtrace some temporary files may be leaked as source files and
this may lead to build issues such as

  geninfo: ERROR: unable to open
    /builds/GNOME/glib/_build/.dtrace-temp.ed1c5ba9.c:
    No such file or directory

AFAIK there's no way to keep these temporary files around, so the only
thing we can do is making lcov less strict about missing files
2024-05-24 18:09:04 +02:00
Marco Trevisan (Treviño)
b55b83a5d3 ci: Add a thread sanitizer scheduled job
Fixes: https://gitlab.gnome.org/GNOME/glib/-/issues/3356
2024-05-24 17:29:22 +02:00
Marco Trevisan (Treviño)
5e03156639 build: Mark all the failing and flacky tests with thread sanitizer
Sadly many tests don't pass with thread sanitizer, but better to
mark them as such to try to fix them in the future

See also: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
2024-05-24 17:29:22 +02:00
Marco Trevisan (Treviño)
0df50bb32e glib/glib-private: Mark the dynamic LSAN checks as unlikely
It's not normal to run programs with leak sanitizer enabled, so let's
mark those checks as such, in case the compiler can optimize them
2024-05-24 17:29:22 +02:00
Marco Trevisan (Treviño)
57a90fa4bc gcharset: Mark cached data as known leak
The charset data is never freed but it's something stored per thread
so we can safely ignore the leak
2024-05-24 17:29:22 +02:00
Marco Trevisan (Treviño)
468160f387 gthread: Mark data allocated with g_private_set_alloc0 as leaking
This is what we already ignored with valgrind and it's something that
we should always ignore since it's leaked by design.

So do explicitly mark it as such.
2024-05-24 17:29:22 +02:00
Marco Trevisan (Treviño)
e643126281 girepository/tests: Add tests for basic inspector operations
We don't really check the behavior here, but we do want to perform
memory tests when using sanitizers
2024-05-24 17:26:56 +02:00
Marco Trevisan (Treviño)
4689be71ea girepository/tests: Add tests for the compiler when using sanitizers
When using sanitizers we want to be able to test the compiler memory
management, so let's add some explicit tests for that.
2024-05-24 17:18:40 +02:00
Marco Trevisan (Treviño)
319c57219f girepository/tests: Add tests on compiler open/write failures 2024-05-24 17:04:07 +02:00
Marco Trevisan (Treviño)
7c9a604eb2 girepository/parser: Clarify ownership of nodetype nodes
We may had free'd a list of items without freeing the items in there.
So now, properly steal the data instead and free everything.
2024-05-24 17:01:25 +02:00
Marco Trevisan (Treviño)
bfb62e9095 girepository/compiler: Cleanup the parser error on failure 2024-05-24 17:00:33 +02:00
Marco Trevisan (Treviño)
debbf9d2d9 girepository/compiler: Cleanup the parser on write failures 2024-05-24 17:00:20 +02:00
Marco Trevisan (Treviño)
fb5a50900e girepository: Disable ASAN when building our typelib
We don't care about memory issues during this phase while we should test
this separately
2024-05-24 15:30:42 +02:00
Marco Trevisan (Treviño)
5ca20f7dc0 girepository: Always use currently built GLib to run g-ir-scanner
If we use the system libraries we can't really debug it, so ensure we're
using the currently built libraries for it too.

We're doing it globally to ensure that we're testing the result that
this version of the libraries are building
2024-05-24 15:27:53 +02:00
Marco Trevisan (Treviño)
5d607e148e ci: Add ASAN sanitizer job that runs on schedules
In this job we also want to test that just running `meson test` just
works without having to build the test dependencies manually

Helps: https://gitlab.gnome.org/GNOME/glib/-/issues/3356
2024-05-24 13:27:15 +02:00
Marco Trevisan (Treviño)
36ad38062b ci/fedora.Dockerfile: Add libtsan depedencies
It's needed for thread sanitizer tests
2024-05-23 19:34:21 +02:00
Marco Trevisan (Treviño)
80e747c170 ci/fedora.Dockerfile: Add libasan and libubsan depedencies
They allow address sanitizer tests
2024-05-23 19:34:21 +02:00
Marco Trevisan (Treviño)
78701e91ac gio/gsocket: Ignore GCancellableSource leak
As per issue #2309 the cancellable source may not be ever released,
making this code to fail in address sanitizer, so mark the location as a
leaking one to prevent tests using it to fail
2024-05-23 19:34:21 +02:00
Marco Trevisan (Treviño)
e07f8a807a meson: Preload sanitizer libraries before than any other library
In some test cases (but not only) GLib needs to preload libraries when
launching executables, however this doesn't work well with ASAN because
libasan needs to be the first library to be loaded in such case.

We've been ignoring the error so far, using verify_asan_link_order=false
ASAN option, but this is not the correct way because it implies that
we don't check any pre-loaded library, as we instead should.

So in the platforms we know, get the proper sanitizer libraries paths
and pre-load them when required.

We don't do it for installed tests since the full paths may change in
the target system, so ignoring the error is safer.

This meson code has been used for various years now in fprintd project
to run tests in CI in both fedora and debian-based systems with no
issues, so I consider it reliable.

In case no preload variables are found the default ignore mode is used
2024-05-23 19:34:21 +02:00
Marco Trevisan (Treviño)
8a9e510d4c build/tests: Automatically set ASAN_OPTIONS if preloading is required
If preloading a library is required asan doesn't work properly because
it requires to be the first loaded library to test everything, however
the behavior can be worked around using an ASAN_OPTIONS variable, so do
this to prevent the tests to fail completely

But instead of having to do it at test level, manage this at wider scope
2024-05-23 18:53:46 +02:00
Marco Trevisan (Treviño)
ab2e68cf75 build: Define the preload variable name and separator globally
We may need this in multiple tests, so let's share the value
2024-05-23 18:53:45 +02:00
Marco Trevisan (Treviño)
0e97aade66 build: Add quotes to installed test variables
The value may contain spaces, so we need to quote them or we may
consider values as arguments
2024-05-22 19:18:24 +02:00
Marco Trevisan (Treviño)
e59f777a80 gio/tests/gsocketclient-slow: Do not hard code the pre-loaded library name
Get the values from meson instead of doing all this manually
2024-05-22 19:18:24 +02:00
Marco Trevisan (Treviño)
419e5b971b glib, gio tests: Apply the same rules to both gcc and clang when appropriate 2024-05-22 19:18:24 +02:00
Marco Trevisan (Treviño)
0dec04c504 build: Add variable to check if a GNU C compiler is used
This applies to both gcc and clang, without having to repeat the same
check multiple times and involving strings
2024-05-22 19:18:24 +02:00
28 changed files with 3301 additions and 313 deletions

View File

@ -11,7 +11,7 @@ cache:
- _ccache/
variables:
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/glib/fedora:v27"
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/glib/fedora:v28"
COVERITY_IMAGE: "registry.gitlab.gnome.org/gnome/glib/coverity:v7"
DEBIAN_IMAGE: "registry.gitlab.gnome.org/gnome/glib/debian-stable:v19"
ALPINE_IMAGE: "registry.gitlab.gnome.org/gnome/glib/alpine:v3"
@ -194,9 +194,9 @@ fedora-x86_64:
_build
- meson compile -C _build
- mkdir -p _coverage
- lcov --config-file .lcovrc --directory _build --capture --initial --output-file "_coverage/${CI_JOB_NAME}-baseline.lcov"
- lcov --config-file .lcovrc --directory _build --capture --initial --ignore-errors source --output-file "_coverage/${CI_JOB_NAME}-baseline.lcov"
- .gitlab-ci/run-tests.sh
- lcov --config-file .lcovrc --directory _build --capture --output-file "_coverage/${CI_JOB_NAME}.lcov"
- lcov --config-file .lcovrc --directory _build --capture --ignore-errors source --output-file "_coverage/${CI_JOB_NAME}.lcov"
# Copy the built documentation to an artifact directory. The build for docs.gtk.org
# can then pull it from there — see https://gitlab.gnome.org/GNOME/gtk/-/blob/docs-gtk-org/README.md
- mkdir -p _reference/
@ -443,6 +443,80 @@ valgrind:
- "_build/glib/glibconfig.h"
- "_build/meson-logs"
address-sanitizer:
extends:
- .build-linux
- .only-schedules-or-manual
- .with-git
image: $FEDORA_IMAGE
stage: analysis
tags: [asan]
needs: []
variables:
MESON_TEST_TIMEOUT_MULTIPLIER: 5
before_script:
- !reference [".build-linux", "before_script"]
- !reference [".with-git", "before_script"]
script:
- meson setup ${MESON_COMMON_OPTIONS}
--werror
-Dsystemtap=enabled
-Ddtrace=enabled
-Dinstalled_tests=true
-Dintrospection=enabled
-Db_sanitize=address,undefined
_build
# Do not run ninja, let meson handle the build dependencies!
# This tests that all tests have the right build dependencies specified.
- bash -x ./.gitlab-ci/run-tests.sh
artifacts:
reports:
junit: "_build/meson-logs/testlog.junit.xml"
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
paths:
- "_build/config.h"
- "_build/glib/glibconfig.h"
- "_build/meson-logs"
thread-sanitizer:
extends:
- .build-linux
- .only-schedules-or-manual
- .with-git
image: $FEDORA_IMAGE
stage: analysis
tags: [asan]
needs: []
variables:
MESON_TEST_TIMEOUT_MULTIPLIER: 10
before_script:
- !reference [".build-linux", "before_script"]
- !reference [".with-git", "before_script"]
script:
- meson setup ${MESON_COMMON_OPTIONS}
--werror
-Dsystemtap=enabled
-Ddtrace=enabled
-Dinstalled_tests=true
-Dintrospection=enabled
-Db_sanitize=thread
_build
# Do not run ninja, let meson handle the build dependencies!
# This tests that all tests have the right build dependencies specified.
- bash -x ./.gitlab-ci/run-tests.sh --no-suite=no-tsan
artifacts:
reports:
junit: "_build/meson-logs/testlog.junit.xml"
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
paths:
- "_build/config.h"
- "_build/glib/glibconfig.h"
- "_build/meson-logs"
.cross-build-linux:
extends: .build-linux
stage: build

View File

@ -40,10 +40,13 @@ RUN dnf -y update \
gtk-doc \
itstool \
lcov \
libasan \
libattr-devel \
libffi-devel \
libmount-devel \
libselinux-devel \
libtsan \
libubsan \
libxslt \
ncurses-compat-libs \
ninja-build \

View File

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-License-Identifier: CC0-1.0
SPDX-FileCopyrightText: Rory O'Kane at Wikimedia Commons
<https://commons.wikimedia.org/wiki/File:Sorted_binary_tree_breadth-first_traversal.svg>
SPDX-FileCopyrightText: 2024 Frank Dana
-->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="266px" height="212px" viewBox="0 0 266 212" enable-background="new 0 0 266 212" xml:space="preserve">
<g>
<g>
<line fill="none" stroke="#90c2ff" stroke-width="2" stroke-miterlimit="10" x1="27.23" y1="23.192" x2="29.23" y2="23.192"/>
<line fill="none" stroke="#90c2ff" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="3.9562,3.9562" x1="33.187" y1="23.192" x2="236.932" y2="23.192"/>
<polyline fill="none" stroke="#90c2ff" stroke-width="2" stroke-miterlimit="10" points="238.91,23.192 240.91,23.192
238.97,23.677 "/>
<line fill="none" stroke="#90c2ff" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="3.9907,3.9907" x1="235.099" y1="24.646" x2="27.971" y2="76.427"/>
<polyline fill="none" stroke="#90c2ff" stroke-width="2" stroke-miterlimit="10" points="26.035,76.912 24.095,77.396
26.095,77.396 "/>
<line fill="none" stroke="#90c2ff" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="4.0154,4.0154" x1="30.11" y1="77.396" x2="236.902" y2="77.396"/>
<polyline fill="none" stroke="#90c2ff" stroke-width="2" stroke-miterlimit="10" points="238.91,77.396 240.91,77.396
238.97,77.881 "/>
<line fill="none" stroke="#90c2ff" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="3.9907,3.9907" x1="235.099" y1="78.85" x2="27.971" y2="130.631"/>
<polyline fill="none" stroke="#90c2ff" stroke-width="2" stroke-miterlimit="10" points="26.035,131.114 24.095,131.6
26.095,131.6 "/>
<line fill="none" stroke="#90c2ff" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="4.0154,4.0154" x1="30.11" y1="131.6" x2="236.902" y2="131.6"/>
<polyline fill="none" stroke="#90c2ff" stroke-width="2" stroke-miterlimit="10" points="238.91,131.6 240.91,131.6
238.97,132.085 "/>
<line fill="none" stroke="#90c2ff" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="3.9907,3.9907" x1="235.099" y1="133.053" x2="27.971" y2="184.835"/>
<polyline fill="none" stroke="#90c2ff" stroke-width="2" stroke-miterlimit="10" points="26.035,185.318 24.095,185.804
26.095,185.804 "/>
<line fill="none" stroke="#90c2ff" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="4.0086,4.0086" x1="30.104" y1="185.804" x2="228.53" y2="185.804"/>
<line fill="none" stroke="#90c2ff" stroke-width="2" stroke-miterlimit="10" x1="230.534" y1="185.804" x2="232.534" y2="185.804"/>
<g>
<rect fill="#90c2ff" x="24.095" y="19.892" width="6.602" height="6.602"/>
</g>
<g>
<path fill="#90c2ff" d="M238.569,185.804c-2.84,1.054-6.363,2.852-8.548,4.756l1.721-4.756l-1.721-4.755
C232.206,182.953,235.729,184.751,238.569,185.804z"/>
</g>
</g>
</g>
<g id="graph0">
<title>sorted_binary_tree</title>
<g id="node1">
<title>C</title>
<ellipse fill="#FFFFFF" stroke="#ffffff" cx="60.23" cy="185.804" rx="18.067" ry="18.067"/>
<text transform="matrix(1 0 0 1 55.5435 190.8223)" font-family="'Times-Roman'" font-size="14.0528">C</text>
</g>
<g id="node2">
<title>E</title>
<ellipse fill="#FFFFFF" stroke="#ffffff" cx="132.502" cy="185.804" rx="18.067" ry="18.067"/>
<text transform="matrix(1 0 0 1 128.21 190.8223)" font-family="'Times-Roman'" font-size="14.0528">E</text>
</g>
<g id="node3">
<title>H</title>
<ellipse fill="#FFFFFF" stroke="#ffffff" cx="204.773" cy="185.804" rx="17.064" ry="18.067"/>
<text transform="matrix(1 0 0 1 199.6992 190.8223)" font-family="'Times-Roman'" font-size="14.0528">H</text>
</g>
<g id="node4">
<title>A</title>
<ellipse fill="#FFFFFF" stroke="#ffffff" cx="24.094" cy="131.6" rx="17.064" ry="18.068"/>
<text transform="matrix(1 0 0 1 19.02 136.6191)" font-family="'Times-Roman'" font-size="14.0528">A</text>
</g>
<g id="node5">
<title>D</title>
<ellipse fill="#FFFFFF" stroke="#ffffff" cx="96.366" cy="131.6" rx="17.064" ry="18.068"/>
<text transform="matrix(1 0 0 1 91.292 136.6191)" font-family="'Times-Roman'" font-size="14.0528">D</text>
</g>
<g id="edge6">
<title>D-&gt;C</title>
<path fill="none" stroke="#ffffff" d="M86.328,147.66c-3.011,4.016-7.026,9.034-10.038,14.053"/>
<polygon fill="#ffffff" stroke="#ffffff" points="78.298,164.725 70.268,170.747 73.279,160.709 "/>
</g>
<g id="edge8">
<title>D-&gt;E</title>
<path fill="none" stroke="#ffffff" d="M106.404,147.66c3.011,4.016,7.026,9.034,10.038,14.053"/>
<polygon fill="#ffffff" stroke="#ffffff" points="119.453,160.709 122.464,170.747 114.434,164.725 "/>
</g>
<g id="node6">
<title>I</title>
<ellipse fill="#FFFFFF" stroke="#ffffff" cx="240.909" cy="131.6" rx="18.068" ry="18.068"/>
<text transform="matrix(1 0 0 1 238.5693 136.6191)" font-family="'Times-Roman'" font-size="14.0528">I</text>
</g>
<g id="edge12">
<title>I-&gt;H</title>
<path fill="none" stroke="#ffffff" d="M230.871,146.656c-3.011,5.02-6.021,10.038-10.037,15.057"/>
<polygon fill="#ffffff" stroke="#ffffff" points="223.846,163.721 214.812,169.743 217.822,159.705 "/>
</g>
<g id="node7">
<title>B</title>
<ellipse fill="#FFFFFF" stroke="#ffffff" cx="60.23" cy="77.396" rx="18.068" ry="18.068"/>
<text transform="matrix(1 0 0 1 55.5435 82.415)" font-family="'Times-Roman'" font-size="14.0528">B</text>
</g>
<g id="edge3">
<title>B-&gt;A</title>
<path fill="none" stroke="#ffffff" d="M50.192,92.453c-3.011,5.019-6.022,10.038-10.038,15.057"/>
<polygon fill="#ffffff" stroke="#ffffff" points="43.166,109.518 34.132,115.539 37.144,105.502 "/>
</g>
<g id="edge5">
<title>B-&gt;D</title>
<path fill="none" stroke="#ffffff" d="M70.268,92.453c3.011,5.019,6.022,10.038,10.038,15.057"/>
<polygon fill="#ffffff" stroke="#ffffff" points="83.317,105.502 86.328,115.539 77.294,109.518 "/>
</g>
<g id="node8">
<title>G</title>
<ellipse fill="#FFFFFF" stroke="#ffffff" cx="204.773" cy="77.396" rx="17.064" ry="18.068"/>
<text transform="matrix(1 0 0 1 199.6992 82.415)" font-family="'Times-Roman'" font-size="14.0528">G</text>
</g>
<g id="edge11">
<title>G-&gt;I</title>
<path fill="none" stroke="#ffffff" d="M214.812,93.457c3.011,4.015,7.026,9.034,10.038,14.053"/>
<polygon fill="#ffffff" stroke="#ffffff" points="227.86,106.506 230.871,116.543 222.842,110.521 "/>
</g>
<g id="node9">
<title>F</title>
<ellipse fill="#FFFFFF" stroke="#ffffff" cx="132.502" cy="23.192" rx="18.068" ry="18.068"/>
<text transform="matrix(1 0 0 1 128.5942 28.2109)" font-family="'Times-Roman'" font-size="14.0528">F</text>
</g>
<g id="edge2">
<title>F-&gt;B</title>
<path fill="none" stroke="#ffffff" d="M117.445,34.234c-11.042,8.03-23.087,17.064-34.128,26.098"/>
<polygon fill="#ffffff" stroke="#ffffff" points="85.325,63.343 75.287,66.354 81.31,57.321 "/>
</g>
<g id="edge10">
<title>F-&gt;G</title>
<path fill="none" stroke="#ffffff" d="M147.559,34.234c11.041,8.03,23.087,17.064,34.129,26.098"/>
<polygon fill="#ffffff" stroke="#ffffff" points="183.694,57.321 189.717,66.354 179.68,63.343 "/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

@ -1,134 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="266px" height="212px" viewBox="0 0 266 212" enable-background="new 0 0 266 212" xml:space="preserve">
<g>
<g>
<line fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" x1="27.23" y1="23.192" x2="29.23" y2="23.192"/>
<line fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="3.9562,3.9562" x1="33.187" y1="23.192" x2="236.932" y2="23.192"/>
<polyline fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" points="238.91,23.192 240.91,23.192
238.97,23.677 "/>
<line fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="3.9907,3.9907" x1="235.099" y1="24.646" x2="27.971" y2="76.427"/>
<polyline fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" points="26.035,76.912 24.095,77.396
26.095,77.396 "/>
<line fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="4.0154,4.0154" x1="30.11" y1="77.396" x2="236.902" y2="77.396"/>
<polyline fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" points="238.91,77.396 240.91,77.396
238.97,77.881 "/>
<line fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="3.9907,3.9907" x1="235.099" y1="78.85" x2="27.971" y2="130.631"/>
<polyline fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" points="26.035,131.114 24.095,131.6
26.095,131.6 "/>
<line fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="4.0154,4.0154" x1="30.11" y1="131.6" x2="236.902" y2="131.6"/>
<polyline fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" points="238.91,131.6 240.91,131.6
238.97,132.085 "/>
<line fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="3.9907,3.9907" x1="235.099" y1="133.053" x2="27.971" y2="184.835"/>
<polyline fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" points="26.035,185.318 24.095,185.804
26.095,185.804 "/>
<line fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="4.0086,4.0086" x1="30.104" y1="185.804" x2="228.53" y2="185.804"/>
<line fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" x1="230.534" y1="185.804" x2="232.534" y2="185.804"/>
<g>
<rect x="24.095" y="19.892" width="6.602" height="6.602"/>
</g>
<g>
<path d="M238.569,185.804c-2.84,1.054-6.363,2.852-8.548,4.756l1.721-4.756l-1.721-4.755
C232.206,182.953,235.729,184.751,238.569,185.804z"/>
</g>
</g>
</g>
<g id="graph0">
<title>sorted_binary_tree</title>
<g id="node1">
<title>C</title>
<ellipse fill="#FFFFFF" stroke="#000000" cx="60.23" cy="185.804" rx="18.067" ry="18.067"/>
<text transform="matrix(1 0 0 1 55.5435 190.8223)" font-family="'Times-Roman'" font-size="14.0528">C</text>
</g>
<g id="node2">
<title>E</title>
<ellipse fill="#FFFFFF" stroke="#000000" cx="132.502" cy="185.804" rx="18.067" ry="18.067"/>
<text transform="matrix(1 0 0 1 128.21 190.8223)" font-family="'Times-Roman'" font-size="14.0528">E</text>
</g>
<g id="node3">
<title>H</title>
<ellipse fill="#FFFFFF" stroke="#000000" cx="204.773" cy="185.804" rx="17.064" ry="18.067"/>
<text transform="matrix(1 0 0 1 199.6992 190.8223)" font-family="'Times-Roman'" font-size="14.0528">H</text>
</g>
<g id="node4">
<title>A</title>
<ellipse fill="#FFFFFF" stroke="#000000" cx="24.094" cy="131.6" rx="17.064" ry="18.068"/>
<text transform="matrix(1 0 0 1 19.02 136.6191)" font-family="'Times-Roman'" font-size="14.0528">A</text>
</g>
<g id="node5">
<title>D</title>
<ellipse fill="#FFFFFF" stroke="#000000" cx="96.366" cy="131.6" rx="17.064" ry="18.068"/>
<text transform="matrix(1 0 0 1 91.292 136.6191)" font-family="'Times-Roman'" font-size="14.0528">D</text>
</g>
<g id="edge6">
<title>D-&gt;C</title>
<path fill="none" stroke="#000000" d="M86.328,147.66c-3.011,4.016-7.026,9.034-10.038,14.053"/>
<polygon stroke="#000000" points="78.298,164.725 70.268,170.747 73.279,160.709 "/>
</g>
<g id="edge8">
<title>D-&gt;E</title>
<path fill="none" stroke="#000000" d="M106.404,147.66c3.011,4.016,7.026,9.034,10.038,14.053"/>
<polygon stroke="#000000" points="119.453,160.709 122.464,170.747 114.434,164.725 "/>
</g>
<g id="node6">
<title>I</title>
<ellipse fill="#FFFFFF" stroke="#000000" cx="240.909" cy="131.6" rx="18.068" ry="18.068"/>
<text transform="matrix(1 0 0 1 238.5693 136.6191)" font-family="'Times-Roman'" font-size="14.0528">I</text>
</g>
<g id="edge12">
<title>I-&gt;H</title>
<path fill="none" stroke="#000000" d="M230.871,146.656c-3.011,5.02-6.021,10.038-10.037,15.057"/>
<polygon stroke="#000000" points="223.846,163.721 214.812,169.743 217.822,159.705 "/>
</g>
<g id="node7">
<title>B</title>
<ellipse fill="#FFFFFF" stroke="#000000" cx="60.23" cy="77.396" rx="18.068" ry="18.068"/>
<text transform="matrix(1 0 0 1 55.5435 82.415)" font-family="'Times-Roman'" font-size="14.0528">B</text>
</g>
<g id="edge3">
<title>B-&gt;A</title>
<path fill="none" stroke="#000000" d="M50.192,92.453c-3.011,5.019-6.022,10.038-10.038,15.057"/>
<polygon stroke="#000000" points="43.166,109.518 34.132,115.539 37.144,105.502 "/>
</g>
<g id="edge5">
<title>B-&gt;D</title>
<path fill="none" stroke="#000000" d="M70.268,92.453c3.011,5.019,6.022,10.038,10.038,15.057"/>
<polygon stroke="#000000" points="83.317,105.502 86.328,115.539 77.294,109.518 "/>
</g>
<g id="node8">
<title>G</title>
<ellipse fill="#FFFFFF" stroke="#000000" cx="204.773" cy="77.396" rx="17.064" ry="18.068"/>
<text transform="matrix(1 0 0 1 199.6992 82.415)" font-family="'Times-Roman'" font-size="14.0528">G</text>
</g>
<g id="edge11">
<title>G-&gt;I</title>
<path fill="none" stroke="#000000" d="M214.812,93.457c3.011,4.015,7.026,9.034,10.038,14.053"/>
<polygon stroke="#000000" points="227.86,106.506 230.871,116.543 222.842,110.521 "/>
</g>
<g id="node9">
<title>F</title>
<ellipse fill="#FFFFFF" stroke="#000000" cx="132.502" cy="23.192" rx="18.068" ry="18.068"/>
<text transform="matrix(1 0 0 1 128.5942 28.2109)" font-family="'Times-Roman'" font-size="14.0528">F</text>
</g>
<g id="edge2">
<title>F-&gt;B</title>
<path fill="none" stroke="#000000" d="M117.445,34.234c-11.042,8.03-23.087,17.064-34.128,26.098"/>
<polygon stroke="#000000" points="85.325,63.343 75.287,66.354 81.31,57.321 "/>
</g>
<g id="edge10">
<title>F-&gt;G</title>
<path fill="none" stroke="#000000" d="M147.559,34.234c11.041,8.03,23.087,17.064,34.129,26.098"/>
<polygon stroke="#000000" points="183.694,57.321 189.717,66.354 179.68,63.343 "/>
</g>
</g>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-License-Identifier: CC0-1.0
SPDX-FileCopyrightText: Rory O'Kane at Wikimedia Commons
<https://commons.wikimedia.org/wiki/File:Sorted_binary_tree_breadth-first_traversal.svg>
SPDX-FileCopyrightText: 2024 Frank Dana
-->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="266px" height="212px" viewBox="0 0 266 212" enable-background="new 0 0 266 212" xml:space="preserve">
<g>
<g>
<line fill="none" stroke="#1c76e4" stroke-width="2" stroke-miterlimit="10" x1="27.23" y1="23.192" x2="29.23" y2="23.192"/>
<line fill="none" stroke="#1c76e4" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="3.9562,3.9562" x1="33.187" y1="23.192" x2="236.932" y2="23.192"/>
<polyline fill="none" stroke="#1c76e4" stroke-width="2" stroke-miterlimit="10" points="238.91,23.192 240.91,23.192
238.97,23.677 "/>
<line fill="none" stroke="#1c76e4" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="3.9907,3.9907" x1="235.099" y1="24.646" x2="27.971" y2="76.427"/>
<polyline fill="none" stroke="#1c76e4" stroke-width="2" stroke-miterlimit="10" points="26.035,76.912 24.095,77.396
26.095,77.396 "/>
<line fill="none" stroke="#1c76e4" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="4.0154,4.0154" x1="30.11" y1="77.396" x2="236.902" y2="77.396"/>
<polyline fill="none" stroke="#1c76e4" stroke-width="2" stroke-miterlimit="10" points="238.91,77.396 240.91,77.396
238.97,77.881 "/>
<line fill="none" stroke="#1c76e4" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="3.9907,3.9907" x1="235.099" y1="78.85" x2="27.971" y2="130.631"/>
<polyline fill="none" stroke="#1c76e4" stroke-width="2" stroke-miterlimit="10" points="26.035,131.114 24.095,131.6
26.095,131.6 "/>
<line fill="none" stroke="#1c76e4" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="4.0154,4.0154" x1="30.11" y1="131.6" x2="236.902" y2="131.6"/>
<polyline fill="none" stroke="#1c76e4" stroke-width="2" stroke-miterlimit="10" points="238.91,131.6 240.91,131.6
238.97,132.085 "/>
<line fill="none" stroke="#1c76e4" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="3.9907,3.9907" x1="235.099" y1="133.053" x2="27.971" y2="184.835"/>
<polyline fill="none" stroke="#1c76e4" stroke-width="2" stroke-miterlimit="10" points="26.035,185.318 24.095,185.804
26.095,185.804 "/>
<line fill="none" stroke="#1c76e4" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="4.0086,4.0086" x1="30.104" y1="185.804" x2="228.53" y2="185.804"/>
<line fill="none" stroke="#1c76e4" stroke-width="2" stroke-miterlimit="10" x1="230.534" y1="185.804" x2="232.534" y2="185.804"/>
<g>
<rect fill="#1c76e4" x="24.095" y="19.892" width="6.602" height="6.602"/>
</g>
<g>
<path fill="#1c76e4" d="M238.569,185.804c-2.84,1.054-6.363,2.852-8.548,4.756l1.721-4.756l-1.721-4.755
C232.206,182.953,235.729,184.751,238.569,185.804z"/>
</g>
</g>
</g>
<g id="graph0">
<title>sorted_binary_tree</title>
<g id="node1">
<title>C</title>
<ellipse fill="#FFFFFF" stroke="#000000" cx="60.23" cy="185.804" rx="18.067" ry="18.067"/>
<text transform="matrix(1 0 0 1 55.5435 190.8223)" font-family="'Times-Roman'" font-size="14.0528">C</text>
</g>
<g id="node2">
<title>E</title>
<ellipse fill="#FFFFFF" stroke="#000000" cx="132.502" cy="185.804" rx="18.067" ry="18.067"/>
<text transform="matrix(1 0 0 1 128.21 190.8223)" font-family="'Times-Roman'" font-size="14.0528">E</text>
</g>
<g id="node3">
<title>H</title>
<ellipse fill="#FFFFFF" stroke="#000000" cx="204.773" cy="185.804" rx="17.064" ry="18.067"/>
<text transform="matrix(1 0 0 1 199.6992 190.8223)" font-family="'Times-Roman'" font-size="14.0528">H</text>
</g>
<g id="node4">
<title>A</title>
<ellipse fill="#FFFFFF" stroke="#000000" cx="24.094" cy="131.6" rx="17.064" ry="18.068"/>
<text transform="matrix(1 0 0 1 19.02 136.6191)" font-family="'Times-Roman'" font-size="14.0528">A</text>
</g>
<g id="node5">
<title>D</title>
<ellipse fill="#FFFFFF" stroke="#000000" cx="96.366" cy="131.6" rx="17.064" ry="18.068"/>
<text transform="matrix(1 0 0 1 91.292 136.6191)" font-family="'Times-Roman'" font-size="14.0528">D</text>
</g>
<g id="edge6">
<title>D-&gt;C</title>
<path fill="none" stroke="#000000" d="M86.328,147.66c-3.011,4.016-7.026,9.034-10.038,14.053"/>
<polygon stroke="#000000" points="78.298,164.725 70.268,170.747 73.279,160.709 "/>
</g>
<g id="edge8">
<title>D-&gt;E</title>
<path fill="none" stroke="#000000" d="M106.404,147.66c3.011,4.016,7.026,9.034,10.038,14.053"/>
<polygon stroke="#000000" points="119.453,160.709 122.464,170.747 114.434,164.725 "/>
</g>
<g id="node6">
<title>I</title>
<ellipse fill="#FFFFFF" stroke="#000000" cx="240.909" cy="131.6" rx="18.068" ry="18.068"/>
<text transform="matrix(1 0 0 1 238.5693 136.6191)" font-family="'Times-Roman'" font-size="14.0528">I</text>
</g>
<g id="edge12">
<title>I-&gt;H</title>
<path fill="none" stroke="#000000" d="M230.871,146.656c-3.011,5.02-6.021,10.038-10.037,15.057"/>
<polygon stroke="#000000" points="223.846,163.721 214.812,169.743 217.822,159.705 "/>
</g>
<g id="node7">
<title>B</title>
<ellipse fill="#FFFFFF" stroke="#000000" cx="60.23" cy="77.396" rx="18.068" ry="18.068"/>
<text transform="matrix(1 0 0 1 55.5435 82.415)" font-family="'Times-Roman'" font-size="14.0528">B</text>
</g>
<g id="edge3">
<title>B-&gt;A</title>
<path fill="none" stroke="#000000" d="M50.192,92.453c-3.011,5.019-6.022,10.038-10.038,15.057"/>
<polygon stroke="#000000" points="43.166,109.518 34.132,115.539 37.144,105.502 "/>
</g>
<g id="edge5">
<title>B-&gt;D</title>
<path fill="none" stroke="#000000" d="M70.268,92.453c3.011,5.019,6.022,10.038,10.038,15.057"/>
<polygon stroke="#000000" points="83.317,105.502 86.328,115.539 77.294,109.518 "/>
</g>
<g id="node8">
<title>G</title>
<ellipse fill="#FFFFFF" stroke="#000000" cx="204.773" cy="77.396" rx="17.064" ry="18.068"/>
<text transform="matrix(1 0 0 1 199.6992 82.415)" font-family="'Times-Roman'" font-size="14.0528">G</text>
</g>
<g id="edge11">
<title>G-&gt;I</title>
<path fill="none" stroke="#000000" d="M214.812,93.457c3.011,4.015,7.026,9.034,10.038,14.053"/>
<polygon stroke="#000000" points="227.86,106.506 230.871,116.543 222.842,110.521 "/>
</g>
<g id="node9">
<title>F</title>
<ellipse fill="#FFFFFF" stroke="#000000" cx="132.502" cy="23.192" rx="18.068" ry="18.068"/>
<text transform="matrix(1 0 0 1 128.5942 28.2109)" font-family="'Times-Roman'" font-size="14.0528">F</text>
</g>
<g id="edge2">
<title>F-&gt;B</title>
<path fill="none" stroke="#000000" d="M117.445,34.234c-11.042,8.03-23.087,17.064-34.128,26.098"/>
<polygon stroke="#000000" points="85.325,63.343 75.287,66.354 81.31,57.321 "/>
</g>
<g id="edge10">
<title>F-&gt;G</title>
<path fill="none" stroke="#000000" d="M147.559,34.234c11.041,8.03,23.087,17.064,34.129,26.098"/>
<polygon stroke="#000000" points="183.694,57.321 189.717,66.354 179.68,63.343 "/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 36 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 36 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 36 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -99,6 +99,10 @@ content_images = [
"Sorted_binary_tree_inorder.svg",
"Sorted_binary_tree_postorder.svg",
"Sorted_binary_tree_preorder.svg",
"Sorted_binary_tree_breadth-first_traversal-dark.svg",
"Sorted_binary_tree_inorder-dark.svg",
"Sorted_binary_tree_postorder-dark.svg",
"Sorted_binary_tree_preorder-dark.svg",
]
[[object]]

View File

@ -30,6 +30,7 @@
#include "config.h"
#include "gsocket.h"
#include "glib-private.h"
#ifdef G_OS_UNIX
#include "glib-unix.h"
@ -4369,6 +4370,10 @@ socket_source_new (GSocket *socket,
GSource *cancellable_source;
cancellable_source = g_cancellable_source_new (cancellable);
/* FIXME: The cancellable source may not be ever released, see:
* - https://gitlab.gnome.org/GNOME/glib/-/issues/2309
*/
g_ignore_leak (cancellable_source);
g_source_add_child_source (source, cancellable_source);
g_source_set_dummy_callback (cancellable_source);
g_source_unref (cancellable_source);

View File

@ -539,7 +539,7 @@ test_connection_signal_handler (GDBusConnection *connection,
/* We defer quitting to a G_PRIORITY_DEFAULT_IDLE function so other queued signal
* callbacks have a chance to run first. They get dispatched with a higher priority
* of G_PIORITY_DEFAULT, so as long as the queue is non-empty g_main_loop_quit won't
* of G_PRIORITY_DEFAULT, so as long as the queue is non-empty g_main_loop_quit won't
* run
*/
g_idle_add_once ((GSourceOnceFunc) g_main_loop_quit, loop);

View File

@ -1928,6 +1928,17 @@ test_threaded_unregistration_iteration (gboolean subtree)
g_clear_object (&call_result);
g_clear_object (&data.connection);
/* We defer quitting to a G_PRIORITY_DEFAULT_IDLE function so other queued
* signal callbacks have a chance to run first.
* In particular we want to ensure that all calls to on_object_unregistered()
* are delivered here before we end this function, so that there won't be any
* invalid stack access.
* They get dispatched with a higher priority (G_PRIORITY_DEFAULT), so as
* long as the queue is non-empty g_main_loop_quit won't run
*/
g_idle_add_once ((GSourceOnceFunc) g_main_loop_quit, loop);
g_main_loop_run (loop);
return unregistration_was_first;
}

View File

@ -52,14 +52,19 @@ gio_tests = {
'appmonitor' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/3148
'can_fail' : host_system in ['darwin', 'gnu'],
'can_fail' : host_system in ['darwin', 'gnu'] or
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'thread' in glib_sanitizers,
},
'async-close-output-stream' : {},
'async-splice-output-stream' : {},
'buffered-input-stream' : {},
'buffered-output-stream' : {},
'cancellable' : {},
'contexts' : {},
'contexts' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'contenttype' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392 / https://gitlab.gnome.org/GNOME/glib/-/issues/1251
'can_fail' : host_system == 'darwin',
@ -77,19 +82,24 @@ gio_tests = {
'error': {},
'file-thumbnail' : {},
'fileattributematcher' : {},
'filter-streams' : {},
'filter-streams' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'giomodule' : {
'depends' : glib_build_shared ? [libtestmodulea, libtestmoduleb] : [],
},
'gsubprocess' : {
'suite': host_system == 'windows' ? ['flaky'] : [],
'extra_programs': ['gsubprocess-testprog'],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'g-file' : {},
'g-file-info' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/3070
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/3148
'can_fail' : host_system in ['darwin', 'gnu'] or host_system == 'windows' and cc.get_id() != 'gcc',
'can_fail' : host_system in ['darwin', 'gnu'] or host_system == 'windows' and not glib_gnu_cc_compiler,
},
'g-icon' : {},
'gdbus-addresses' : {},
@ -99,7 +109,9 @@ gio_tests = {
'install_rpath' : installed_tests_execdir,
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/3148
'can_fail' : host_system in ['darwin', 'windows', 'gnu'],
'can_fail' : host_system in ['darwin', 'windows', 'gnu'] or
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'thread' in glib_sanitizers,
},
'inet-address' : {},
'io-stream' : {},
@ -110,8 +122,14 @@ gio_tests = {
'memory-settings-backend' : {},
'mount-operation' : {},
'network-address' : {'extra_sources': ['mock-resolver.c']},
'network-monitor' : {},
'network-monitor-race' : {},
'network-monitor' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'network-monitor-race' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'null-settings-backend' : {},
'permission' : {},
'pollable' : {'dependencies' : [libutil_dep]},
@ -133,7 +151,10 @@ gio_tests = {
'socket-listener' : {},
'socket-service' : {},
'srvtarget' : {},
'task' : {},
'task' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'vfs' : {},
'volumemonitor' : {},
'glistmodel' : {},
@ -183,7 +204,9 @@ test_extra_programs = {
python_tests = {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/2764
'codegen.py' : {
'can_fail' : host_system == 'freebsd',
'can_fail' : host_system == 'freebsd' or
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'thread' in glib_sanitizers,
'suite': ['gdbus-codegen', 'slow'],
'timeout': 90,
},
@ -227,19 +250,27 @@ if dbus1_dep.found()
},
'gdbus-server-auth' : {
'dependencies' : [dbus1_dep],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
}
else
# We can build a cut-down version of this test without libdbus
gio_tests += {
'gdbus-server-auth' : {},
'gdbus-server-auth' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
}
endif
have_dbus_daemon = find_program('dbus-daemon', required : false).found()
if have_dbus_daemon
gio_tests += {
'debugcontroller' : {},
'debugcontroller' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'defaultvalue' : {'extra_sources' : [giotypefuncs_inc]},
}
endif
@ -249,10 +280,18 @@ if host_machine.system() != 'windows'
gio_tests += {
'file' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/3148
'can_fail' : host_system == 'gnu',
'can_fail' : host_system == 'gnu' or
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'thread' in glib_sanitizers,
},
'gdbus-peer-object-manager' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'gdbus-sasl' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'gdbus-peer-object-manager' : {},
'gdbus-sasl' : {},
'live-g-file' : {},
'portal-support-flatpak-none' : {
'extra_sources': ['../gportalsupport.c', '../gsandbox.c', 'portal-support-utils.c'],
@ -302,37 +341,39 @@ if host_machine.system() != 'windows'
'unix-mounts' : {},
'unix-streams' : {},
'g-file-info-filesystem-readonly' : {},
'gschema-compile' : {'install' : false},
'gschema-compile' : {
'install' : false,
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'trash' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/3069
'can_fail' : host_system == 'darwin',
'can_fail' : host_system == 'darwin' or
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'thread' in glib_sanitizers,
},
}
if have_rtld_next and glib_build_shared
asan_env = {}
if 'address' in glib_sanitizers
asan_env = {'ASAN_OPTIONS': 'verify_asan_link_order=0'}
endif
slow_connect_preload_lib = shared_library('slow-connect-preload',
'slow-connect-preload.c',
name_prefix : '',
dependencies: libdl_dep,
install_dir : installed_tests_execdir,
install_tag : 'tests',
install: installed_tests_enabled,
)
gio_tests += {
'gsocketclient-slow' : {
'depends' : [
shared_library('slow-connect-preload',
'slow-connect-preload.c',
name_prefix : '',
dependencies: libdl_dep,
install_dir : installed_tests_execdir,
install_tag : 'tests',
install: installed_tests_enabled,
)
],
'depends' : slow_connect_preload_lib,
'env' : {
'LD_PRELOAD': '@0@/slow-connect-preload.so'.format(meson.current_build_dir())
} + asan_env,
glib_exec_var_preload: slow_connect_preload_lib.full_path(),
},
'installed_tests_env' : {
'LD_PRELOAD': '@0@/slow-connect-preload.so'.format(installed_tests_execdir),
} + asan_env,
glib_exec_var_preload: installed_tests_execdir /
fs.name(slow_connect_preload_lib.full_path()),
},
},
}
endif
@ -344,13 +385,17 @@ if host_machine.system() != 'windows'
'appinfo' : {
'install' : false,
'extra_programs' : ['appinfo-test'],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'desktop-app-info' : {
'install' : false,
'depends' : gio_launch_desktop,
'extra_programs' : ['apps', 'appinfo-test'],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/3148
'can_fail' : host_system == 'gnu',
'can_fail' : host_system == 'gnu' or
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'thread' in glib_sanitizers,
},
}
endif
@ -446,78 +491,129 @@ if host_machine.system() != 'windows'
'actions' : {
'extra_sources' : extra_sources,
'suite' : ['slow'],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'fdo-notification-backend': {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'gdbus-auth' : {
'extra_sources' : extra_sources,
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'fdo-notification-backend': {},
'gdbus-auth' : {'extra_sources' : extra_sources},
'gdbus-bz627724' : {'extra_sources' : extra_sources},
'gdbus-close-pending' : {'extra_sources' : extra_sources},
'gdbus-close-pending' : {
'extra_sources' : extra_sources,
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'gdbus-connection' : {
'extra_sources' : extra_sources,
'extra_programs': extra_programs,
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'gdbus-connection-loss' : {
'extra_sources' : extra_sources,
'extra_programs': extra_programs,
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'gdbus-connection-slow' : {
'extra_sources' : extra_sources,
'extra_programs': extra_programs + ['gdbus-connection-flush-helper'],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/3148
'can_fail' : host_system == 'gnu',
'can_fail' : host_system == 'gnu' or
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'thread' in glib_sanitizers,
},
'gdbus-error' : {'extra_sources' : extra_sources},
'gdbus-exit-on-close' : {'extra_sources' : extra_sources},
'gdbus-exit-on-close' : {
'extra_sources' : extra_sources,
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'gdbus-export' : {
'extra_sources' : extra_sources,
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
'suite' : ['slow'],
},
'gdbus-introspection' : {
'extra_sources' : extra_sources,
'extra_programs': extra_programs,
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'gdbus-method-invocation' : {
'extra_sources' : extra_sources,
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'gdbus-method-invocation' : {'extra_sources' : extra_sources},
'gdbus-names' : {
'extra_sources' : extra_sources,
'extra_programs' : ['fake-service-name'],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'gdbus-proxy' : {
'extra_sources' : extra_sources,
'extra_programs': extra_programs,
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'gdbus-proxy-threads' : {
'extra_sources' : extra_sources,
'dependencies' : [dbus1_dep],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/3148
'can_fail' : host_system == 'gnu',
'can_fail' : host_system == 'gnu' or
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'thread' in glib_sanitizers,
},
'gdbus-proxy-unique-name' : {
'extra_sources' : extra_sources,
'extra_programs': extra_programs,
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'gdbus-proxy-well-known-name' : {
'extra_sources' : extra_sources,
'extra_programs': extra_programs,
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'gdbus-subscribe' : {
'extra_sources' : extra_sources,
'extra_programs': extra_programs,
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'gdbus-test-codegen' : {
'extra_sources' : [extra_sources, gdbus_test_codegen_generated, gdbus_test_codegen_generated_interface_info],
'c_args' : ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32'],
'suite': ['gdbus-codegen'],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'gdbus-threading' : {
'extra_sources' : extra_sources,
'extra_programs': extra_programs,
'suite' : ['slow'],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'gmenumodel' : {
'extra_sources' : extra_sources,
'suite' : ['slow'],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'gnotification' : {
'extra_sources' : [extra_sources, 'gnotification-server.c'],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'gdbus-test-codegen-old' : {
'source' : 'gdbus-test-codegen.c',
@ -525,16 +621,22 @@ if host_machine.system() != 'windows'
'c_args' : ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36',
'-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36'],
'suite': ['gdbus-codegen'],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'gdbus-test-codegen-min-required-2-64' : {
'source' : 'gdbus-test-codegen.c',
'extra_sources' : [extra_sources, gdbus_test_codegen_generated_min_required_2_64, gdbus_test_codegen_generated_interface_info],
'c_args' : ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_64'],
'suite': ['gdbus-codegen'],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'gapplication' : {
'extra_sources' : extra_sources,
'extra_programs': ['basic-application'],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
}
@ -543,6 +645,8 @@ if host_machine.system() != 'windows'
'dbus-appinfo' : {
'extra_sources' : extra_sources,
'extra_programs' : ['fake-document-portal'],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
}
endif
@ -579,9 +683,13 @@ if host_machine.system() != 'windows'
gio_tests += {
'gdbus-connection-flush' : {
'extra_sources' : ['test-io-stream.c', 'test-pipe-unix.c'],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'gdbus-non-socket' : {
'extra_sources' : ['gdbus-tests.c', 'test-io-stream.c', 'test-pipe-unix.c'],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
}
@ -597,7 +705,9 @@ if host_machine.system() != 'windows'
'install' : false,
'depends' : glib_compile_schemas,
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/3148
'can_fail' : host_system == 'gnu',
'can_fail' : host_system == 'gnu' or
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'thread' in glib_sanitizers,
},
}
endif
@ -1001,7 +1111,7 @@ if not meson.is_cross_build()
'-nostdlib', '@INPUT@', '-o','@OUTPUT@'])
# Rename symbol to match the one in the C file
if cc.get_id() == 'gcc' and host_system == 'windows'
if glib_gnu_cc_compiler and host_system == 'windows'
underscore = '_'
else
underscore = ''
@ -1067,9 +1177,18 @@ foreach test_name, extra_args : gio_tests
test_conf.set('program', test_name)
test_env_override = ''
if installed_tests_env != {}
if installed_tests_env.has_key(glib_exec_var_preload)
installed_tests_env += {
'ASAN_OPTIONS': ','.join([
glib_exec_asan_option_ignore_preload,
installed_tests_env.get('ASAN_OPTIONS', ''),
]),
}
endif
envs = []
foreach var, value : installed_tests_env
envs += '@0@=@1@'.format(var, value)
envs += '@0@=\'@1@\''.format(var, value)
endforeach
test_env_override = '@0@ @1@ '.format(env_program.full_path(), ' '.join(envs))
endif
@ -1102,7 +1221,26 @@ foreach test_name, extra_args : gio_tests
depends += test_extra_programs_targets[program]
endforeach
foreach var, value : extra_args.get('env', {})
local_test_env_args = extra_args.get('env', {})
if local_test_env_args.has_key(glib_exec_var_preload)
if glib_exec_preloaded_env.has_key(glib_exec_var_preload)
local_test_env_args += {
glib_exec_var_preload: glib_exec_var_preload_separator.join([
glib_exec_preloaded_env.get(glib_exec_var_preload),
local_test_env_args.get(glib_exec_var_preload),
])
}
else
local_test_env_args += {
'ASAN_OPTIONS': ','.join([
glib_exec_asan_option_ignore_preload,
local_test_env_args.get('ASAN_OPTIONS', ''),
]),
}
endif
endif
foreach var, value : local_test_env_args
local_test_env.append(var, value)
endforeach

View File

@ -219,6 +219,7 @@ main (int argc, char **argv)
g_fprintf (stderr, "%s\n", message);
g_free (message);
gi_ir_parser_free (parser);
g_error_free (error);
return 1;
}
@ -229,6 +230,7 @@ main (int argc, char **argv)
{
GITypelib *typelib = NULL;
int write_successful;
if (shlibs)
{
@ -246,10 +248,14 @@ main (int argc, char **argv)
g_error (_("Invalid typelib for module %s: %s"),
module->name, error->message);
if (!write_out_typelib (NULL, typelib))
return 1;
write_successful = write_out_typelib (NULL, typelib);
g_clear_pointer (&typelib, gi_typelib_unref);
if (!write_successful)
{
gi_ir_parser_free (parser);
return 1;
}
}
g_debug ("[building] done");

View File

@ -2243,7 +2243,7 @@ end_type_top (ParseContext *ctx)
if (!ctx->type_parameters)
goto out;
typenode = (GIIrNodeType*)ctx->type_parameters->data;
typenode = (GIIrNodeType*) g_steal_pointer (&ctx->type_parameters->data);
/* Default to pointer for unspecified containers */
if (typenode->tag == GI_TYPE_TAG_ARRAY ||
@ -2292,7 +2292,7 @@ end_type_top (ParseContext *ctx)
g_printerr("current node is %d\n", CURRENT_NODE (ctx)->type);
g_assert_not_reached ();
}
g_list_free (ctx->type_parameters);
g_list_free_full (ctx->type_parameters, (GDestroyNotify) gi_ir_node_free);
out:
ctx->type_depth = 0;
@ -2308,7 +2308,7 @@ end_type_recurse (ParseContext *ctx)
parent = (GIIrNodeType *) ((GList*)ctx->type_stack->data)->data;
if (ctx->type_parameters)
param = (GIIrNodeType *) ctx->type_parameters->data;
param = (GIIrNodeType *) g_steal_pointer (&ctx->type_parameters->data);
if (parent->tag == GI_TYPE_TAG_ARRAY ||
parent->tag == GI_TYPE_TAG_GLIST ||
@ -2317,7 +2317,7 @@ end_type_recurse (ParseContext *ctx)
g_assert (param != NULL);
if (parent->parameter_type1 == NULL)
parent->parameter_type1 = param;
parent->parameter_type1 = g_steal_pointer (&param);
else
g_assert_not_reached ();
}
@ -2326,13 +2326,14 @@ end_type_recurse (ParseContext *ctx)
g_assert (param != NULL);
if (parent->parameter_type1 == NULL)
parent->parameter_type1 = param;
parent->parameter_type1 = g_steal_pointer (&param);
else if (parent->parameter_type2 == NULL)
parent->parameter_type2 = param;
parent->parameter_type2 = g_steal_pointer (&param);
else
g_assert_not_reached ();
}
g_list_free (ctx->type_parameters);
g_clear_pointer ((GIIrNode **) &param, gi_ir_node_free);
g_list_free_full (ctx->type_parameters, (GDestroyNotify) gi_ir_node_free);
ctx->type_parameters = (GList *)ctx->type_stack->data;
ctx->type_stack = g_list_delete_link (ctx->type_stack, ctx->type_stack);
}

View File

@ -19,9 +19,19 @@ gi_gen_shared_dependencies = [
gi_gen_env_variables = environment()
# Use currently built libraries to run g-ir-scanner and the various tools
# this may not happen if we don't set the library paths.
# This seems to break thread sanitizer though, so let's ignore it for now.
if 'thread' not in glib_sanitizers
gi_gen_env_variables.prepend(glib_exec_var_library_path,
fs.parent(libglib.full_path()), fs.parent(libgobject.full_path()),
fs.parent(libgmodule.full_path()), fs.parent(libgio.full_path()))
endif
if 'address' in glib_sanitizers
gi_gen_env_variables.append(
'ASAN_OPTIONS', 'verify_asan_link_order=0', separator: ',')
gi_gen_env_variables.append('ASAN_OPTIONS',
glib_exec_asan_options_disable,
separator: ',')
endif
if host_system == 'windows'

View File

@ -247,9 +247,9 @@ if enable_gir
subdir('introspection')
endif
subdir('decompiler')
subdir('inspector')
if build_tests
subdir('tests')
endif
subdir('decompiler')
subdir('inspector')

View File

@ -102,9 +102,18 @@ foreach test_name, extra_args : girepository_tests
test_conf.set('program', test_name)
test_env_override = ''
if installed_tests_env != {}
if installed_tests_env.has_key(glib_exec_var_preload)
installed_tests_env += {
'ASAN_OPTIONS': ','.join([
glib_exec_asan_option_ignore_preload,
installed_tests_env.get('ASAN_OPTIONS', ''),
]),
}
endif
envs = []
foreach var, value : installed_tests_env
envs += '@0@=@1@'.format(var, value)
envs += '@0@=\'@1@\''.format(var, value)
endforeach
test_env_override = '@0@ @1@ '.format(env_program.full_path(), ' '.join(envs))
endif
@ -144,7 +153,26 @@ foreach test_name, extra_args : girepository_tests
endforeach
local_test_env = test_env
foreach var, value : extra_args.get('env', {})
local_test_env_args = extra_args.get('env', {})
if local_test_env_args.has_key(glib_exec_var_preload)
if glib_exec_preloaded_env.has_key(glib_exec_var_preload)
local_test_env_args += {
glib_exec_var_preload: glib_exec_var_preload_separator.join([
glib_exec_preloaded_env.get(glib_exec_var_preload),
local_test_env_args.get(glib_exec_var_preload),
])
}
else
local_test_env_args += {
'ASAN_OPTIONS': ','.join([
glib_exec_asan_option_ignore_preload,
local_test_env_args.get('ASAN_OPTIONS', ''),
]),
}
endif
endif
foreach var, value : local_test_env_args
local_test_env.append(var, value)
endforeach
@ -158,3 +186,83 @@ foreach test_name, extra_args : girepository_tests
should_fail: extra_args.get('should_fail', false),
)
endforeach
if enable_gir
test('gir-compiler-glib-open-failure', gicompilerepository,
args: [
'this-is' / 'not' / 'a-file.gir',
'--output', meson.current_build_dir() / 'invalid.typelib',
],
should_fail: true,
suite: ['girepository', 'compiler'],
)
test('gir-compiler-glib-write-failure', gicompilerepository,
args: [
glib_gir[0],
'--output', 'this-is' / 'not' / 'a-good-output' / 'invalid.typelib',
],
depends: glib_gir[0],
should_fail: true,
suite: ['girepository', 'compiler'],
)
endif
# When sanitizers are enabled we want to test the compiler memory is properly handled
if enable_gir and glib_sanitizers.length() > 0
gir_files = {
'glib': glib_gir,
'gobject': gobject_gir,
'gmodule': gmodule_gir,
'gio': gio_gir,
}
if host_system != 'windows'
gir_files += {'glib-unix': glib_unix_gir}
gir_files += {'gio-unix': gio_unix_gir}
else
gir_files += {'glib-win32': glib_win32_gir}
gir_files += {'gio-win32': gio_win32_gir}
endif
foreach name, g: gir_files
gir = g[0]
test('gir-compiler-' + name, gicompilerepository,
args: [
gir,
'--output', meson.current_build_dir() / name + '.typelib',
],
depends: gir,
suite: ['girepository', 'compiler'],
)
typelib = g[1]
typelib_name = fs.stem(typelib.full_path())
test('gi-inspect-typelib-' + name, giinspecttypelib,
args: [
'--print-typelibs',
'--print-shlibs',
typelib_name.split('-')[0],
'--typelib-version='+typelib_name.split('-')[-1],
],
env: {
'GI_TYPELIB_PATH': fs.parent(typelib.full_path()),
},
depends: typelib,
suite: ['girepository', 'inspector'],
)
endforeach
endif
test('gi-inspect-typelib-not-found', giinspecttypelib,
args: [
'--print-typelibs',
'--print-shlibs',
'AnInvalidNameSpace'
],
env: {
'GI_TYPELIB_PATH': meson.current_build_dir(),
},
should_fail: true,
suite: ['girepository', 'inspector'],
)

View File

@ -26,6 +26,7 @@
#include "garray.h"
#include "genviron.h"
#include "ghash.h"
#include "glib-private.h"
#include "gmessages.h"
#include "gstrfuncs.h"
#include "gthread.h"
@ -807,6 +808,7 @@ g_get_language_names_with_category (const gchar *category_name)
cache = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, language_names_cache_free);
g_private_set (&cache_private, cache);
g_ignore_leak (cache);
}
languages = guess_category_value (category_name);
@ -835,6 +837,7 @@ g_get_language_names_with_category (const gchar *category_name)
name_cache->languages = g_strdup (languages);
name_cache->language_names = (gchar **) g_ptr_array_free (array, FALSE);
g_hash_table_insert (cache, g_strdup (category_name), name_cache);
g_ignore_leak (name_cache);
}
return (const gchar * const *) name_cache->language_names;

View File

@ -99,7 +99,7 @@ g_leak_sanitizer_is_supported (void)
#if defined (_GLIB_ADDRESS_SANITIZER)
return TRUE;
#elif defined (HAS_DYNAMIC_ASAN_LOADING)
return __lsan_enable != NULL && __lsan_ignore_object != NULL;
return G_UNLIKELY (__lsan_enable != NULL && __lsan_ignore_object != NULL);
#else
return FALSE;
#endif
@ -121,7 +121,7 @@ g_ignore_leak (gconstpointer p)
if (p != NULL)
__lsan_ignore_object (p);
#elif defined (HAS_DYNAMIC_ASAN_LOADING)
if (p != NULL && __lsan_ignore_object != NULL)
if (G_LIKELY (p != NULL) && G_UNLIKELY (__lsan_ignore_object != NULL))
__lsan_ignore_object (p);
#endif
}
@ -165,7 +165,7 @@ g_begin_ignore_leaks (void)
#if defined (_GLIB_ADDRESS_SANITIZER)
__lsan_disable ();
#elif defined (HAS_DYNAMIC_ASAN_LOADING)
if (__lsan_disable != NULL)
if (G_UNLIKELY (__lsan_disable != NULL))
__lsan_disable ();
#endif
}
@ -182,7 +182,7 @@ g_end_ignore_leaks (void)
#if defined (_GLIB_ADDRESS_SANITIZER)
__lsan_enable ();
#elif defined (HAS_DYNAMIC_ASAN_LOADING)
if (__lsan_enable != NULL)
if (G_UNLIKELY (__lsan_enable != NULL))
__lsan_enable ();
#endif
}

View File

@ -800,16 +800,38 @@ g_node_depth_traverse_level (GNode *node,
* efficient than the other orders.
*
* Specifies the type of traversal performed by g_tree_traverse(),
* g_node_traverse() and g_node_find(). The different orders are
* illustrated here:
* g_node_traverse() and g_node_find().
*
* The different orders are illustrated here:
*
* - In order: A, B, C, D, E, F, G, H, I
* ![](Sorted_binary_tree_inorder.svg)
* <picture>
* <source srcset="Sorted_binary_tree_inorder-dark.svg"
* media="(prefers-color-scheme: dark)">
* <img src="Sorted_binary_tree_inorder.svg"
* alt="Sorted binary tree, in-order traversal">
* </picture>
* - Pre order: F, B, A, D, C, E, G, I, H
* ![](Sorted_binary_tree_preorder.svg)
* <picture>
* <source srcset="Sorted_binary_tree_preorder-dark.svg"
* media="(prefers-color-scheme: dark)">
* <img src="Sorted_binary_tree_preorder.svg"
* alt="Sorted binary tree, pre-order traversal">
* </picture>
* - Post order: A, C, E, D, B, H, I, G, F
* ![](Sorted_binary_tree_postorder.svg)
* <picture>
* <source srcset="Sorted_binary_tree_postorder-dark.svg"
* media="(prefers-color-scheme: dark)">
* <img src="Sorted_binary_tree_postorder.svg"
* alt="Sorted binary tree, post-order traversal">
* </picture>
* - Level order: F, B, G, A, D, I, C, E, H
* ![](Sorted_binary_tree_breadth-first_traversal.svg)
* <picture>
* <source srcset="Sorted_binary_tree_breadth-first_traversal-dark.svg"
* media="(prefers-color-scheme: dark)">
* <img src="Sorted_binary_tree_breadth-first_traversal.svg"
* alt="Sorted binary tree, breadth-first level order traversal">
* </picture>
*/
/**

View File

@ -42,6 +42,7 @@
#include "gthread.h"
#include "gthreadprivate.h"
#include "glib-private.h"
#include <string.h>
@ -448,10 +449,10 @@ static GPrivate g_thread_specific_private = G_PRIVATE_INIT (g_thread_cleanup
*
* Sets the thread local variable @key to have a newly-allocated and zero-filled
* value of given @size, and returns a pointer to that memory. Allocations made
* using this API will be suppressed in valgrind: it is intended to be used for
* one-time allocations which are known to be leaked, such as those for
* per-thread initialisation data. Otherwise, this function behaves the same as
* g_private_set().
* using this API will be suppressed in valgrind and leak sanitizer: it is
* intended to be used for one-time allocations which are known to be leaked,
* such as those for per-thread initialisation data. Otherwise, this function
* behaves the same as g_private_set().
*
* Returns: (transfer full): new thread-local heap allocation of size @size
* Since: 2.60
@ -463,6 +464,7 @@ g_private_set_alloc0 (GPrivate *key,
{
gpointer allocated = g_malloc0 (size);
g_ignore_leak (allocated);
g_private_set (key, allocated);
return g_steal_pointer (&allocated);

View File

@ -2,7 +2,7 @@ glib_tests = {
'array-test' : {},
'asyncqueue' : {},
'atomic' : {
'c_args' : cc.get_id() == 'gcc' ? ['-Wstrict-aliasing=2'] : [],
'c_args' : glib_gnu_cc_compiler ? ['-Wstrict-aliasing=2'] : [],
'c_standards': c_standards.keys(),
},
'base64' : {},
@ -81,9 +81,15 @@ glib_tests = {
'link_args' : cc.get_id() == 'gcc' and cc.version().version_compare('> 6')
? ['-Wno-alloc-size-larger-than'] : [],
},
'mutex' : {},
'mutex' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'node' : {},
'once' : {},
'once' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'onceinit' : {},
'option-context' : {
# musl: /option/arg/repetition/locale should be skipped but it's not. The
@ -103,7 +109,10 @@ glib_tests = {
'queue' : {},
'rand' : {},
'rcbox' : {},
'rec-mutex' : {},
'rec-mutex' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'refcount' : {},
'refcount-macro' : {
'source' : 'refcount.c',
@ -126,7 +135,9 @@ glib_tests = {
'slist' : {},
'sort' : {},
'spawn-multithreaded' : {
'can_fail': glib_build_static and host_system == 'windows',
'can_fail': glib_build_static and host_system == 'windows' or
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'thread' in glib_sanitizers,
'suite': host_system == 'windows' ? ['flaky'] : [],
'extra_programs' : ['test-spawn-echo'] + (
host_machine.system() == 'windows' ? ['test-spawn-sleep'] : []),
@ -151,17 +162,23 @@ glib_tests = {
},
'strfuncs' : {},
'string' : {
'c_args' : cc.get_id() == 'gcc' ? ['-Werror=sign-conversion'] : [],
'c_args' : glib_gnu_cc_compiler ? ['-Werror=sign-conversion'] : [],
},
'strvbuilder' : {},
'testing' : {
'args': [ '--verbose' ],
'extra_programs' : ['testing-helper'],
'c_args' : cc.get_id() == 'gcc' ? ['-Werror=sign-conversion'] : [],
'c_args' : glib_gnu_cc_compiler ? ['-Werror=sign-conversion'] : [],
},
'test-printf' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'test-printf' : {},
'thread' : {},
'thread-deprecated' : {},
'thread-deprecated' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'thread-pool' : {},
'thread-pool-slow' : {'suite' : ['slow']},
'timeout' : {},
@ -170,7 +187,7 @@ glib_tests = {
'types' : {},
'utf8-performance' : {},
'utf8-pointer' : {
'c_args' : cc.get_id() == 'gcc' ? ['-Werror=cast-qual'] : [],
'c_args' : glib_gnu_cc_compiler ? ['-Werror=cast-qual'] : [],
},
'utf8-validate' : {},
'utf8-misc' : {},
@ -182,12 +199,17 @@ glib_tests = {
'unicode-encoding' : {},
'unicode-normalize': {},
'uri' : {},
'1bit-mutex' : {},
'1bit-mutex' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'1bit-emufutex' : {
'source' : '1bit-mutex.c',
'c_args' : ['-DTEST_EMULATED_FUTEX'],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/3359
'can_fail': 'undefined' in glib_sanitizers,
'can_fail': 'undefined' in glib_sanitizers or
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'thread' in glib_sanitizers,
'install' : false,
'suite' : ['slow'],
},
@ -230,6 +252,8 @@ if glib_conf.has('HAVE_EVENTFD')
'source' : ['gwakeuptest.c', '../gwakeup.c'],
'c_args' : ['-DTEST_EVENTFD_FALLBACK'],
'install' : false,
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
}
endif
@ -259,26 +283,15 @@ else
install_tag : 'tests',
install: installed_tests_enabled)
if host_system not in ['ios', 'darwin']
var_preload = 'LD_PRELOAD'
else
var_preload = 'DYLD_INSERT_LIBRARIES'
endif
asan_env = {}
if 'address' in glib_sanitizers
asan_env = {'ASAN_OPTIONS': 'verify_asan_link_order=0'}
endif
glib_tests += {
'gutils-user-database' : {
'depends' : getpwuid_preload,
'env' : {
var_preload: getpwuid_preload.full_path()
} + asan_env,
glib_exec_var_preload: getpwuid_preload.full_path(),
},
'installed_tests_env' : {
var_preload: installed_tests_execdir / fs.name(getpwuid_preload.full_path())
} + asan_env,
glib_exec_var_preload: installed_tests_execdir / fs.name(getpwuid_preload.full_path())
},
},
}
endif
@ -425,9 +438,18 @@ foreach test_name, extra_args : glib_tests
test_conf.set('program', test_name)
test_env_override = ''
if installed_tests_env != {}
if installed_tests_env.has_key(glib_exec_var_preload)
installed_tests_env += {
'ASAN_OPTIONS': ','.join([
glib_exec_asan_option_ignore_preload,
installed_tests_env.get('ASAN_OPTIONS', ''),
]),
}
endif
envs = []
foreach var, value : installed_tests_env
envs += '@0@=@1@'.format(var, value)
envs += '@0@=\'@1@\''.format(var, value)
endforeach
test_env_override = '@0@ @1@ '.format(env_program.full_path(), ' '.join(envs))
endif
@ -466,10 +488,29 @@ foreach test_name, extra_args : glib_tests
endforeach
local_test_env = test_env
foreach var, value : extra_args.get('env', {})
local_test_env_args = extra_args.get('env', {})
if local_test_env_args.has_key(glib_exec_var_preload)
if glib_exec_preloaded_env.has_key(glib_exec_var_preload)
local_test_env_args += {
glib_exec_var_preload: glib_exec_var_preload_separator.join([
glib_exec_preloaded_env.get(glib_exec_var_preload),
local_test_env_args.get(glib_exec_var_preload),
])
}
else
local_test_env_args += {
'ASAN_OPTIONS': ','.join([
glib_exec_asan_option_ignore_preload,
local_test_env_args.get('ASAN_OPTIONS', ''),
]),
}
endif
endif
foreach var, value : local_test_env_args
local_test_env.append(var, value)
endforeach
test(test_name, exe,
args: extra_args.get('args', []),
protocol : extra_args.get('protocol', test_protocol),
@ -501,6 +542,8 @@ if 'messages-low-memory' in test_extra_programs
python_tests += {
'messages-low-memory.py' : {
'extra_programs': ['messages-low-memory'],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
}
endif
@ -514,7 +557,26 @@ foreach test_name, extra_args : python_tests
endif
local_test_env = test_env
foreach var, value : extra_args.get('env', {})
local_test_env_args = extra_args.get('env', {})
if local_test_env_args.has_key(glib_exec_var_preload)
if glib_exec_preloaded_env.has_key(glib_exec_var_preload)
local_test_env_args += {
glib_exec_var_preload: glib_exec_var_preload_separator.join([
glib_exec_preloaded_env.get(glib_exec_var_preload),
local_test_env_args.get(glib_exec_var_preload),
])
}
else
local_test_env_args += {
'ASAN_OPTIONS': ','.join([
glib_exec_asan_option_ignore_preload,
local_test_env_args.get('ASAN_OPTIONS', ''),
]),
}
endif
endif
foreach var, value : local_test_env_args
local_test_env.append(var, value)
endforeach

View File

@ -57,7 +57,10 @@ gobject_tests = {
'custom-dispatch' : {
'extra_objs' : extra_custom_dispatch_objs,
},
'qdata' : {},
'qdata' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'accumulator' : {
'source' : ['accumulator.c', marshalers_h, marshalers_c],
},
@ -78,15 +81,29 @@ gobject_tests = {
'references' : {},
'basic-signals' : {},
'singleton' : {},
'threadtests' : {},
'dynamictests' : {},
'binding' : {},
'threadtests' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'dynamictests' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'binding' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'bindinggroup' : {},
'properties' : {},
'properties-introspection' : {},
'properties-introspection' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'reference' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/3148
'can_fail' : host_system == 'gnu',
'can_fail' : host_system == 'gnu' or
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'thread' in glib_sanitizers,
},
'flags' : {},
'value' : {},
@ -95,7 +112,11 @@ gobject_tests = {
'source' : 'private.c',
},
'closure' : {},
'closure-refcount' : { 'suite': ['slow'] },
'closure-refcount' : {
'suite': ['slow'],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'object' : {},
'signal-handler' : {},
'ifaceproperties' : {},
@ -113,17 +134,28 @@ gobject_tests = {
]),
},
'objects-refcount2' : {'suite' : ['slow']},
'properties-refcount1' : {},
'properties-refcount1' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'properties-refcount2' : {'suite' : ['slow']},
'properties-refcount3' : {'suite' : ['slow']},
'properties-refcount3' : {
'suite' : ['slow'],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'properties-refcount4' : {},
'signals-refcount1' : {
'source' : 'signals-refcount.c',
'c_args' : ['-DTESTNUM=1'],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'signals-refcount2' : {
'source' : 'signals-refcount.c',
'c_args' : ['-DTESTNUM=2'],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
'signals-refcount3' : {
'source' : 'signals-refcount.c',
@ -132,6 +164,8 @@ gobject_tests = {
'signals-refcount4' : {
'source' : 'signals-refcount.c',
'c_args' : ['-DTESTNUM=4'],
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1672
'can_fail': 'thread' in glib_sanitizers,
},
}

View File

@ -547,8 +547,10 @@ foreach m : struct_members
endif
endforeach
glib_gnu_cc_compiler = cc.get_id() == 'gcc' or cc.get_id() == 'clang'
# Compiler flags
if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
if glib_gnu_cc_compiler
warning_common_args = [
'-Wduplicated-branches',
'-Wimplicit-fallthrough',
@ -1759,7 +1761,7 @@ g_sizet_compatibility = {
# Do separate checks for gcc/clang (and ignore other compilers for now), since
# we need to explicitly pass -Werror to the compilers.
# FIXME: https://github.com/mesonbuild/meson/issues/5399
if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
if glib_gnu_cc_compiler
foreach type_name, size_compatibility : g_sizet_compatibility
g_sizet_compatibility += { type_name: size_compatibility and
cc.compiles(
@ -2057,7 +2059,7 @@ if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl' or cc.links(atomictest, na
glib_conf.set('__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4', true)
endif
if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
if glib_gnu_cc_compiler
sync_swap_test = '''
int main() {
int atomic = 2;
@ -2611,6 +2613,84 @@ gir_args = [
'--quiet',
]
glib_exec_preloaded_libs = []
glib_exec_preloaded_env = {}
if host_system in ['ios', 'darwin']
glib_exec_var_library_path = 'DYLD_LIBRARY_PATH'
glib_exec_var_preload = 'DYLD_INSERT_LIBRARIES'
glib_exec_var_preload_separator = ':'
else
glib_exec_var_library_path = 'LD_LIBRARY_PATH'
glib_exec_var_preload = 'LD_PRELOAD'
glib_exec_var_preload_separator = ' '
endif
glib_exec_asan_options_disable = []
glib_exec_asan_option_ignore_preload = ''
if 'address' in glib_sanitizers
# libasan needs to be the first in the preload list, and that we cant
# guarantee that, so we have to disable its link order checking when using
# LD_PRELOAD in tests.
glib_exec_asan_option_ignore_preload = 'verify_asan_link_order=false'
glib_exec_asan_options_disable = [
glib_exec_asan_option_ignore_preload,
'start_deactivated=true',
'detect_leaks=false',
]
endif
if glib_gnu_cc_compiler and host_system != 'windows'
test_preloaded_libs = []
if 'address' in glib_sanitizers
# ASAN has to be the first in list
test_preloaded_libs += 'asan'
endif
if 'undefined' in glib_sanitizers
test_preloaded_libs += 'ubsan'
endif
if 'leak' in glib_sanitizers
test_preloaded_libs += 'lsan'
endif
if 'thread' in glib_sanitizers
test_preloaded_libs += 'tsan'
endif
# FIXME: Ideally meson should handle this for us
# https://github.com/mesonbuild/meson/issues/13249
foreach libname: test_preloaded_libs
lib = run_command(cc,
'-print-file-name=lib@0@.so'.format(libname),
check: true,
).stdout().strip()
# Support linker script files
if run_command('grep', '-qI', '^INPUT', lib, check: false).returncode() == 0
out = run_command('cat', lib, check: true).stdout()
lib = out.split('(')[1].split(')')[0].strip()
endif
if lib != '' and lib[0] == '/'
message('Found @0@ library as @1@'.format(libname, lib))
glib_exec_preloaded_libs += '@0@'.format(files(lib)[0])
else
warning('No library found for ' + libname + ', sanitizers [' +
', '.join(glib_sanitizers) + '] executions may fail')
endif
endforeach
if glib_exec_preloaded_libs.length() > 0
glib_exec_preloaded_env = {
glib_exec_var_preload: glib_exec_var_preload_separator.join(
glib_exec_preloaded_libs),
}
endif
endif
pkg = import('pkgconfig')
windows = import('windows')
gnome = import('gnome')

View File

@ -28,6 +28,6 @@ test(
python,
args : ['-B', files('check-missing-install-tag.py')],
env : test_env,
suite : ['lint', 'no-valgrind'],
suite : ['lint', 'no-valgrind', 'no-tsan'],
protocol : 'tap',
)