MRPT / mrpt

:zap: The Mobile Robot Programming Toolkit (MRPT)
https://docs.mrpt.org/reference/latest/
BSD 3-Clause "New" or "Revised" License
1.93k stars 630 forks source link

Define callstack exceptions in unit test #1147

Closed jolting closed 3 years ago

jolting commented 3 years ago

Modifies unit test based on the setting.


I acknowledge to have:

(Notify: @MRPT/owners )

jolting commented 3 years ago

With MRPT_EXCEPTIONS_WITH_CALL_STACK:BOOL=OFF

Current master produces this error

[----------] 4 tests from exception
[ RUN      ] exception.stackedExceptionBasic
[       OK ] exception.stackedExceptionBasic (10 ms)
[ RUN      ] exception.stackedExceptionComplex
Segmentation fault
make[3]: *** [tests/CMakeFiles/run_tests_mrpt_core.dir/build.make:57: tests/CMakeFiles/run_tests_mrpt_core] Error 139
make[2]: *** [CMakeFiles/Makefile2:10359: tests/CMakeFiles/run_tests_mrpt_core.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:10366: tests/CMakeFiles/run_tests_mrpt_core.dir/rule] Error 2
make: *** [Makefile:3200: run_tests_mrpt_core] Error 2

current develop produces

[ RUN      ] exception.stackedExceptionComplex
/workspace/mrpt/libs/core/src/exception_unittest.cpp:55: Failure
Expected: (num_lines) > (10), actual: 1 vs 10
/workspace/mrpt/libs/core/src/exception_unittest.cpp:25: [void test_except_3rd_lvl(T) [with T = int]] Aw!

/workspace/mrpt/libs/core/src/exception_unittest.cpp:57: Failure
Value of: sExc.find("Message:  Aw!") != std::string::npos
  Actual: false
Expected: true
/workspace/mrpt/libs/core/src/exception_unittest.cpp:25: [void test_except_3rd_lvl(T) [with T = int]] Aw!

/workspace/mrpt/libs/core/src/exception_unittest.cpp:61: Failure
Value of: sExc.find("test_except_toplevel") != std::string::npos
  Actual: false
Expected: true
/workspace/mrpt/libs/core/src/exception_unittest.cpp:25: [void test_except_3rd_lvl(T) [with T = int]] Aw!

[  FAILED  ] exception.stackedExceptionComplex (10 ms)

This allows all core tests to pass.

jlblancoc commented 3 years ago

Brilliant, thanks!

The CI build matrix is not large enough... :-)