I've playing around with cpp20, lately I've been trying to create some tests for my project, but every time I try to test anything related to strings I'd get a SIGSEGV signal.
This is an example of my tests
#include <catch2/catch_all.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers_string.hpp>
#include <string>
using Catch::Matchers::ContainsSubstring;
using Catch::Matchers::EndsWith;
import mod;
TEST_CASE("true") {
REQUIRE(1 == 1);
}
TEST_CASE("matcher") {
REQUIRE_THAT("epa la arepa", EndsWith("arepa"));
}
This is the output I'm getting
[build] Build finished with exit code 0
[proc] Executing command: /usr/bin/ctest -j34 -C Debug -T test --output-on-failure
[ctest] Site: Siel
[ctest] Build name: Linux-g++-11
[ctest] Test project /home/siel/dev/learncpp20/profc++/build
[ctest] Start 1: true
[ctest] Start 2: matcher
[ctest] 1/2 Test #1: true ............................. Passed 0.00 sec
[ctest] 2/2 Test #2: matcher ..........................***Exception: SegFault 0.00 sec
[ctest] Filters: matcher
[ctest] Randomness seeded to: 367308665
[ctest]
[ctest] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ctest] tests is a Catch2 v3.0.0-preview.5 host application.
[ctest] Run with -? for options
[ctest]
[ctest] -------------------------------------------------------------------------------
[ctest] matcher
[ctest] -------------------------------------------------------------------------------
[ctest] /home/siel/dev/learncpp20/profc++/test/test_func.cpp:27
[ctest] ...............................................................................
[ctest]
[ctest] /home/siel/dev/learncpp20/profc++/test/test_func.cpp:27: FAILED:
[ctest] due to a fatal error condition:
[ctest] SIGSEGV - Segmentation violation signal
[ctest]
[ctest] ===============================================================================
[ctest] test cases: 1 | 1 failed
[ctest] assertions: 1 | 1 failed
[ctest]
[ctest]
[ctest]
[ctest] 50% tests passed, 1 tests failed out of 2
[ctest]
[ctest] Total Test time (real) = 0.00 sec
[ctest]
[ctest] The following tests FAILED:
[ctest] 2 - matcher (SEGFAULT)
[ctest] Errors while running CTest
[ctest] CTest finished with return code 8
This is a link to a public repo with this basic example: https://github.com/Siel/cpp_tests
Any ideas?
--EDIT
This is the output of 'cmake --build build --verbose'
❯ cmake --build build --verbose
/usr/bin/cmake -S/home/siel/dev/learncpp20/profc++ -B/home/siel/dev/learncpp20/profc++/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/siel/dev/learncpp20/profc++/build/CMakeFiles /home/siel/dev/learncpp20/profc++/build/CMakeFiles/progress.marks
/usr/bin/make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/siel/dev/learncpp20/profc++/build'
/usr/bin/make -f CMakeFiles/initial.dir/build.make CMakeFiles/initial.dir/depend
make[2]: Entering directory '/home/siel/dev/learncpp20/profc++/build'
cd /home/siel/dev/learncpp20/profc++/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/siel/dev/learncpp20/profc++ /home/siel/dev/learncpp20/profc++ /home/siel/dev/learncpp20/profc++/build /home/siel/dev/learncpp20/profc++/build /home/siel/dev/learncpp20/profc++/build/CMakeFiles/initial.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/siel/dev/learncpp20/profc++/build'
/usr/bin/make -f CMakeFiles/initial.dir/build.make CMakeFiles/initial.dir/build
make[2]: Entering directory '/home/siel/dev/learncpp20/profc++/build'
make[2]: Nothing to be done for 'CMakeFiles/initial.dir/build'.
make[2]: Leaving directory '/home/siel/dev/learncpp20/profc++/build'
[ 3%] Built target initial
/usr/bin/make -f lib/Catch2/src/CMakeFiles/Catch2.dir/build.make lib/Catch2/src/CMakeFiles/Catch2.dir/depend
make[2]: Entering directory '/home/siel/dev/learncpp20/profc++/build'
cd /home/siel/dev/learncpp20/profc++/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/siel/dev/learncpp20/profc++ /home/siel/dev/learncpp20/profc++/lib/Catch2/src /home/siel/dev/learncpp20/profc++/build /home/siel/dev/learncpp20/profc++/build/lib/Catch2/src /home/siel/dev/learncpp20/profc++/build/lib/Catch2/src/CMakeFiles/Catch2.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/siel/dev/learncpp20/profc++/build'
/usr/bin/make -f lib/Catch2/src/CMakeFiles/Catch2.dir/build.make lib/Catch2/src/CMakeFiles/Catch2.dir/build
make[2]: Entering directory '/home/siel/dev/learncpp20/profc++/build'
make[2]: Nothing to be done for 'lib/Catch2/src/CMakeFiles/Catch2.dir/build'.
make[2]: Leaving directory '/home/siel/dev/learncpp20/profc++/build'
[ 93%] Built target Catch2
/usr/bin/make -f lib/Catch2/src/CMakeFiles/Catch2WithMain.dir/build.make lib/Catch2/src/CMakeFiles/Catch2WithMain.dir/depend
make[2]: Entering directory '/home/siel/dev/learncpp20/profc++/build'
cd /home/siel/dev/learncpp20/profc++/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/siel/dev/learncpp20/profc++ /home/siel/dev/learncpp20/profc++/lib/Catch2/src /home/siel/dev/learncpp20/profc++/build /home/siel/dev/learncpp20/profc++/build/lib/Catch2/src /home/siel/dev/learncpp20/profc++/build/lib/Catch2/src/CMakeFiles/Catch2WithMain.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/siel/dev/learncpp20/profc++/build'
/usr/bin/make -f lib/Catch2/src/CMakeFiles/Catch2WithMain.dir/build.make lib/Catch2/src/CMakeFiles/Catch2WithMain.dir/build
make[2]: Entering directory '/home/siel/dev/learncpp20/profc++/build'
make[2]: Nothing to be done for 'lib/Catch2/src/CMakeFiles/Catch2WithMain.dir/build'.
make[2]: Leaving directory '/home/siel/dev/learncpp20/profc++/build'
[ 96%] Built target Catch2WithMain
/usr/bin/make -f CMakeFiles/tests.dir/build.make CMakeFiles/tests.dir/depend
make[2]: Entering directory '/home/siel/dev/learncpp20/profc++/build'
cd /home/siel/dev/learncpp20/profc++/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/siel/dev/learncpp20/profc++ /home/siel/dev/learncpp20/profc++ /home/siel/dev/learncpp20/profc++/build /home/siel/dev/learncpp20/profc++/build /home/siel/dev/learncpp20/profc++/build/CMakeFiles/tests.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/siel/dev/learncpp20/profc++/build'
/usr/bin/make -f CMakeFiles/tests.dir/build.make CMakeFiles/tests.dir/build
make[2]: Entering directory '/home/siel/dev/learncpp20/profc++/build'
make[2]: Nothing to be done for 'CMakeFiles/tests.dir/build'.
make[2]: Leaving directory '/home/siel/dev/learncpp20/profc++/build'
[100%] Built target tests
make[1]: Leaving directory '/home/siel/dev/learncpp20/profc++/build'
/usr/bin/cmake -E cmake_progress_start /home/siel/dev/learncpp20/profc++/build/CMakeFiles 0
This is the full log after a cmake clean: https://gist.github.com/Siel/afadbcfdeae3f74c7cb1f70b457b89d8