Skip to content

Commit

Permalink
Update to Catch2 v3.6.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
wilx committed Jul 6, 2024
1 parent da80ec7 commit 0d272cc
Show file tree
Hide file tree
Showing 24 changed files with 317 additions and 236 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ configure_file(${DEFINES_HXX_CMAKE} ${DEFINES_HXX} @ONLY)

include_directories (${log4cplus_SOURCE_DIR}/include
${log4cplus_SOURCE_DIR}/threadpool
${log4cplus_SOURCE_DIR}/catch/single_include/catch2
${log4cplus_SOURCE_DIR}/catch/extras
${log4cplus_BINARY_DIR}/include
)

Expand Down
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
AM_CPPFLAGS = -I$(top_srcdir)/include \
-I$(top_srcdir)/threadpool \
-I$(top_builddir)/include \
-I$(top_srcdir)/catch/single_include/catch2 \
-I$(top_srcdir)/catch/extras \
-DCATCH_CONFIG_PREFIX_ALL=1 \
@LOG4CPLUS_NDEBUG@
AM_CXXFLAGS=@LOG4CPLUS_PROFILING_CXXFLAGS@ @LOG4CPLUS_LTO_CXXFLAGS@
Expand Down
2 changes: 1 addition & 1 deletion Makefile.am.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ am
AM_CPPFLAGS = -I$(top_srcdir)/include \
-I$(top_srcdir)/threadpool \
-I$(top_builddir)/include \
-I$(top_srcdir)/catch/single_include/catch2 \
-I$(top_srcdir)/catch/extras \
-DCATCH_CONFIG_PREFIX_ALL=1 \
@LOG4CPLUS_NDEBUG@
AM_CXXFLAGS=@LOG4CPLUS_PROFILING_CXXFLAGS@ @LOG4CPLUS_LTO_CXXFLAGS@
Expand Down
472 changes: 266 additions & 206 deletions Makefile.in

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion catch
Submodule catch updated from 182c91 to 4e8d92
14 changes: 14 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,8 @@ CXXDEPMODE
ac_ct_CXX
CXXFLAGS
CXX
ENABLE_UNIT_TESTS_FALSE
ENABLE_UNIT_TESTS_TRUE
ENABLE_TESTS_FALSE
ENABLE_TESTS_TRUE
BUILD_WITH_WCHAR_T_SUPPORT
Expand Down Expand Up @@ -5726,6 +5728,14 @@ else case e in #(
esac
fi

if test "x$enable_unit_tests" = "xyes"; then
ENABLE_UNIT_TESTS_TRUE=
ENABLE_UNIT_TESTS_FALSE='#'
else
ENABLE_UNIT_TESTS_TRUE='#'
ENABLE_UNIT_TESTS_FALSE=
fi


if test "x$enable_unit_tests" = "xyes"
then :
Expand Down Expand Up @@ -28860,6 +28870,10 @@ if test -z "${ENABLE_TESTS_TRUE}" && test -z "${ENABLE_TESTS_FALSE}"; then
as_fn_error $? "conditional \"ENABLE_TESTS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${ENABLE_UNIT_TESTS_TRUE}" && test -z "${ENABLE_UNIT_TESTS_FALSE}"; then
as_fn_error $? "conditional \"ENABLE_UNIT_TESTS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
Expand Down
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ dnl Enable unit tests
LOG4CPLUS_ARG_ENABLE([unit-tests],
[Enable unit tests [default=no]],
[enable_unit_tests=no])
AM_CONDITIONAL([ENABLE_UNIT_TESTS],
[test "x$enable_unit_tests" = "xyes"])

LOG4CPLUS_DEFINE_MACRO_IF([LOG4CPLUS_WITH_UNIT_TESTS],
[Defined to enable unit tests.],
Expand Down
3 changes: 1 addition & 2 deletions scripts/doautoreconf.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/sh

export AUTOMAKE_SUFFIX=-1.16j
#export AUTOMAKE_SUFFIX=-1.16.5
export AUTOMAKE_SUFFIX=-1.16.5
export AUTOCONF_SUFFIX=-2.72
export LIBTOOL_SUFFIX=-2.4.7

Expand Down
11 changes: 11 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ elseif (WIN32)
#set (log4cplus_postfix "${log4cplus_postfix}S")
endif ()

find_package (Boost
COMPONENTS iostreams)
if (Boost_FOUND)
set (log4cplus_sources ${log4cplus_sources}
boost_tests.cxx
${CMAKE_CURRENT_SOURCE_DIR}/catch/extras/catch_amalgamated.cpp
)
set (unit_tests_libs ${log4cplus_sources}
Boost::iostreams)
endif (Boost_FOUND)

# Define _GNU_SOURCE so that functions like `pipe2()` are visible.
add_compile_definitions (_GNU_SOURCE=1)
if (WIN32)
Expand Down
9 changes: 6 additions & 3 deletions src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
lib_LTLIBRARIES = liblog4cplus.la

SINGLE_THREADED_SRC = \
LIB_SRC = \
%D%/appenderattachableimpl.cxx \
%D%/appender.cxx \
%D%/asyncappender.cxx \
Expand Down Expand Up @@ -56,8 +56,11 @@ SINGLE_THREADED_SRC = \
%D%/version.cxx \
%D%/win32consoleappender.cxx \
%D%/win32debugappender.cxx

LIB_SRC = $(SINGLE_THREADED_SRC)
if ENABLE_UNIT_TESTS
LIB_SRC+= \
%D%/boost_tests.cxx \
$(top_srcdir)/catch/extras/catch_amalgamated.cpp
endif

common_liblog4cplus_la_cppflags = $(AM_CPPFLAGS) -DINSIDE_LOG4CPLUS
liblog4cplus_la_CPPFLAGS = $(common_liblog4cplus_la_cppflags)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/boost_tests.cxx → src/boost_tests.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <boost/iostreams/device/back_inserter.hpp>

#if defined (LOG4CPLUS_WITH_UNIT_TESTS)
#include <catch.hpp>
#include <catch_amalgamated.hpp>


namespace log4cplus
Expand Down
2 changes: 1 addition & 1 deletion src/fileappender.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#endif

#if defined (LOG4CPLUS_WITH_UNIT_TESTS)
#include <catch.hpp>
#include <catch_amalgamated.hpp>
#endif


Expand Down
2 changes: 1 addition & 1 deletion src/filter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <log4cplus/logger.h>
#include <log4cplus/ndc.h>
#include <log4cplus/mdc.h>
#include <catch.hpp>
#include <catch_amalgamated.hpp>
#endif


Expand Down
2 changes: 1 addition & 1 deletion src/global-init.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
// Include full Windows.h early for Catch.
# include <log4cplus/config/windowsh-inc-full.h>
# define CATCH_CONFIG_RUNNER
# include <catch.hpp>
# include <catch_amalgamated.hpp>
#endif

#include <log4cplus/initializer.h>
Expand Down
2 changes: 1 addition & 1 deletion src/loggingmacros.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <log4cplus/loggingmacros.h>

#if defined (LOG4CPLUS_WITH_UNIT_TESTS)
#include <catch.hpp>
#include <catch_amalgamated.hpp>
#endif


Expand Down
2 changes: 1 addition & 1 deletion src/mdc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <log4cplus/internal/internal.h>

#if defined (LOG4CPLUS_WITH_UNIT_TESTS)
#include <catch.hpp>
#include <catch_amalgamated.hpp>
#endif


Expand Down
2 changes: 1 addition & 1 deletion src/ndc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <algorithm>

#if defined (LOG4CPLUS_WITH_UNIT_TESTS)
#include <catch.hpp>
#include <catch_amalgamated.hpp>
#endif


Expand Down
2 changes: 1 addition & 1 deletion src/objectregistry.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <log4cplus/thread/threads.h>

#if defined (LOG4CPLUS_WITH_UNIT_TESTS)
#include <catch.hpp>
#include <catch_amalgamated.hpp>
#endif

namespace log4cplus::spi {
Expand Down
2 changes: 1 addition & 1 deletion src/property.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#include <log4cplus/configurator.h>

#if defined (LOG4CPLUS_WITH_UNIT_TESTS)
#include <catch.hpp>
#include <catch_amalgamated.hpp>
#endif


Expand Down
2 changes: 1 addition & 1 deletion src/snprintf.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#endif

#if defined (LOG4CPLUS_WITH_UNIT_TESTS)
#include <catch.hpp>
#include <catch_amalgamated.hpp>
#endif


Expand Down
2 changes: 1 addition & 1 deletion src/socket.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <log4cplus/internal/internal.h>

#if defined (LOG4CPLUS_WITH_UNIT_TESTS)
#include <catch.hpp>
#include <catch_amalgamated.hpp>
#endif

namespace log4cplus::helpers {
Expand Down
2 changes: 1 addition & 1 deletion src/socketbuffer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#endif

#if defined (LOG4CPLUS_WITH_UNIT_TESTS)
#include <catch.hpp>
#include <catch_amalgamated.hpp>
#endif


Expand Down
2 changes: 1 addition & 1 deletion src/stringhelper.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <cassert>

#if defined (LOG4CPLUS_WITH_UNIT_TESTS)
#include <catch.hpp>
#include <catch_amalgamated.hpp>
#include <limits>
#endif

Expand Down
8 changes: 0 additions & 8 deletions tests/unit_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
set (unit_tests_sources unit_tests.cxx)
set (unit_tests_libs ${log4cplus})

find_package (Boost
COMPONENTS iostreams)
if (Boost_FOUND)
set (unit_tests_sources ${unit_tests_sources}
boost_tests.cxx)
set (unit_tests_libs ${unit_tests_libs}
Boost::iostreams)
endif (Boost_FOUND)

add_executable (unit_tests ${unit_tests_sources})
target_link_libraries (unit_tests PUBLIC ${unit_tests_libs})
Expand Down

0 comments on commit 0d272cc

Please sign in to comment.