dep: Add catch2 unit test framework and wire it up

To enable the test suite, make sure to configure CMake with -DBUILD_TESTING=1 , since it is disabled by default. The catch2 dependency will be downloaded during configure time.

Also add a new target "tests-common", which includes unit tests for the "common" project. To finally run the tests use the "test" target.

CircleCI: Run unit tests
(cherry picked from commit 6a28ee7b2a4269aa7e43265d1cd0067537e3e883)
This commit is contained in:
Carbenium authored and funjoker committed 2021-07-29 19:07:52 +02:00
1 parent 99a129d5bc
commit 831c45b1da
8 files changed
+83 -4

No files matched your search

+10 -2
View File
@@ -23,7 +23,7 @@ jobs:
command: |
mkdir bin
cd bin
cmake ../ -DWITH_WARNINGS=1 -DWITH_COREDEBUG=0 -DUSE_COREPCH=1 -DUSE_SCRIPTPCH=1 -DTOOLS=1 -DSCRIPTS=static -DSERVERS=1 -DNOJEM=0 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_C_FLAGS_DEBUG="-DNDEBUG" -DCMAKE_CXX_FLAGS_DEBUG="-DNDEBUG" -DCMAKE_INSTALL_PREFIX=check_install
cmake ../ -DWITH_WARNINGS=1 -DWITH_COREDEBUG=0 -DUSE_COREPCH=1 -DUSE_SCRIPTPCH=1 -DTOOLS=1 -DSCRIPTS=static -DSERVERS=1 -DNOJEM=0 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_C_FLAGS_DEBUG="-DNDEBUG" -DCMAKE_CXX_FLAGS_DEBUG="-DNDEBUG" -DCMAKE_INSTALL_PREFIX=check_install -DBUILD_TESTING=1
cd ..
- run:
name: SQL checks
@@ -44,7 +44,15 @@ jobs:
command: |
cd bin
make -j 4 -k && make install
cd check_install/bin
- run:
name: Unit tests
command: |
cd bin
make test
- run:
name: Check executables
command: |
cd bin/check_install/bin
./bnetserver --version
./worldserver --version
- setup_remote_docker: