diff --git a/CMakeLists.txt b/CMakeLists.txt index 387d8df..ef037b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -288,25 +288,11 @@ foreach(file ${source_all}) endforeach() # -## Add a rule to download the catch unit test framework +## Catch unit test framework # -include(ExternalProject) -ExternalProject_Add(catch - GIT_REPOSITORY "https://codeberg.org/poezio/Catch.git" - GIT_TAG "v1.5.9" - PREFIX "external" - UPDATE_COMMAND "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - ) -set_target_properties(catch PROPERTIES EXCLUDE_FROM_ALL TRUE) -ExternalProject_Get_Property(catch SOURCE_DIR) -if(NOT EXISTS ${CMAKE_SOURCE_DIR}/tests/catch.hpp) - target_include_directories(test_suite - PUBLIC "${SOURCE_DIR}/single_include/" - ) - add_dependencies(test_suite catch) +find_package(Catch2) +if(Catch2_FOUND) + target_link_libraries(test_suite Catch2::Catch2WithMain) endif() # diff --git a/docker/test/alpine/Dockerfile b/docker/test/alpine/Dockerfile index 8ce5d4d..fda5388 100644 --- a/docker/test/alpine/Dockerfile +++ b/docker/test/alpine/Dockerfile @@ -20,6 +20,7 @@ botan3-dev \ util-linux-dev \ libgcrypt-dev \ postgresql-dev \ +catch2-3 \ valgrind \ py3-pip \ py3-lxml \ diff --git a/docker/test/debian/Dockerfile b/docker/test/debian/Dockerfile index 3483c2d..b7f393b 100644 --- a/docker/test/debian/Dockerfile +++ b/docker/test/debian/Dockerfile @@ -21,6 +21,7 @@ libsystemd-dev \ uuid-dev \ libgcrypt20-dev \ libpq-dev \ +libcatch2-dev \ valgrind \ libasan6 \ libubsan1 \ @@ -28,4 +29,4 @@ python3-lxml \ python3-slixmpp \ wget -RUN wget "https://github.com/oragono/oragono/releases/download/v2.0.0/oragono-2.0.0-linux-x64.tar.gz" && tar xvf oragono-2.0.0-linux-x64.tar.gz && cp oragono-2.0.0-linux-x64/oragono /usr/local/bin +RUN wget "https://github.com/ergochat/ergo/releases/download/v2.0.0/oragono-2.0.0-linux-x64.tar.gz" && tar xvf oragono-2.0.0-linux-x64.tar.gz && cp oragono-2.0.0-linux-x64/oragono /usr/local/bin diff --git a/docker/test/fedora/Dockerfile b/docker/test/fedora/Dockerfile index a74ab9d..1ae3c4a 100644 --- a/docker/test/fedora/Dockerfile +++ b/docker/test/fedora/Dockerfile @@ -24,6 +24,7 @@ postgresql-devel \ lcov \ libasan \ libubsan \ +catch \ valgrind \ python3-pip \ python3-lxml \ @@ -39,4 +40,4 @@ rpmdevtools \ RUN pip3 install --break-system-packages slixmpp # Install oragono, for e2e tests -RUN wget "https://github.com/oragono/oragono/releases/download/v2.0.0/oragono-2.0.0-linux-x64.tar.gz" && tar xvf oragono-2.0.0-linux-x64.tar.gz && cp oragono-2.0.0-linux-x64/oragono /usr/local/bin +RUN wget "https://github.com/ergochat/ergo/releases/download/v2.0.0/oragono-2.0.0-linux-x64.tar.gz" && tar xvf oragono-2.0.0-linux-x64.tar.gz && cp oragono-2.0.0-linux-x64/oragono /usr/local/bin diff --git a/tests/colors.cpp b/tests/colors.cpp index 9a6bf9c..cb705ab 100644 --- a/tests/colors.cpp +++ b/tests/colors.cpp @@ -1,4 +1,4 @@ -#include "catch.hpp" +#include "catch2/catch_test_macros.hpp" #include #include diff --git a/tests/config.cpp b/tests/config.cpp index ec9844f..30d801f 100644 --- a/tests/config.cpp +++ b/tests/config.cpp @@ -1,4 +1,4 @@ -#include "catch.hpp" +#include "catch2/catch_test_macros.hpp" #include "io_tester.hpp" #include diff --git a/tests/database.cpp b/tests/database.cpp index 070a460..e616074 100644 --- a/tests/database.cpp +++ b/tests/database.cpp @@ -1,4 +1,4 @@ -#include "catch.hpp" +#include "catch2/catch_test_macros.hpp" #include diff --git a/tests/encoding.cpp b/tests/encoding.cpp index b5192ff..fc8c655 100644 --- a/tests/encoding.cpp +++ b/tests/encoding.cpp @@ -1,4 +1,4 @@ -#include "catch.hpp" +#include "catch2/catch_test_macros.hpp" #include diff --git a/tests/iid.cpp b/tests/iid.cpp index d8f17ad..dc264fd 100644 --- a/tests/iid.cpp +++ b/tests/iid.cpp @@ -1,4 +1,4 @@ -#include "catch.hpp" +#include "catch2/catch_test_macros.hpp" #include #include diff --git a/tests/io_tester.cpp b/tests/io_tester.cpp index 19c97c9..1d6d59b 100644 --- a/tests/io_tester.cpp +++ b/tests/io_tester.cpp @@ -1,5 +1,5 @@ #include "io_tester.hpp" -#include "catch.hpp" +#include "catch2/catch_test_macros.hpp" #include /** diff --git a/tests/irc.cpp b/tests/irc.cpp index 0f30f15..a113823 100644 --- a/tests/irc.cpp +++ b/tests/irc.cpp @@ -1,4 +1,4 @@ -#include "catch.hpp" +#include "catch2/catch_test_macros.hpp" #include diff --git a/tests/jid.cpp b/tests/jid.cpp index 592d6f3..cc7d74b 100644 --- a/tests/jid.cpp +++ b/tests/jid.cpp @@ -1,4 +1,4 @@ -#include "catch.hpp" +#include "catch2/catch_test_macros.hpp" #include #include diff --git a/tests/logger.cpp b/tests/logger.cpp index 1e3392a..871dbcf 100644 --- a/tests/logger.cpp +++ b/tests/logger.cpp @@ -1,4 +1,4 @@ -#include "catch.hpp" +#include "catch2/catch_test_macros.hpp" #include #include diff --git a/tests/network.cpp b/tests/network.cpp index a52eb6a..309659a 100644 --- a/tests/network.cpp +++ b/tests/network.cpp @@ -1,4 +1,4 @@ -#include "catch.hpp" +#include "catch2/catch_test_macros.hpp" #include #include diff --git a/tests/test.cpp b/tests/test.cpp deleted file mode 100644 index 0c7c351..0000000 --- a/tests/test.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#define CATCH_CONFIG_MAIN -#include "catch.hpp" diff --git a/tests/timed_events.cpp b/tests/timed_events.cpp index fece422..b8ccf6c 100644 --- a/tests/timed_events.cpp +++ b/tests/timed_events.cpp @@ -1,21 +1,7 @@ -#include "catch.hpp" +#include "catch2/catch_test_macros.hpp" #include -/** - * Let Catch know how to display std::chrono::duration values - */ -namespace Catch -{ - template struct StringMaker> - { - static std::string convert(const std::chrono::duration& value) - { - return std::to_string(std::chrono::duration_cast(value).count()) + "ms"; - } - }; -} - /** * TODO, use a mock clock instead of relying on the real time with a sleep: * it’s unreliable on heavy load. diff --git a/tests/utils.cpp b/tests/utils.cpp index 6151733..5a9f0a0 100644 --- a/tests/utils.cpp +++ b/tests/utils.cpp @@ -1,4 +1,4 @@ -#include "catch.hpp" +#include "catch2/catch_test_macros.hpp" #include #include diff --git a/tests/uuid.cpp b/tests/uuid.cpp index 12c6c32..4f9bdfb 100644 --- a/tests/uuid.cpp +++ b/tests/uuid.cpp @@ -1,4 +1,4 @@ -#include "catch.hpp" +#include "catch2/catch_test_macros.hpp" #include diff --git a/tests/xmpp.cpp b/tests/xmpp.cpp index c49c2fd..d88f8d7 100644 --- a/tests/xmpp.cpp +++ b/tests/xmpp.cpp @@ -1,4 +1,4 @@ -#include "catch.hpp" +#include "catch2/catch_test_macros.hpp" #include #include