From a152bb004a48ab8cd79f66fc1fe0b0933e8999a5 Mon Sep 17 00:00:00 2001 From: Lars Froehlich Date: Thu, 20 Mar 2025 17:09:46 +0100 Subject: [PATCH 1/8] Use Catch2v3 for the unit test suite This moves from the old header-only Catch2 version 2.x included in GUL14 to the newer 3.x family of the unit test framework. Accordingly, the header files that need to be included change. Signed-off-by: Lars Froehlich --- tests/meson.build | 5 ++++- tests/test_Error.cc | 11 ++++++----- tests/test_Remote.cc | 4 ++-- tests/test_Repository.cc | 4 ++-- tests/test_main.cc | 5 ++--- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/tests/meson.build b/tests/meson.build index e92e8e6..bbaac73 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -11,7 +11,10 @@ test_src = files( test('all', executable(meson.project_name() + '_test', test_src, - dependencies : libgit4cpp_dep, + dependencies : [ + dependency('catch2'), + libgit4cpp_dep, + ], ), workdir : meson.current_build_dir(), timeout : 10, diff --git a/tests/test_Error.cc b/tests/test_Error.cc index 511130b..bea9ea8 100644 --- a/tests/test_Error.cc +++ b/tests/test_Error.cc @@ -1,9 +1,10 @@ /** - * \file test_Error.cc - * \date Created on January 23, 2024 - * \brief Test suite for the git::Error exception class. + * \file test_Error.cc + * \authors Fini Jastrow, Lars Fröhlich + * \date Created on January 23, 2024 + * \brief Test suite for the git::Error exception class. * - * \copyright Copyright 2024 Deutsches Elektronen-Synchrotron (DESY), Hamburg + * \copyright Copyright 2024-2025 Deutsches Elektronen-Synchrotron (DESY), Hamburg * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -23,7 +24,7 @@ #include -#include +#include #include "libgit4cpp/Error.h" diff --git a/tests/test_Remote.cc b/tests/test_Remote.cc index ca6c6d9..b22d9fe 100644 --- a/tests/test_Remote.cc +++ b/tests/test_Remote.cc @@ -4,7 +4,7 @@ * \date Created on January 15, 2024 * \brief Test suite for the Remote class. * - * \copyright Copyright 2024 Deutsches Elektronen-Synchrotron (DESY), Hamburg + * \copyright Copyright 2024-2025 Deutsches Elektronen-Synchrotron (DESY), Hamburg * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -25,8 +25,8 @@ #include #include +#include #include -#include #include #include "libgit4cpp/Error.h" diff --git a/tests/test_Repository.cc b/tests/test_Repository.cc index dd8e80d..f875da5 100644 --- a/tests/test_Repository.cc +++ b/tests/test_Repository.cc @@ -4,7 +4,7 @@ * \date Created on March 22, 2023 * \brief Test suite for the Repository class. * - * \copyright Copyright 2023-2024 Deutsches Elektronen-Synchrotron (DESY), Hamburg + * \copyright Copyright 2023-2025 Deutsches Elektronen-Synchrotron (DESY), Hamburg * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -26,8 +26,8 @@ #include #include +#include #include -#include #include #include "libgit4cpp/Error.h" diff --git a/tests/test_main.cc b/tests/test_main.cc index 9d0ebfa..1f11fd2 100644 --- a/tests/test_main.cc +++ b/tests/test_main.cc @@ -4,7 +4,7 @@ * \date Created on November 26, 2019 * \brief Test suite for libgit4cpp * - * \copyright Copyright 2019-2024 Deutsches Elektronen-Synchrotron (DESY), Hamburg + * \copyright Copyright 2019-2025 Deutsches Elektronen-Synchrotron (DESY), Hamburg * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -24,8 +24,7 @@ #include -#define CATCH_CONFIG_RUNNER -#include +#include #include "test_main.h" From 260a7ba236d618704267c162c13622456802bc65 Mon Sep 17 00:00:00 2001 From: Lars Froehlich Date: Thu, 20 Mar 2025 17:15:45 +0100 Subject: [PATCH 2/8] Meson: Add wrap file for Catch2 [why] This way we can avoid having to install it for CI runs. Signed-off-by: Lars Froehlich --- subprojects/catch2.wrap | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 subprojects/catch2.wrap diff --git a/subprojects/catch2.wrap b/subprojects/catch2.wrap new file mode 100644 index 0000000..3068d40 --- /dev/null +++ b/subprojects/catch2.wrap @@ -0,0 +1,9 @@ +[wrap-git] +directory = catch2 +url = https://github.com/catchorg/Catch2.git +revision = v3.8.0 + +[provide] +dependency_names = catch2_dep, catch2_with_main_dep +catch2 = catch2_dep +catch2_with_main = catch2_with_main_dep From efacfe8c7421c275da4e68c917c563d899662ebb Mon Sep 17 00:00:00 2001 From: Lars Froehlich Date: Thu, 20 Mar 2025 17:18:25 +0100 Subject: [PATCH 3/8] CI: Add Ubuntu 24, update upload-artifact action to v4 Signed-off-by: Lars Froehlich --- .github/workflows/build_and_run_tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_and_run_tests.yml b/.github/workflows/build_and_run_tests.yml index ce356b8..3d553ba 100644 --- a/.github/workflows/build_and_run_tests.yml +++ b/.github/workflows/build_and_run_tests.yml @@ -28,7 +28,7 @@ jobs: name: Build and Tests strategy: matrix: - os: [ ubuntu-20.04, ubuntu-22.04 ] + os: [ ubuntu-20.04, ubuntu-22.04, ubuntu-24.04 ] runs-on: ${{ matrix.os }} steps: - run: | @@ -68,7 +68,7 @@ jobs: run: ./meson.py test -C build.release - name: Save error logs - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ always() && steps.buildnormal.outcome == 'failure' }} with: name: Meson-logs-${{ matrix.os }} @@ -79,7 +79,7 @@ jobs: run: ./meson.py test -C build.asan - name: Save error logs - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ always() && steps.buildasan.outcome == 'failure' }} with: name: Meson-logs-${{ matrix.os }} From 44e1de00ca1a91c5cd75f4813073c010e79cc25c Mon Sep 17 00:00:00 2001 From: Lars Froehlich Date: Thu, 20 Mar 2025 17:23:04 +0100 Subject: [PATCH 4/8] CI: Use Meson 1.7.0 [why] We need modern support for wrap files without explicitly requesting a fallback in the meson.build. So why not go to an up-to-date version? Signed-off-by: Lars Froehlich --- .github/workflows/build_and_run_tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_and_run_tests.yml b/.github/workflows/build_and_run_tests.yml index 3d553ba..cd9cc80 100644 --- a/.github/workflows/build_and_run_tests.yml +++ b/.github/workflows/build_and_run_tests.yml @@ -45,7 +45,7 @@ jobs: uses: robinraju/release-downloader@v1.6 with: repository: "mesonbuild/meson" - tag: "0.53.2" + tag: "1.7.0" fileName: "*.tar.gz" - name: Unpack meson tar ball and remove downloaded file run: | @@ -61,8 +61,8 @@ jobs: - name: Configure build directories run: | - ./meson.py --buildtype=release build.release - ./meson.py --buildtype=debug build.asan -Db_sanitize=address + ./meson.py setup --buildtype=release build.release + ./meson.py setup --buildtype=debug build.asan -Db_sanitize=address - name: Build and run release tests id: buildnormal run: ./meson.py test -C build.release From f9c92b7e3993c0634a14ebcd8e915f40efd9f8b1 Mon Sep 17 00:00:00 2001 From: Lars Froehlich Date: Tue, 25 Mar 2025 08:43:43 +0100 Subject: [PATCH 5/8] Debian: Add build-depends on catch2 >3.4.0 [why] We now require Catch2 v3 from an external package for building the unit test suite. Proposed-by: Fini Jastrow Signed-off-by: Lars Froehlich --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index c75e159..1bd9026 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: devel Priority: optional Maintainer: Jannik Woehnert Standards-Version: 4.6.0 -Build-Depends: dev-doocs-libgul14 | libgul14-dev, meson (>=0.50.0), pkg-config, debhelper-compat (=12), libgit2-dev +Build-Depends: dev-doocs-libgul14 | libgul14-dev, meson (>=0.50.0), pkg-config, debhelper-compat (=12), catch2 (>>3.4.0), libgit2-dev Package: libgit4cpp-0-4-8 Section: libs From 9ccc9c37346036a8ded9429f2a1fd99d6659b1c4 Mon Sep 17 00:00:00 2001 From: Lars Froehlich Date: Tue, 25 Mar 2025 08:50:13 +0100 Subject: [PATCH 6/8] Meson: Require catch2 >3.4.0 for building tests [why] The precompiled library form of the Catch2 framework that we use was introduced in Catch2 3.4.0-1 or something like that. Proposed-by: Fini Jastrow Signed-off-by: Lars Froehlich --- tests/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/meson.build b/tests/meson.build index bbaac73..00ff189 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -12,7 +12,7 @@ test('all', executable(meson.project_name() + '_test', test_src, dependencies : [ - dependency('catch2'), + dependency('catch2', version : '>3.4.0'), libgit4cpp_dep, ], ), From 670e2632bbc8c201cf9aac3a995846dd89950b42 Mon Sep 17 00:00:00 2001 From: Lars Froehlich Date: Tue, 25 Mar 2025 14:12:42 +0100 Subject: [PATCH 7/8] Debian: Change catch2 build dependency This changes the build-depends clause from "catch2 (>>3.4.0)" to "catch2 (>=3.4.0) | libcatch2". Rationale (Fini): " Hmm, we have a problem here, out there is just this one package that is an in-between one: 3.4.0-1build1: Only on Ubuntu, and there on 24.04 and 24.10. The header only catch2 packages were called catch2 The library v3 version is destined to be called libcatch2 There is a transitional package transmogrifying catch2 to libcatch2 On Ubuntu systems after 24.10 it is possible to install libcatch2 and not have catch2 installed. On Debian we do not have this break, and Catch2v3 is always available as libcatch2. " Co-authored-by: Fini Jastrow Signed-off-by: Lars Froehlich --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 1bd9026..0d66995 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: devel Priority: optional Maintainer: Jannik Woehnert Standards-Version: 4.6.0 -Build-Depends: dev-doocs-libgul14 | libgul14-dev, meson (>=0.50.0), pkg-config, debhelper-compat (=12), catch2 (>>3.4.0), libgit2-dev +Build-Depends: dev-doocs-libgul14 | libgul14-dev, meson (>=0.50.0), pkg-config, debhelper-compat (=12), catch2 (>=3.4.0) | libcatch2, libgit2-dev Package: libgit4cpp-0-4-8 Section: libs From 988aa385bc05ffcd999429ff358c0a06eea0fbe3 Mon Sep 17 00:00:00 2001 From: Lars Froehlich Date: Tue, 25 Mar 2025 17:16:04 +0100 Subject: [PATCH 8/8] Meson: Require catch2 >=3.4.0 (instead of >3.4.0) [why] To bring the requirement in sync with the one listed in the Debian control file. Proposed-by: Fini Jastrow Signed-off-by: Lars Froehlich --- tests/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/meson.build b/tests/meson.build index 00ff189..49bf604 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -12,7 +12,7 @@ test('all', executable(meson.project_name() + '_test', test_src, dependencies : [ - dependency('catch2', version : '>3.4.0'), + dependency('catch2', version : '>=3.4.0'), libgit4cpp_dep, ], ),