From 2ba7798a7bac4fc8268d34338e2c0988a3c67c59 Mon Sep 17 00:00:00 2001 From: Alexander Stein Date: Wed, 7 Aug 2019 21:51:30 +0200 Subject: [PATCH] bindings: cxx: split out catch's main() Compiling the source using CATCH_CONFIG_MAIN to provide main() takes several seconds, so split it out from any library testing code, so it really needs to be built once only. Signed-off-by: Alexander Stein [Bartosz: added the copyright notice for consistency with other files] Signed-off-by: Bartosz Golaszewski --- bindings/cxx/tests/Makefile.am | 3 ++- bindings/cxx/tests/gpiod-cxx-test-main.cpp | 9 +++++++++ bindings/cxx/tests/gpiod-cxx-test.cpp | 2 -- 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 bindings/cxx/tests/gpiod-cxx-test-main.cpp diff --git a/bindings/cxx/tests/Makefile.am b/bindings/cxx/tests/Makefile.am index d1da0d3..5800a23 100644 --- a/bindings/cxx/tests/Makefile.am +++ b/bindings/cxx/tests/Makefile.am @@ -15,7 +15,8 @@ AM_LDFLAGS += -pthread bin_PROGRAMS = gpiod-cxx-test -gpiod_cxx_test_SOURCES = gpiod-cxx-test.cpp \ +gpiod_cxx_test_SOURCES = gpiod-cxx-test-main.cpp \ + gpiod-cxx-test.cpp \ gpio-mockup.cpp \ gpio-mockup.hpp \ tests-chip.cpp \ diff --git a/bindings/cxx/tests/gpiod-cxx-test-main.cpp b/bindings/cxx/tests/gpiod-cxx-test-main.cpp new file mode 100644 index 0000000..5494bee --- /dev/null +++ b/bindings/cxx/tests/gpiod-cxx-test-main.cpp @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * This file is part of libgpiod. + * + * Copyright (C) 2019 Bartosz Golaszewski + */ + +#define CATCH_CONFIG_MAIN +#include diff --git a/bindings/cxx/tests/gpiod-cxx-test.cpp b/bindings/cxx/tests/gpiod-cxx-test.cpp index 236fd2d..e110a3c 100644 --- a/bindings/cxx/tests/gpiod-cxx-test.cpp +++ b/bindings/cxx/tests/gpiod-cxx-test.cpp @@ -5,8 +5,6 @@ * Copyright (C) 2019 Bartosz Golaszewski */ -#define CATCH_CONFIG_MAIN -#include #include #include #include -- 2.30.2