diff options
| author | Khem Raj <raj.khem@gmail.com> | 2024-05-31 09:15:56 -0700 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2024-06-11 07:46:44 -0700 |
| commit | 2c8d82ea2f4a95fa1160d4f843f9fd17f31f2099 (patch) | |
| tree | a469c56b1fa9a00c93896e1adea97d56e2352630 | |
| parent | 02f2a297ea64e01df74b04530fc3de43ced425b8 (diff) | |
| download | meta-openembedded-2c8d82ea2f4a95fa1160d4f843f9fd17f31f2099.tar.gz | |
libgpiod: Migrate to catch2 v3
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
| -rw-r--r-- | meta-oe/recipes-support/libgpiod/libgpiod-2.x/0001-bindings-cxx-Migrate-C-tests-to-use-Catch2-v3.patch | 530 | ||||
| -rw-r--r-- | meta-oe/recipes-support/libgpiod/libgpiod_2.1.2.bb | 1 |
2 files changed, 531 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/libgpiod/libgpiod-2.x/0001-bindings-cxx-Migrate-C-tests-to-use-Catch2-v3.patch b/meta-oe/recipes-support/libgpiod/libgpiod-2.x/0001-bindings-cxx-Migrate-C-tests-to-use-Catch2-v3.patch new file mode 100644 index 0000000000..ac1eff510b --- /dev/null +++ b/meta-oe/recipes-support/libgpiod/libgpiod-2.x/0001-bindings-cxx-Migrate-C-tests-to-use-Catch2-v3.patch | |||
| @@ -0,0 +1,530 @@ | |||
| 1 | From 0d3e1b3923a1fac80e9d75d8b5e33cd36f4fe659 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Fri, 31 May 2024 09:03:22 -0700 | ||
| 4 | Subject: [PATCH] bindings: cxx: Migrate C++ tests to use Catch2 v3 | ||
| 5 | |||
| 6 | Catch2 v3.x has API changes which needs to be addressed | ||
| 7 | in the tests themselves, hence this changeset is to fix | ||
| 8 | those. | ||
| 9 | |||
| 10 | Upstream-Status: Submitted [https://lore.kernel.org/linux-gpio/20240531184223.3949069-1-raj.khem@gmail.com/T/#u] | ||
| 11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 12 | Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | ||
| 13 | --- | ||
| 14 | bindings/cxx/tests/Makefile.am | 2 +- | ||
| 15 | bindings/cxx/tests/gpiod-cxx-test-main.cpp | 3 +-- | ||
| 16 | bindings/cxx/tests/helpers.hpp | 8 +++--- | ||
| 17 | bindings/cxx/tests/tests-chip-info.cpp | 30 ++++++++++----------- | ||
| 18 | bindings/cxx/tests/tests-chip.cpp | 14 +++++----- | ||
| 19 | bindings/cxx/tests/tests-edge-event.cpp | 2 +- | ||
| 20 | bindings/cxx/tests/tests-info-event.cpp | 2 +- | ||
| 21 | bindings/cxx/tests/tests-line-config.cpp | 2 +- | ||
| 22 | bindings/cxx/tests/tests-line-info.cpp | 22 +++++++-------- | ||
| 23 | bindings/cxx/tests/tests-line-request.cpp | 16 +++++------ | ||
| 24 | bindings/cxx/tests/tests-line-settings.cpp | 2 +- | ||
| 25 | bindings/cxx/tests/tests-line.cpp | 2 +- | ||
| 26 | bindings/cxx/tests/tests-misc.cpp | 2 +- | ||
| 27 | bindings/cxx/tests/tests-request-config.cpp | 10 +++---- | ||
| 28 | configure.ac | 4 +-- | ||
| 29 | 15 files changed, 60 insertions(+), 61 deletions(-) | ||
| 30 | |||
| 31 | diff --git a/bindings/cxx/tests/Makefile.am b/bindings/cxx/tests/Makefile.am | ||
| 32 | index fbf80a1..d9284da 100644 | ||
| 33 | --- a/bindings/cxx/tests/Makefile.am | ||
| 34 | +++ b/bindings/cxx/tests/Makefile.am | ||
| 35 | @@ -4,7 +4,7 @@ | ||
| 36 | AM_CXXFLAGS = -I$(top_srcdir)/bindings/cxx/ -I$(top_srcdir)/include | ||
| 37 | AM_CXXFLAGS += -I$(top_srcdir)/tests/gpiosim/ | ||
| 38 | AM_CXXFLAGS += -Wall -Wextra -g -std=gnu++17 $(CATCH2_CFLAGS) | ||
| 39 | -AM_LDFLAGS = -pthread | ||
| 40 | +AM_LDFLAGS = -pthread $(CATCH2_LIBS) | ||
| 41 | LDADD = $(top_builddir)/bindings/cxx/libgpiodcxx.la | ||
| 42 | LDADD += $(top_builddir)/tests/gpiosim/libgpiosim.la | ||
| 43 | |||
| 44 | diff --git a/bindings/cxx/tests/gpiod-cxx-test-main.cpp b/bindings/cxx/tests/gpiod-cxx-test-main.cpp | ||
| 45 | index 11bf8e5..ec48286 100644 | ||
| 46 | --- a/bindings/cxx/tests/gpiod-cxx-test-main.cpp | ||
| 47 | +++ b/bindings/cxx/tests/gpiod-cxx-test-main.cpp | ||
| 48 | @@ -1,5 +1,4 @@ | ||
| 49 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 50 | // SPDX-FileCopyrightText: 2017-2021 Bartosz Golaszewski <bartekgola@gmail.com> | ||
| 51 | |||
| 52 | -#define CATCH_CONFIG_MAIN | ||
| 53 | -#include <catch2/catch.hpp> | ||
| 54 | +#include <catch2/catch_all.hpp> | ||
| 55 | diff --git a/bindings/cxx/tests/helpers.hpp b/bindings/cxx/tests/helpers.hpp | ||
| 56 | index 62d9827..62bbdf5 100644 | ||
| 57 | --- a/bindings/cxx/tests/helpers.hpp | ||
| 58 | +++ b/bindings/cxx/tests/helpers.hpp | ||
| 59 | @@ -4,13 +4,13 @@ | ||
| 60 | #ifndef __GPIOD_CXX_TEST_HELPERS_HPP__ | ||
| 61 | #define __GPIOD_CXX_TEST_HELPERS_HPP__ | ||
| 62 | |||
| 63 | -#include <catch2/catch.hpp> | ||
| 64 | +#include <catch2/catch_all.hpp> | ||
| 65 | #include <regex> | ||
| 66 | #include <string> | ||
| 67 | #include <sstream> | ||
| 68 | #include <system_error> | ||
| 69 | |||
| 70 | -class system_error_matcher : public Catch::MatcherBase<::std::system_error> | ||
| 71 | +class system_error_matcher : public Catch::Matchers::MatcherBase<::std::system_error> | ||
| 72 | { | ||
| 73 | public: | ||
| 74 | explicit system_error_matcher(int expected_errno); | ||
| 75 | @@ -21,7 +21,7 @@ private: | ||
| 76 | ::std::error_condition _m_cond; | ||
| 77 | }; | ||
| 78 | |||
| 79 | -class regex_matcher : public Catch::MatcherBase<::std::string> | ||
| 80 | +class regex_matcher : public Catch::Matchers::MatcherBase<::std::string> | ||
| 81 | { | ||
| 82 | public: | ||
| 83 | explicit regex_matcher(const ::std::string& pattern); | ||
| 84 | @@ -33,7 +33,7 @@ private: | ||
| 85 | ::std::string _m_repr; | ||
| 86 | }; | ||
| 87 | |||
| 88 | -template<class T> class stringify_matcher : public Catch::MatcherBase<T> | ||
| 89 | +template<class T> class stringify_matcher : public Catch::Matchers::MatcherBase<T> | ||
| 90 | { | ||
| 91 | public: | ||
| 92 | explicit stringify_matcher(const ::std::string& expected) : _m_expected(expected) | ||
| 93 | diff --git a/bindings/cxx/tests/tests-chip-info.cpp b/bindings/cxx/tests/tests-chip-info.cpp | ||
| 94 | index 717c387..2c54f53 100644 | ||
| 95 | --- a/bindings/cxx/tests/tests-chip-info.cpp | ||
| 96 | +++ b/bindings/cxx/tests/tests-chip-info.cpp | ||
| 97 | @@ -1,7 +1,7 @@ | ||
| 98 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 99 | // SPDX-FileCopyrightText: 2021-2022 Bartosz Golaszewski <brgl@bgdev.pl> | ||
| 100 | |||
| 101 | -#include <catch2/catch.hpp> | ||
| 102 | +#include <catch2/catch_all.hpp> | ||
| 103 | #include <gpiod.hpp> | ||
| 104 | #include <sstream> | ||
| 105 | |||
| 106 | @@ -24,12 +24,12 @@ TEST_CASE("chip_info properties can be read", "[chip-info][chip]") | ||
| 107 | |||
| 108 | SECTION("get chip name") | ||
| 109 | { | ||
| 110 | - REQUIRE_THAT(info.name(), Catch::Equals(sim.name())); | ||
| 111 | + REQUIRE_THAT(info.name(), Catch::Matchers::Equals(sim.name())); | ||
| 112 | } | ||
| 113 | |||
| 114 | SECTION("get chip label") | ||
| 115 | { | ||
| 116 | - REQUIRE_THAT(info.label(), Catch::Equals("foobar")); | ||
| 117 | + REQUIRE_THAT(info.label(), Catch::Matchers::Equals("foobar")); | ||
| 118 | } | ||
| 119 | |||
| 120 | SECTION("get num_lines") | ||
| 121 | @@ -52,12 +52,12 @@ TEST_CASE("chip_info can be copied and moved", "[chip-info]") | ||
| 122 | { | ||
| 123 | auto copy(info); | ||
| 124 | |||
| 125 | - REQUIRE_THAT(copy.name(), Catch::Equals(sim.name())); | ||
| 126 | - REQUIRE_THAT(copy.label(), Catch::Equals("foobar")); | ||
| 127 | + REQUIRE_THAT(copy.name(), Catch::Matchers::Equals(sim.name())); | ||
| 128 | + REQUIRE_THAT(copy.label(), Catch::Matchers::Equals("foobar")); | ||
| 129 | REQUIRE(copy.num_lines() == 4); | ||
| 130 | |||
| 131 | - REQUIRE_THAT(info.name(), Catch::Equals(sim.name())); | ||
| 132 | - REQUIRE_THAT(info.label(), Catch::Equals("foobar")); | ||
| 133 | + REQUIRE_THAT(info.name(), Catch::Matchers::Equals(sim.name())); | ||
| 134 | + REQUIRE_THAT(info.label(), Catch::Matchers::Equals("foobar")); | ||
| 135 | REQUIRE(info.num_lines() == 4); | ||
| 136 | } | ||
| 137 | |||
| 138 | @@ -67,12 +67,12 @@ TEST_CASE("chip_info can be copied and moved", "[chip-info]") | ||
| 139 | |||
| 140 | copy = info; | ||
| 141 | |||
| 142 | - REQUIRE_THAT(copy.name(), Catch::Equals(sim.name())); | ||
| 143 | - REQUIRE_THAT(copy.label(), Catch::Equals("foobar")); | ||
| 144 | + REQUIRE_THAT(copy.name(), Catch::Matchers::Equals(sim.name())); | ||
| 145 | + REQUIRE_THAT(copy.label(), Catch::Matchers::Equals("foobar")); | ||
| 146 | REQUIRE(copy.num_lines() == 4); | ||
| 147 | |||
| 148 | - REQUIRE_THAT(info.name(), Catch::Equals(sim.name())); | ||
| 149 | - REQUIRE_THAT(info.label(), Catch::Equals("foobar")); | ||
| 150 | + REQUIRE_THAT(info.name(), Catch::Matchers::Equals(sim.name())); | ||
| 151 | + REQUIRE_THAT(info.label(), Catch::Matchers::Equals("foobar")); | ||
| 152 | REQUIRE(info.num_lines() == 4); | ||
| 153 | } | ||
| 154 | |||
| 155 | @@ -80,8 +80,8 @@ TEST_CASE("chip_info can be copied and moved", "[chip-info]") | ||
| 156 | { | ||
| 157 | auto moved(std::move(info)); | ||
| 158 | |||
| 159 | - REQUIRE_THAT(moved.name(), Catch::Equals(sim.name())); | ||
| 160 | - REQUIRE_THAT(moved.label(), Catch::Equals("foobar")); | ||
| 161 | + REQUIRE_THAT(moved.name(), Catch::Matchers::Equals(sim.name())); | ||
| 162 | + REQUIRE_THAT(moved.label(), Catch::Matchers::Equals("foobar")); | ||
| 163 | REQUIRE(moved.num_lines() == 4); | ||
| 164 | } | ||
| 165 | |||
| 166 | @@ -91,8 +91,8 @@ TEST_CASE("chip_info can be copied and moved", "[chip-info]") | ||
| 167 | |||
| 168 | moved = ::std::move(info); | ||
| 169 | |||
| 170 | - REQUIRE_THAT(moved.name(), Catch::Equals(sim.name())); | ||
| 171 | - REQUIRE_THAT(moved.label(), Catch::Equals("foobar")); | ||
| 172 | + REQUIRE_THAT(moved.name(), Catch::Matchers::Equals(sim.name())); | ||
| 173 | + REQUIRE_THAT(moved.label(), Catch::Matchers::Equals("foobar")); | ||
| 174 | REQUIRE(moved.num_lines() == 4); | ||
| 175 | } | ||
| 176 | } | ||
| 177 | diff --git a/bindings/cxx/tests/tests-chip.cpp b/bindings/cxx/tests/tests-chip.cpp | ||
| 178 | index c5ec19b..1ab7add 100644 | ||
| 179 | --- a/bindings/cxx/tests/tests-chip.cpp | ||
| 180 | +++ b/bindings/cxx/tests/tests-chip.cpp | ||
| 181 | @@ -1,7 +1,7 @@ | ||
| 182 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 183 | // SPDX-FileCopyrightText: 2021-2022 Bartosz Golaszewski <brgl@bgdev.pl> | ||
| 184 | |||
| 185 | -#include <catch2/catch.hpp> | ||
| 186 | +#include <catch2/catch_all.hpp> | ||
| 187 | #include <gpiod.hpp> | ||
| 188 | #include <sstream> | ||
| 189 | #include <system_error> | ||
| 190 | @@ -48,9 +48,9 @@ TEST_CASE("chip constructor works", "[chip]") | ||
| 191 | .build(); | ||
| 192 | |||
| 193 | ::gpiod::chip first(sim.dev_path()); | ||
| 194 | - REQUIRE_THAT(first.get_info().label(), Catch::Equals("foobar")); | ||
| 195 | + REQUIRE_THAT(first.get_info().label(), Catch::Matchers::Equals("foobar")); | ||
| 196 | ::gpiod::chip second(::std::move(first)); | ||
| 197 | - REQUIRE_THAT(second.get_info().label(), Catch::Equals("foobar")); | ||
| 198 | + REQUIRE_THAT(second.get_info().label(), Catch::Matchers::Equals("foobar")); | ||
| 199 | } | ||
| 200 | } | ||
| 201 | |||
| 202 | @@ -70,9 +70,9 @@ TEST_CASE("chip operators work", "[chip]") | ||
| 203 | |||
| 204 | ::gpiod::chip moved_chip(moved_sim.dev_path()); | ||
| 205 | |||
| 206 | - REQUIRE_THAT(chip.get_info().label(), Catch::Equals("foobar")); | ||
| 207 | + REQUIRE_THAT(chip.get_info().label(), Catch::Matchers::Equals("foobar")); | ||
| 208 | chip = ::std::move(moved_chip); | ||
| 209 | - REQUIRE_THAT(chip.get_info().label(), Catch::Equals("moved")); | ||
| 210 | + REQUIRE_THAT(chip.get_info().label(), Catch::Matchers::Equals("moved")); | ||
| 211 | } | ||
| 212 | |||
| 213 | SECTION("boolean operator") | ||
| 214 | @@ -94,7 +94,7 @@ TEST_CASE("chip properties can be read", "[chip]") | ||
| 215 | |||
| 216 | SECTION("get device path") | ||
| 217 | { | ||
| 218 | - REQUIRE_THAT(chip.path(), Catch::Equals(sim.dev_path())); | ||
| 219 | + REQUIRE_THAT(chip.path(), Catch::Matchers::Equals(sim.dev_path())); | ||
| 220 | } | ||
| 221 | |||
| 222 | SECTION("get file descriptor") | ||
| 223 | @@ -169,7 +169,7 @@ TEST_CASE("stream insertion operator works for chip", "[chip]") | ||
| 224 | "\", label=\"foobar\", num_lines=4))"; | ||
| 225 | |||
| 226 | buf << chip; | ||
| 227 | - REQUIRE_THAT(buf.str(), Catch::Equals(expected.str())); | ||
| 228 | + REQUIRE_THAT(buf.str(), Catch::Matchers::Equals(expected.str())); | ||
| 229 | } | ||
| 230 | |||
| 231 | SECTION("closed chip") | ||
| 232 | diff --git a/bindings/cxx/tests/tests-edge-event.cpp b/bindings/cxx/tests/tests-edge-event.cpp | ||
| 233 | index 19a6ab3..db387be 100644 | ||
| 234 | --- a/bindings/cxx/tests/tests-edge-event.cpp | ||
| 235 | +++ b/bindings/cxx/tests/tests-edge-event.cpp | ||
| 236 | @@ -1,7 +1,7 @@ | ||
| 237 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 238 | // SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl> | ||
| 239 | |||
| 240 | -#include <catch2/catch.hpp> | ||
| 241 | +#include <catch2/catch_all.hpp> | ||
| 242 | #include <chrono> | ||
| 243 | #include <gpiod.hpp> | ||
| 244 | #include <sstream> | ||
| 245 | diff --git a/bindings/cxx/tests/tests-info-event.cpp b/bindings/cxx/tests/tests-info-event.cpp | ||
| 246 | index 21c0ef0..f7ae309 100644 | ||
| 247 | --- a/bindings/cxx/tests/tests-info-event.cpp | ||
| 248 | +++ b/bindings/cxx/tests/tests-info-event.cpp | ||
| 249 | @@ -1,7 +1,7 @@ | ||
| 250 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 251 | // SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl> | ||
| 252 | |||
| 253 | -#include <catch2/catch.hpp> | ||
| 254 | +#include <catch2/catch_all.hpp> | ||
| 255 | #include <chrono> | ||
| 256 | #include <filesystem> | ||
| 257 | #include <gpiod.hpp> | ||
| 258 | diff --git a/bindings/cxx/tests/tests-line-config.cpp b/bindings/cxx/tests/tests-line-config.cpp | ||
| 259 | index 5e439a1..2f510fb 100644 | ||
| 260 | --- a/bindings/cxx/tests/tests-line-config.cpp | ||
| 261 | +++ b/bindings/cxx/tests/tests-line-config.cpp | ||
| 262 | @@ -1,7 +1,7 @@ | ||
| 263 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 264 | // SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl> | ||
| 265 | |||
| 266 | -#include <catch2/catch.hpp> | ||
| 267 | +#include <catch2/catch_all.hpp> | ||
| 268 | #include <gpiod.hpp> | ||
| 269 | |||
| 270 | #include "gpiosim.hpp" | ||
| 271 | diff --git a/bindings/cxx/tests/tests-line-info.cpp b/bindings/cxx/tests/tests-line-info.cpp | ||
| 272 | index 21211f2..8589da3 100644 | ||
| 273 | --- a/bindings/cxx/tests/tests-line-info.cpp | ||
| 274 | +++ b/bindings/cxx/tests/tests-line-info.cpp | ||
| 275 | @@ -1,7 +1,7 @@ | ||
| 276 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 277 | // SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl> | ||
| 278 | |||
| 279 | -#include <catch2/catch.hpp> | ||
| 280 | +#include <catch2/catch_all.hpp> | ||
| 281 | #include <gpiod.hpp> | ||
| 282 | #include <string> | ||
| 283 | |||
| 284 | @@ -35,9 +35,9 @@ TEST_CASE("get_line_info() works", "[chip][line-info]") | ||
| 285 | auto info = chip.get_line_info(0); | ||
| 286 | |||
| 287 | REQUIRE(info.offset() == 0); | ||
| 288 | - REQUIRE_THAT(info.name(), Catch::Equals("foobar")); | ||
| 289 | + REQUIRE_THAT(info.name(), Catch::Matchers::Equals("foobar")); | ||
| 290 | REQUIRE(info.used()); | ||
| 291 | - REQUIRE_THAT(info.consumer(), Catch::Equals("hog")); | ||
| 292 | + REQUIRE_THAT(info.consumer(), Catch::Matchers::Equals("hog")); | ||
| 293 | REQUIRE(info.direction() == ::gpiod::line::direction::OUTPUT); | ||
| 294 | REQUIRE_FALSE(info.active_low()); | ||
| 295 | REQUIRE(info.bias() == ::gpiod::line::bias::UNKNOWN); | ||
| 296 | @@ -74,9 +74,9 @@ TEST_CASE("line properties can be retrieved", "[line-info]") | ||
| 297 | auto info6 = chip.get_line_info(6); | ||
| 298 | |||
| 299 | REQUIRE(info4.offset() == 4); | ||
| 300 | - REQUIRE_THAT(info4.name(), Catch::Equals("baz")); | ||
| 301 | + REQUIRE_THAT(info4.name(), Catch::Matchers::Equals("baz")); | ||
| 302 | REQUIRE(info4.used()); | ||
| 303 | - REQUIRE_THAT(info4.consumer(), Catch::Equals("hog4")); | ||
| 304 | + REQUIRE_THAT(info4.consumer(), Catch::Matchers::Equals("hog4")); | ||
| 305 | REQUIRE(info4.direction() == direction::OUTPUT); | ||
| 306 | REQUIRE(info4.edge_detection() == edge::NONE); | ||
| 307 | REQUIRE_FALSE(info4.active_low()); | ||
| 308 | @@ -102,10 +102,10 @@ TEST_CASE("line_info can be copied and moved") | ||
| 309 | { | ||
| 310 | auto copy(info); | ||
| 311 | REQUIRE(copy.offset() == 2); | ||
| 312 | - REQUIRE_THAT(copy.name(), Catch::Equals("foobar")); | ||
| 313 | + REQUIRE_THAT(copy.name(), Catch::Matchers::Equals("foobar")); | ||
| 314 | /* info can still be used */ | ||
| 315 | REQUIRE(info.offset() == 2); | ||
| 316 | - REQUIRE_THAT(info.name(), Catch::Equals("foobar")); | ||
| 317 | + REQUIRE_THAT(info.name(), Catch::Matchers::Equals("foobar")); | ||
| 318 | } | ||
| 319 | |||
| 320 | SECTION("assignment operator works") | ||
| 321 | @@ -113,17 +113,17 @@ TEST_CASE("line_info can be copied and moved") | ||
| 322 | auto copy = chip.get_line_info(0); | ||
| 323 | copy = info; | ||
| 324 | REQUIRE(copy.offset() == 2); | ||
| 325 | - REQUIRE_THAT(copy.name(), Catch::Equals("foobar")); | ||
| 326 | + REQUIRE_THAT(copy.name(), Catch::Matchers::Equals("foobar")); | ||
| 327 | /* info can still be used */ | ||
| 328 | REQUIRE(info.offset() == 2); | ||
| 329 | - REQUIRE_THAT(info.name(), Catch::Equals("foobar")); | ||
| 330 | + REQUIRE_THAT(info.name(), Catch::Matchers::Equals("foobar")); | ||
| 331 | } | ||
| 332 | |||
| 333 | SECTION("move constructor works") | ||
| 334 | { | ||
| 335 | auto copy(::std::move(info)); | ||
| 336 | REQUIRE(copy.offset() == 2); | ||
| 337 | - REQUIRE_THAT(copy.name(), Catch::Equals("foobar")); | ||
| 338 | + REQUIRE_THAT(copy.name(), Catch::Matchers::Equals("foobar")); | ||
| 339 | } | ||
| 340 | |||
| 341 | SECTION("move assignment operator works") | ||
| 342 | @@ -131,7 +131,7 @@ TEST_CASE("line_info can be copied and moved") | ||
| 343 | auto copy = chip.get_line_info(0); | ||
| 344 | copy = ::std::move(info); | ||
| 345 | REQUIRE(copy.offset() == 2); | ||
| 346 | - REQUIRE_THAT(copy.name(), Catch::Equals("foobar")); | ||
| 347 | + REQUIRE_THAT(copy.name(), Catch::Matchers::Equals("foobar")); | ||
| 348 | } | ||
| 349 | } | ||
| 350 | |||
| 351 | diff --git a/bindings/cxx/tests/tests-line-request.cpp b/bindings/cxx/tests/tests-line-request.cpp | ||
| 352 | index 9632ae0..af8b979 100644 | ||
| 353 | --- a/bindings/cxx/tests/tests-line-request.cpp | ||
| 354 | +++ b/bindings/cxx/tests/tests-line-request.cpp | ||
| 355 | @@ -1,7 +1,7 @@ | ||
| 356 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 357 | // SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl> | ||
| 358 | |||
| 359 | -#include <catch2/catch.hpp> | ||
| 360 | +#include <catch2/catch_all.hpp> | ||
| 361 | #include <gpiod.hpp> | ||
| 362 | #include <sstream> | ||
| 363 | #include <stdexcept> | ||
| 364 | @@ -20,7 +20,7 @@ using pull = ::gpiosim::chip::pull; | ||
| 365 | |||
| 366 | namespace { | ||
| 367 | |||
| 368 | -class value_matcher : public Catch::MatcherBase<value> | ||
| 369 | +class value_matcher : public Catch::Matchers::MatcherBase<value> | ||
| 370 | { | ||
| 371 | public: | ||
| 372 | value_matcher(pull pull, bool active_low = false) | ||
| 373 | @@ -117,7 +117,7 @@ TEST_CASE("consumer string is set correctly", "[line-request]") | ||
| 374 | auto info = chip.get_line_info(2); | ||
| 375 | |||
| 376 | REQUIRE(info.used()); | ||
| 377 | - REQUIRE_THAT(info.consumer(), Catch::Equals("foobar")); | ||
| 378 | + REQUIRE_THAT(info.consumer(), Catch::Matchers::Equals("foobar")); | ||
| 379 | } | ||
| 380 | |||
| 381 | SECTION("empty consumer") | ||
| 382 | @@ -130,7 +130,7 @@ TEST_CASE("consumer string is set correctly", "[line-request]") | ||
| 383 | auto info = chip.get_line_info(2); | ||
| 384 | |||
| 385 | REQUIRE(info.used()); | ||
| 386 | - REQUIRE_THAT(info.consumer(), Catch::Equals("?")); | ||
| 387 | + REQUIRE_THAT(info.consumer(), Catch::Matchers::Equals("?")); | ||
| 388 | } | ||
| 389 | } | ||
| 390 | |||
| 391 | @@ -380,7 +380,7 @@ TEST_CASE("line_request can be moved", "[line-request]") | ||
| 392 | auto moved(::std::move(request)); | ||
| 393 | |||
| 394 | REQUIRE(moved.fd() == fd); | ||
| 395 | - REQUIRE_THAT(moved.offsets(), Catch::Equals(offs)); | ||
| 396 | + REQUIRE_THAT(moved.offsets(), Catch::Matchers::Equals(offs)); | ||
| 397 | } | ||
| 398 | |||
| 399 | SECTION("move assignment operator works") | ||
| 400 | @@ -388,7 +388,7 @@ TEST_CASE("line_request can be moved", "[line-request]") | ||
| 401 | another = ::std::move(request); | ||
| 402 | |||
| 403 | REQUIRE(another.fd() == fd); | ||
| 404 | - REQUIRE_THAT(another.offsets(), Catch::Equals(offs)); | ||
| 405 | + REQUIRE_THAT(another.offsets(), Catch::Matchers::Equals(offs)); | ||
| 406 | } | ||
| 407 | } | ||
| 408 | |||
| 409 | @@ -484,7 +484,7 @@ TEST_CASE("line_request stream insertion operator works", "[line-request]") | ||
| 410 | { | ||
| 411 | buf << request; | ||
| 412 | |||
| 413 | - REQUIRE_THAT(buf.str(), Catch::Equals(expected.str())); | ||
| 414 | + REQUIRE_THAT(buf.str(), Catch::Matchers::Equals(expected.str())); | ||
| 415 | } | ||
| 416 | |||
| 417 | SECTION("request released") | ||
| 418 | @@ -493,7 +493,7 @@ TEST_CASE("line_request stream insertion operator works", "[line-request]") | ||
| 419 | |||
| 420 | buf << request; | ||
| 421 | |||
| 422 | - REQUIRE_THAT(buf.str(), Catch::Equals("gpiod::line_request(released)")); | ||
| 423 | + REQUIRE_THAT(buf.str(), Catch::Matchers::Equals("gpiod::line_request(released)")); | ||
| 424 | } | ||
| 425 | } | ||
| 426 | |||
| 427 | diff --git a/bindings/cxx/tests/tests-line-settings.cpp b/bindings/cxx/tests/tests-line-settings.cpp | ||
| 428 | index dc821bb..2690331 100644 | ||
| 429 | --- a/bindings/cxx/tests/tests-line-settings.cpp | ||
| 430 | +++ b/bindings/cxx/tests/tests-line-settings.cpp | ||
| 431 | @@ -1,7 +1,7 @@ | ||
| 432 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 433 | // SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl> | ||
| 434 | |||
| 435 | -#include <catch2/catch.hpp> | ||
| 436 | +#include <catch2/catch_all.hpp> | ||
| 437 | #include <gpiod.hpp> | ||
| 438 | |||
| 439 | #include "helpers.hpp" | ||
| 440 | diff --git a/bindings/cxx/tests/tests-line.cpp b/bindings/cxx/tests/tests-line.cpp | ||
| 441 | index 319012a..abd0e08 100644 | ||
| 442 | --- a/bindings/cxx/tests/tests-line.cpp | ||
| 443 | +++ b/bindings/cxx/tests/tests-line.cpp | ||
| 444 | @@ -1,7 +1,7 @@ | ||
| 445 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 446 | // SPDX-FileCopyrightText: 2021-2022 Bartosz Golaszewski <brgl@bgdev.pl> | ||
| 447 | |||
| 448 | -#include <catch2/catch.hpp> | ||
| 449 | +#include <catch2/catch_all.hpp> | ||
| 450 | #include <gpiod.hpp> | ||
| 451 | |||
| 452 | #include "helpers.hpp" | ||
| 453 | diff --git a/bindings/cxx/tests/tests-misc.cpp b/bindings/cxx/tests/tests-misc.cpp | ||
| 454 | index f06dc39..33fc3fa 100644 | ||
| 455 | --- a/bindings/cxx/tests/tests-misc.cpp | ||
| 456 | +++ b/bindings/cxx/tests/tests-misc.cpp | ||
| 457 | @@ -1,7 +1,7 @@ | ||
| 458 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 459 | // SPDX-FileCopyrightText: 2021-2022 Bartosz Golaszewski <brgl@bgdev.pl> | ||
| 460 | |||
| 461 | -#include <catch2/catch.hpp> | ||
| 462 | +#include <catch2/catch_all.hpp> | ||
| 463 | #include <filesystem> | ||
| 464 | #include <gpiod.hpp> | ||
| 465 | #include <string> | ||
| 466 | diff --git a/bindings/cxx/tests/tests-request-config.cpp b/bindings/cxx/tests/tests-request-config.cpp | ||
| 467 | index 66eb748..d71e91b 100644 | ||
| 468 | --- a/bindings/cxx/tests/tests-request-config.cpp | ||
| 469 | +++ b/bindings/cxx/tests/tests-request-config.cpp | ||
| 470 | @@ -1,7 +1,7 @@ | ||
| 471 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 472 | // SPDX-FileCopyrightText: 2021-2022 Bartosz Golaszewski <brgl@bgdev.pl> | ||
| 473 | |||
| 474 | -#include <catch2/catch.hpp> | ||
| 475 | +#include <catch2/catch_all.hpp> | ||
| 476 | #include <cstddef> | ||
| 477 | #include <gpiod.hpp> | ||
| 478 | #include <string> | ||
| 479 | @@ -33,7 +33,7 @@ TEST_CASE("request_config can be moved", "[request-config]") | ||
| 480 | SECTION("move constructor works") | ||
| 481 | { | ||
| 482 | auto moved(::std::move(cfg)); | ||
| 483 | - REQUIRE_THAT(moved.consumer(), Catch::Equals("foobar")); | ||
| 484 | + REQUIRE_THAT(moved.consumer(), Catch::Matchers::Equals("foobar")); | ||
| 485 | REQUIRE(moved.event_buffer_size() == 64); | ||
| 486 | } | ||
| 487 | |||
| 488 | @@ -43,7 +43,7 @@ TEST_CASE("request_config can be moved", "[request-config]") | ||
| 489 | |||
| 490 | moved = ::std::move(cfg); | ||
| 491 | |||
| 492 | - REQUIRE_THAT(moved.consumer(), Catch::Equals("foobar")); | ||
| 493 | + REQUIRE_THAT(moved.consumer(), Catch::Matchers::Equals("foobar")); | ||
| 494 | REQUIRE(moved.event_buffer_size() == 64); | ||
| 495 | } | ||
| 496 | } | ||
| 497 | @@ -55,7 +55,7 @@ TEST_CASE("request_config mutators work", "[request-config]") | ||
| 498 | SECTION("set consumer") | ||
| 499 | { | ||
| 500 | cfg.set_consumer("foobar"); | ||
| 501 | - REQUIRE_THAT(cfg.consumer(), Catch::Equals("foobar")); | ||
| 502 | + REQUIRE_THAT(cfg.consumer(), Catch::Matchers::Equals("foobar")); | ||
| 503 | } | ||
| 504 | |||
| 505 | SECTION("set event_buffer_size") | ||
| 506 | @@ -77,7 +77,7 @@ TEST_CASE("request_config stream insertion operator works", "[request-config]") | ||
| 507 | |||
| 508 | ::std::string expected("gpiod::request_config(consumer='foobar', event_buffer_size=32)"); | ||
| 509 | |||
| 510 | - REQUIRE_THAT(buf.str(), Catch::Equals(expected)); | ||
| 511 | + REQUIRE_THAT(buf.str(), Catch::Matchers::Equals(expected)); | ||
| 512 | } | ||
| 513 | |||
| 514 | } /* namespace */ | ||
| 515 | diff --git a/configure.ac b/configure.ac | ||
| 516 | index a2370c5..216007e 100644 | ||
| 517 | --- a/configure.ac | ||
| 518 | +++ b/configure.ac | ||
| 519 | @@ -206,9 +206,9 @@ then | ||
| 520 | |||
| 521 | if test "x$with_tests" = xtrue | ||
| 522 | then | ||
| 523 | - PKG_CHECK_MODULES([CATCH2], [catch2],, [ | ||
| 524 | + PKG_CHECK_MODULES([CATCH2], [catch2-with-main],, [ | ||
| 525 | AC_LANG_PUSH([C++]) | ||
| 526 | - AC_CHECK_HEADERS([catch2/catch.hpp], [], [HEADER_NOT_FOUND_CXX([catch2/catch.hpp])]) | ||
| 527 | + AC_CHECK_HEADERS([catch2/catch_all.hpp], [], [HEADER_NOT_FOUND_CXX([catch2/catch_all.hpp])]) | ||
| 528 | AC_LANG_POP([C++]) | ||
| 529 | ]) | ||
| 530 | fi | ||
diff --git a/meta-oe/recipes-support/libgpiod/libgpiod_2.1.2.bb b/meta-oe/recipes-support/libgpiod/libgpiod_2.1.2.bb index 137461880b..b4665c1567 100644 --- a/meta-oe/recipes-support/libgpiod/libgpiod_2.1.2.bb +++ b/meta-oe/recipes-support/libgpiod/libgpiod_2.1.2.bb | |||
| @@ -9,6 +9,7 @@ LIC_FILES_CHKSUM = " \ | |||
| 9 | 9 | ||
| 10 | FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}-2.x:" | 10 | FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}-2.x:" |
| 11 | 11 | ||
| 12 | SRC_URI += "file://0001-bindings-cxx-Migrate-C-tests-to-use-Catch2-v3.patch" | ||
| 12 | SRC_URI[sha256sum] = "7a148a5a7d1c97a1abb40474b9a392b6edd7a42fe077dfd7ff42cfba24308548" | 13 | SRC_URI[sha256sum] = "7a148a5a7d1c97a1abb40474b9a392b6edd7a42fe077dfd7ff42cfba24308548" |
| 13 | 14 | ||
| 14 | # Enable all project features for ptest | 15 | # Enable all project features for ptest |
