<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/ci/lib.sh, branch v2.48.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.48.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.48.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2025-01-01T22:13:01Z</updated>
<entry>
<title>Revert barrier-based LSan threading race workaround</title>
<updated>2025-01-01T22:13:01Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-01-01T22:13:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fc89d14c639faec779956b4e3cd873c07bd4327b'/>
<id>urn:sha1:fc89d14c639faec779956b4e3cd873c07bd4327b</id>
<content type='text'>
The extra "barrier" approach was too much code whose sole purpose
was to work around a race that is not even ours (i.e. in LSan's
teardown code).

In preparation for queuing a solution taking a much-less-invasive
approach, let's revert them.
</content>
</entry>
<entry>
<title>thread-utils: introduce optional barrier type</title>
<updated>2024-12-30T14:18:57Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2024-12-30T04:28:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7d0037b59ae0d22a2718c28d8e70e3ef3f3f991e'/>
<id>urn:sha1:7d0037b59ae0d22a2718c28d8e70e3ef3f3f991e</id>
<content type='text'>
One thread primitive we don't yet support is a barrier: it waits for all
threads to reach a synchronization point before letting any of them
continue. This would be useful for avoiding the LSan race we see in
index-pack (and other places) by having all threads complete their
initialization before any of them start to do real work.

POSIX introduced a pthread_barrier_t in 2004, which does what we want.
But if we want to rely on it:

  1. Our Windows pthread emulation would need a new set of wrapper
     functions. There's a Synchronization Barrier primitive there, which
     was introduced in Windows 8 (which is old enough for us to depend
     on).

  2. macOS (and possibly other systems) has pthreads but not
     pthread_barrier_t. So there we'd have to implement our own barrier
     based on the mutex and cond primitives.

Those are do-able, but since we only care about avoiding races in our
LSan builds, there's an easier way: make it a noop on systems without a
native pthread barrier.

This patch introduces a "maybe_thread_barrier" API. The clunky name
(rather than just using pthread_barrier directly) should hopefully clue
people in that on some systems it will do nothing. It's wired to a
Makefile knob which has to be triggered manually, and we enable it for
the linux-leaks CI jobs (since we know we'll have it there).

There are some other possible options:

  - we could turn it on all the time for Linux systems based on uname.
    But we really only care about it for LSan builds, and there is no
    need to add extra code to regular builds.

  - we could turn it on only for LSan builds. But that would break
    builds on non-Linux platforms (like macOS) that otherwise should
    support sanitizers.

  - we could trigger only on the combination of Linux and LSan together.
    This isn't too hard to do, but the uname check isn't completely
    accurate. It is really about what your libc supports, and non-glibc
    systems might not have it (though at least musl seems to).

    So we'd risk breaking builds on those systems, which would need to
    add a new knob. Though the upside would be that running local "make
    SANITIZE=leak test" would be protected automatically.

And of course none of this protects LSan runs from races on systems
without pthread barriers. It's probably OK in practice to protect only
our CI jobs, though. The race is rare-ish and most leak-checking happens
through CI.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ps/ci-meson'</title>
<updated>2024-12-23T17:32:25Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-12-23T17:32:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=83c8f7623538e67262db18c98d9c1da6b50e289d'/>
<id>urn:sha1:83c8f7623538e67262db18c98d9c1da6b50e289d</id>
<content type='text'>
The meson-build procedure is integrated into CI to catch and
prevent bitrotting.

* ps/ci-meson:
  ci: wire up Meson builds
  t: introduce compatibility options to clar-based tests
  t: fix out-of-tree tests for some git-p4 tests
  Makefile: detect missing Meson tests
  meson: detect missing tests at configure time
  t/unit-tests: rename clar-based unit tests to have a common prefix
  Makefile: drop -DSUPPRESS_ANNOTATED_LEAKS
  ci/lib: support custom output directories when creating test artifacts
</content>
</entry>
<entry>
<title>Merge branch 'ps/ci-gitlab-update'</title>
<updated>2024-12-23T17:32:07Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-12-23T17:32:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=19fbad7918f6bd313bdcffc7c71e0729f3a0e0c2'/>
<id>urn:sha1:19fbad7918f6bd313bdcffc7c71e0729f3a0e0c2</id>
<content type='text'>
GitLab CI updates.

* ps/ci-gitlab-update:
  ci/lib: fix "CI setup" sections with GitLab CI
  ci/lib: do not interpret escape sequences in `group ()` arguments
  ci/lib: remove duplicate trap to end "CI setup" group
  gitlab-ci: update macOS images to Sonoma
</content>
</entry>
<entry>
<title>ci: wire up Meson builds</title>
<updated>2024-12-13T14:48:47Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-12-13T10:41:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=eab5dbab92fa60298aa4a1952fcbc6cae824d939'/>
<id>urn:sha1:eab5dbab92fa60298aa4a1952fcbc6cae824d939</id>
<content type='text'>
Wire up CI builds for both GitLab and GitHub that use the Meson build
system.

While the setup is mostly trivial, one gotcha is the test output
directory used to be in "t/", but now it is contained in the build
directory. To unify the logic across Makefile- and Meson-based builds we
explicitly set up the `TEST_OUTPUT_DIRECTORY` variable so that it is the
same for both build systems.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>ci/lib: support custom output directories when creating test artifacts</title>
<updated>2024-12-13T14:48:45Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-12-13T10:41:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=714c134dd6f29d23b46cb85cd8bd82a2ce894c65'/>
<id>urn:sha1:714c134dd6f29d23b46cb85cd8bd82a2ce894c65</id>
<content type='text'>
Update `create_failed_test_artifacts ()` so that it can handle arbitrary
test output directories. This fixes creation of these artifacts for
macOS on GitLab CI, which uses a separate output directory already. This
will also be used by our out-of-tree builds with Meson.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>ci/lib: fix "CI setup" sections with GitLab CI</title>
<updated>2024-12-12T07:57:21Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-12-12T06:47:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c6b43f663eb252deb28cfff79e1ccdefed87c971'/>
<id>urn:sha1:c6b43f663eb252deb28cfff79e1ccdefed87c971</id>
<content type='text'>
Whenever we source "ci/lib.sh" we wrap the directives in a separate
group so that they can easily be collapsed in the web UI. And as we
source the script multiple times during a single CI run we thus end up
with the same section name reused multiple times, as well.

This is broken on GitLab CI though, where reusing the same group name is
not supported. The consequence is that only the last of these sections
can be collapsed.

Fix this issue by including the name of the sourcing script in the
group's name.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>ci/lib: do not interpret escape sequences in `group ()` arguments</title>
<updated>2024-12-12T07:57:21Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-12-12T06:47:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d2ca12020ffb7ee7f0ee1154f394a994f045b5a9'/>
<id>urn:sha1:d2ca12020ffb7ee7f0ee1154f394a994f045b5a9</id>
<content type='text'>
We use printf to set up sections with GitLab CI, which requires us to
print a bunch of escape sequences via printf. The group name is
controlled by the user and is expanded directly into the formatting
string, which may cause problems in case the argument contains escape
sequences or formatting directives.

Fix this potential issue by using formatting directives to pass variable
data.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>ci/lib: remove duplicate trap to end "CI setup" group</title>
<updated>2024-12-12T07:57:21Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-12-12T06:47:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=33b06fa603958ba936ea7602c9b81d10ffcd08bb'/>
<id>urn:sha1:33b06fa603958ba936ea7602c9b81d10ffcd08bb</id>
<content type='text'>
We exlicitly trap on EXIT in order to end the "CI setup" group. This
isn't necessary though given that `begin_group ()` already sets up the
trap for us.

Remove the duplicate trap.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>test-lib: unconditionally enable leak checking</title>
<updated>2024-11-20T23:23:47Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-11-20T13:39:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1fc7ddf35b727a12f78a427ae7e829c77d43fd56'/>
<id>urn:sha1:1fc7ddf35b727a12f78a427ae7e829c77d43fd56</id>
<content type='text'>
Over the last two releases we have plugged a couple hundred of memory
leaks exposed by the Git test suite. With the preceding commits we have
finally fixed the last leak exposed by our test suite, which means that
we are now basically leak free wherever we have branch coverage.

From hereon, the Git test suite should ideally stay free of memory
leaks. Most importantly, any test suite that is being added should
automatically be subject to the leak checker, and if that test does not
pass it is a strong signal that the added code introduced new memory
leaks and should not be accepted without further changes.

Drop the infrastructure around TEST_PASSES_SANITIZE_LEAK to reflect this
new requirement. Like this, all test suites will be subject to the leak
checker by default.

This is being intentionally strict, but we still have an escape hatch:
the SANITIZE_LEAK prerequisite. There is one known case in t5601 where
the leak sanitizer itself is buggy, so adding this prereq in such cases
is acceptable. Another acceptable situation is when a newly added test
uncovers preexisting memory leaks: when fixing that memory leak would be
sufficiently complicated it is fine to annotate and document the leak
accordingly. But in any case, the burden is now on the patch author to
explain why exactly they have to add the SANITIZE_LEAK prerequisite.

The TEST_PASSES_SANITIZE_LEAK annotations will be dropped in the next
patch.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
