[Build:Tests] SegFault during tests when build with optimizations
CoreCtrl version: HEAD on master
branch
Distribution: N/A
Kernel version: 6.1.12
GPU model: N/A
GPU driver: N/A
GPU driver parameters: N/A
Please, add more info if needed, like desktop enviroment or other system components.
Description of the bug
When optimizations are enabled in compiler the testing framework fails to execute. I believe it's something to do with catch2 not liking compiler optimizations but couldn't track it down.
Reproduction
➜ CXXFLAGS="-O2" cmake -Bbuild -GNinja -DBUILD_TESTING=ON -Wno-dev
-- The CXX compiler identification is GNU 12.2.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.0")
-- Checking for module 'botan-2'
-- Found botan-2, version 2.19.3
Using bundled units library
Using bundled easyloggingpp library
-- Checking for module 'dbus-1'
-- Found dbus-1, version 1.14.6
D-Bus files will be installed into /usr/share/dbus-1
-- Checking for module 'polkit-gobject-1'
-- Found polkit-gobject-1, version 122
Using bundled Catch2 library
Using bundled trompeloeil library
-- Configuring done
-- Generating done
-- Build files have been written to: /home/inglor/workspace/junk/corectrl/build
➜ cmake --build build
[1/339] Generating /home/inglor/workspace/junk/corectrl/src/translations/lang_en_EN.qm
Updating '/home/inglor/workspace/junk/corectrl/src/translations/lang_en_EN.qm'...
Generated 178 translation(s) (178 finished and 0 unfinished)
[2/339] Generating /home/inglor/workspace/junk/corectrl/src/translations/lang_bg_BG.qm
Updating '/home/inglor/workspace/junk/corectrl/src/translations/lang_bg_BG.qm'...
Generated 176 translation(s) (175 finished and 1 unfinished)
Ignored 2 untranslated source text(s)
[3/339] Generating /home/inglor/workspace/junk/corectrl/src/translations/lang_ca_ES.qm
Updating '/home/inglor/workspace/junk/corectrl/src/translations/lang_ca_ES.qm'...
Generated 178 translation(s) (178 finished and 0 unfinished)
[4/339] Generating /home/inglor/workspace/junk/corectrl/src/translations/lang_cs_CZ.qm
Updating '/home/inglor/workspace/junk/corectrl/src/translations/lang_cs_CZ.qm'...
Generated 178 translation(s) (178 finished and 0 unfinished)
[5/339] Generating /home/inglor/workspace/junk/corectrl/src/translations/lang_de_DE.qm
Updating '/home/inglor/workspace/junk/corectrl/src/translations/lang_de_DE.qm'...
Generated 178 translation(s) (178 finished and 0 unfinished)
[6/339] Generating /home/inglor/workspace/junk/corectrl/src/translations/lang_es_ES.qm
Updating '/home/inglor/workspace/junk/corectrl/src/translations/lang_es_ES.qm'...
Generated 178 translation(s) (178 finished and 0 unfinished)
[7/339] Generating /home/inglor/workspace/junk/corectrl/src/translations/lang_fr_FR.qm
Updating '/home/inglor/workspace/junk/corectrl/src/translations/lang_fr_FR.qm'...
Generated 177 translation(s) (177 finished and 0 unfinished)
Ignored 1 untranslated source text(s)
[8/339] Generating /home/inglor/workspace/junk/corectrl/src/translations/lang_nl_NL.qm
Updating '/home/inglor/workspace/junk/corectrl/src/translations/lang_nl_NL.qm'...
Generated 178 translation(s) (178 finished and 0 unfinished)
[9/339] Generating /home/inglor/workspace/junk/corectrl/src/translations/lang_ru_RU.qm
Updating '/home/inglor/workspace/junk/corectrl/src/translations/lang_ru_RU.qm'...
Generated 178 translation(s) (178 finished and 0 unfinished)
[339/339] Linking CXX executable tests/test_all
➜ CTEST_OUTPUT_ON_FAILURE=1 ninja -C build test
ninja: Entering directory `build'
[0/1] Running tests...
Test project /home/inglor/workspace/junk/corectrl/build
Start 1: test_all
1/1 Test #1: test_all .........................***Exception: SegFault 0.12 sec
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test_all is a Catch v2.13.10 host application.
Run with -? for options
-------------------------------------------------------------------------------
StringUtils tests
parseVersion
Returns 0.0.0 version when the input string is not in 'mayor.minor.patch'
format
-------------------------------------------------------------------------------
/home/inglor/workspace/junk/corectrl/tests/src/test_stringutils.cpp:76
...............................................................................
/home/inglor/workspace/junk/corectrl/tests/src/test_stringutils.cpp:76: FAILED:
due to a fatal error condition:
SIGSEGV - Segmentation violation signal
===============================================================================
test cases: 56 | 55 passed | 1 failed
assertions: 1048 | 1047 passed | 1 failed
0% tests passed, 1 tests failed out of 1
Total Test time (real) = 0.12 sec
The following tests FAILED:
1 - test_all (SEGFAULT)
Errors while running CTest
FAILED: CMakeFiles/test.util
cd /home/inglor/workspace/junk/corectrl/build && /usr/bin/ctest --force-new-ctest-process
ninja: build stopped: subcommand failed.
Actual result: SegFault during tests
Expected result: Execution of tests without errors
Additional information
CTEST_OUTPUT_ON_FAILURE=1 ninja -C build test
ninja: Entering directory `build'
[0/1] Running tests...
Test project /home/inglor/workspace/junk/corectrl/build
Start 1: test_all
1/1 Test #1: test_all .........................***Exception: SegFault 0.12 sec
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test_all is a Catch v2.13.10 host application.
Run with -? for options
-------------------------------------------------------------------------------
StringUtils tests
parseVersion
Returns 0.0.0 version when the input string is not in 'mayor.minor.patch'
format
-------------------------------------------------------------------------------
/home/inglor/workspace/junk/corectrl/tests/src/test_stringutils.cpp:76
...............................................................................
/home/inglor/workspace/junk/corectrl/tests/src/test_stringutils.cpp:76: FAILED:
due to a fatal error condition:
SIGSEGV - Segmentation violation signal
===============================================================================
test cases: 56 | 55 passed | 1 failed
assertions: 1048 | 1047 passed | 1 failed
0% tests passed, 1 tests failed out of 1
Total Test time (real) = 0.12 sec
The following tests FAILED:
1 - test_all (SEGFAULT)
Errors while running CTest
FAILED: CMakeFiles/test.util
cd /home/inglor/workspace/junk/corectrl/build && /usr/bin/ctest --force-new-ctest-process
ninja: build stopped: subcommand failed.