From d5b8c13255a9fc8bdd102de419cf984de9790ba0 Mon Sep 17 00:00:00 2001 From: Daniel Markstedt Date: Thu, 7 Aug 2025 12:30:44 -0700 Subject: [PATCH 1/4] GitHub CI: Run memory profiling with valgrind on Linux and FreeBSD Use the built-in valgrind wrapper in Meson to run memory profiling in the CI pipeline --- .github/workflows/build.yml | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f287493..b1226e1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,7 +31,8 @@ jobs: gcc \ meson \ ninja \ - pkgconfig + pkgconfig \ + valgrind - name: Configure run: | meson setup build \ @@ -40,6 +41,8 @@ jobs: run: meson compile -C build - name: Run unit tests run: meson test -C build + - name: Run memory profiling + run: meson test --wrapper='valgrind --leak-check=full --error-exitcode=1' -C build - name: Install run: meson install -C build - name: Uninstall @@ -60,7 +63,8 @@ jobs: gcc \ meson \ ninja \ - pkgconfig + pkgconfig \ + valgrind - name: Configure run: | meson setup build \ @@ -90,7 +94,8 @@ jobs: check \ meson \ ninja-build \ - pkg-config + pkg-config \ + valgrind - name: Configure run: | meson setup build \ @@ -99,6 +104,8 @@ jobs: run: meson compile -C build - name: Run unit tests run: meson test -C build + - name: Run memory profiling + run: meson test --wrapper='valgrind --leak-check=full --error-exitcode=1' -C build - name: Install run: meson install -C build - name: Uninstall @@ -119,7 +126,8 @@ jobs: check-devel \ gcc \ meson \ - ninja-build + ninja-build \ + valgrind - name: Configure run: | meson setup build \ @@ -128,6 +136,8 @@ jobs: run: meson compile -C build - name: Run unit tests run: meson test -C build + - name: Run memory profiling + run: meson test --wrapper='valgrind --leak-check=full --error-exitcode=1' -C build - name: Install run: sudo meson install -C build - name: Uninstall @@ -145,7 +155,8 @@ jobs: sudo apt-get install --assume-yes --no-install-recommends \ check \ meson \ - ninja-build + ninja-build \ + valgrind - name: Configure run: | meson setup build \ @@ -154,6 +165,8 @@ jobs: run: meson compile -C build - name: Run unit tests run: meson test -C build + - name: Run memory profiling + run: meson test --wrapper='valgrind --leak-check=full --error-exitcode=1' -C build - name: Install run: sudo meson install -C build - name: Uninstall @@ -228,13 +241,15 @@ jobs: pkg install -y \ check \ meson \ - pkgconf + pkgconf \ + valgrind run: | set -e meson setup build \ -Denable-tests=true meson compile -C build meson test -C build + meson test --wrapper='valgrind --leak-check=full --error-exitcode=1' -C build meson install -C build ninja -C build uninstall From 501fd3c142611099b56ec6b2e3f9f5763e6d647d Mon Sep 17 00:00:00 2001 From: Daniel Markstedt Date: Thu, 7 Aug 2025 22:07:44 +0200 Subject: [PATCH 2/4] Document how to run valgrind with meson --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 9bad82b..987bf4a 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,10 @@ A test suite is available if Check is is installed. $ meson test -C build +If Valgrind is installed the test suite can be checked for memory leaks. + + $ meson test --wrapper='valgrind --leak-check=full --error-exitcode=1' -C build + ### Autotools To build with Autotools: From 00c73fb040b49e8922a8158ab79741f7d4ff3010 Mon Sep 17 00:00:00 2001 From: Daniel Markstedt Date: Thu, 7 Aug 2025 22:09:41 +0200 Subject: [PATCH 3/4] Note in the readme that Ninja is required to build with Meson --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 987bf4a..1225be3 100644 --- a/README.md +++ b/README.md @@ -21,10 +21,11 @@ only source incompatibility is the removal of the `const_bstring` type. ## Building -The repository currently includes [Meson][] and Autotools ([Autoconf][], +The repository currently includes [Meson][]+[Ninja][] and Autotools ([Autoconf][], [Automake][], and [Libtool][]) build systems. [Meson]: https://mesonbuild.com/ +[Ninja]: https://ninja-build.org/ [Autoconf]: https://www.gnu.org/software/autoconf/ [Automake]: https://www.gnu.org/software/automake/ [Libtool]: https://www.gnu.org/software/libtool/ From 1622612f97cce6d20482b0cae87d457f8a2615cf Mon Sep 17 00:00:00 2001 From: Daniel Markstedt Date: Thu, 7 Aug 2025 22:12:15 +0200 Subject: [PATCH 4/4] Rename the CI workflow to emphasize that tests are run --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b1226e1..09596f8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Builds +name: Build and Test on: push: branches: