Giter Club home page Giter Club logo

posixsignalmanager's People

Contributors

textshell avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

posixsignalmanager's Issues

SIGFPE tests fail with -O2 and LTO

On Fedora, builds default to using LTO. This causes the SIGFPE tests to fail at least on x86_64 (notably, without LTO, all tests pass):

NSIG: 65, SIGRTMAX: 64
Randomness seeded to: 1222419932

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests is a Catch2 v3.4.0 host application.
Run with -? for options

-------------------------------------------------------------------------------
baseline sigfpe
-------------------------------------------------------------------------------
../tests/tests.cpp:982
...............................................................................

../tests/tests.cpp:988: FAILED:
  CHECK( info._sifields._sigchld.si_status == 8 )
with expansion:
  4 == 8

===============================================================================
test cases:   40 |   39 passed | 1 failed
assertions: 1158 | 1157 passed | 1 failed

Steps to reproduce:

podman run --rm -ti registry.fedoraproject.org/fedora:39
dnf install git meson gcc-c++ 'pkgconfig(catch2)' 'pkgconfig(Qt5Core)'
cd /tmp
git clone https://github.com/textshell/posixsignalmanager
cd posixsignalmanager
git checkout 96409f2726b59eb82b2b25419a39b0152f6d4bfe
CXXFLAGS='-O2 -flto=auto -ffat-lto-objects' meson setup _build --buildtype=plain -Dsystem-catch2=enabled
cd _build
ninja test

I could also reproduce this with Ubuntu 23.10 (GCC 13 as well) and Debian 12 (GCC 12), so this does not seem to be a Fedora-specific issue. Also, similar (though in detail slightly different) test failures occur with Clang and LTO.

This does not occur with #1 merged, even though that one is intended for non-x86 platforms. I currently do not have any hardware to test other platforms available.

catch2 v3 compatibility

I applied similar catch2 v3 fixes as with termpaint, but there are still issues (this is with commit 4426a73):

diff --git a/meson.build b/meson.build
index c9c11d5..0f65ec9 100644
--- a/meson.build
+++ b/meson.build
@@ -62,6 +62,10 @@ if not meson.is_subproject()
   catch2_dep = dependency('catch2', required : get_option('system-catch2'))
   if not catch2_dep.found()
     catch2_dep = declare_dependency(compile_args: ['-DBUNDLED_CATCH2'])
+  else
+    if catch2_dep.version().version_compare('>=3.0')
+      catch2_dep = [catch2_dep, declare_dependency(compile_args: ['-DCATCH3'])]
+    endif
   endif
 
   testlib = static_library('testlib', 'tests/catch_main.cpp', dependencies: [catch2_dep])
diff --git a/tests/catch_main.cpp b/tests/catch_main.cpp
index f3be68a..549ac70 100644
--- a/tests/catch_main.cpp
+++ b/tests/catch_main.cpp
@@ -3,7 +3,11 @@
 #define CATCH_CONFIG_RUNNER
 #define CATCH_CONFIG_NO_POSIX_SIGNALS
 #ifndef BUNDLED_CATCH2
+#ifdef CATCH3
+#include "catch2/catch_all.hpp"
+#else
 #include "catch2/catch.hpp"
+#endif
 #else
 #include "catch.hpp"
 #endif
diff --git a/tests/tests.cpp b/tests/tests.cpp
index dde82e5..c38d9df 100644
--- a/tests/tests.cpp
+++ b/tests/tests.cpp
@@ -22,7 +22,11 @@
 #define CATCH_CONFIG_EXTERNAL_INTERFACES
 #define CATCH_CONFIG_NO_POSIX_SIGNALS
 #ifndef BUNDLED_CATCH2
+#ifdef CATCH3
+#include "catch2/catch_all.hpp"
+#else
 #include "catch2/catch.hpp"
+#endif
 #else
 #include "catch.hpp"
 #endif
[1/2] sccache c++ -Itests.p -I. -I.. -I/usr/include/qt5/QtCore -I/usr/include/qt5 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++14 -O0 -g -DCATCH3 -DQT_CORE_LIB -fPIC -MD -MQ tests.p/tests_tests.cpp.o -MF tests.p/tests_tests.cpp.o.d -o tests.p/tests_tests.cpp.o -c ../tests/tests.cpp
FAILED: tests.p/tests_tests.cpp.o 
sccache c++ -Itests.p -I. -I.. -I/usr/include/qt5/QtCore -I/usr/include/qt5 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++14 -O0 -g -DCATCH3 -DQT_CORE_LIB -fPIC -MD -MQ tests.p/tests_tests.cpp.o -MF tests.p/tests_tests.cpp.o.d -o tests.p/tests_tests.cpp.o -c ../tests/tests.cpp
../tests/tests.cpp:41:57: error: expected class-name before ‘{’ token
   41 | struct SaneStateListener : Catch::TestEventListenerBase {
      |                                                         ^
../tests/tests.cpp:46:11: error: ‘TestEventListenerBase’ has not been declared
   46 |     using TestEventListenerBase::TestEventListenerBase; // inherit constructor
      |           ^~~~~~~~~~~~~~~~~~~~~
../tests/tests.cpp:48:18: error: ‘virtual void SaneStateListener::testCaseStarting(const Catch::TestCaseInfo&)’ marked ‘override’, but does not override
   48 |     virtual void testCaseStarting(Catch::TestCaseInfo const& testInfo) override {
      |                  ^~~~~~~~~~~~~~~~
../tests/tests.cpp:60:18: error: ‘virtual void SaneStateListener::testCaseEnded(const Catch::TestCaseStats&)’ marked ‘override’, but does not override
   60 |     virtual void testCaseEnded(Catch::TestCaseStats const& testCaseStats) override {
      |                  ^~~~~~~~~~~~~
../tests/tests.cpp: In constructor ‘SaneStateListener::SaneStateListener(const Catch::ReporterConfig&)’:
../tests/tests.cpp:42:91: error: expected class-name before ‘(’ token
   42 |     SaneStateListener(Catch::ReporterConfig const& _config) : Catch::TestEventListenerBase(_config) {
      |                                                                                           ^
../tests/tests.cpp:42:91: error: expected ‘{’ before ‘(’ token
../tests/tests.cpp: In member function ‘virtual void SaneStateListener::testCaseEnded(const Catch::TestCaseStats&)’:
../tests/tests.cpp:63:41: error: request for member ‘name’ in ‘testCaseStats.Catch::TestCaseStats::testInfo’, which is of pointer type ‘const Catch::TestCaseInfo* const’ (maybe you meant to use ‘->’ ?)
   63 |             puts(testCaseStats.testInfo.name.c_str());
      |                                         ^~~~
../tests/tests.cpp:68:41: error: request for member ‘name’ in ‘testCaseStats.Catch::TestCaseStats::testInfo’, which is of pointer type ‘const Catch::TestCaseInfo* const’ (maybe you meant to use ‘->’ ?)
   68 |             puts(testCaseStats.testInfo.name.c_str());
      |                                         ^~~~
In file included from /usr/include/catch2/reporters/catch_reporters_all.hpp:33,
                 from /usr/include/catch2/catch_all.hpp:119,
                 from ../tests/tests.cpp:26:
/usr/include/catch2/reporters/catch_reporter_registrars.hpp: In instantiation of ‘Catch::IEventListenerPtr Catch::ListenerRegistrar<T>::TypedListenerFactory::create(const Catch::IConfig*) const [with T = SaneStateListener; Catch::IEventListenerPtr = Catch::Detail::unique_ptr<Catch::IEventListener>]’:
/usr/include/catch2/reporters/catch_reporter_registrars.hpp:85:31:   required from here
/usr/include/catch2/reporters/catch_reporter_registrars.hpp:86:55: error: could not convert ‘Catch::Detail::make_unique(Args&& ...) [with T = SaneStateListener; Args = {const Catch::IConfig*&}]()’ from ‘unique_ptr<SaneStateListener>’ to ‘unique_ptr<Catch::IEventListener>’
   86 |                 return Detail::make_unique<T>( config );
      |                                                       ^
      |                                                       |
      |                                                       unique_ptr<SaneStateListener>
In file included from /usr/include/catch2/interfaces/catch_interfaces_reporter.hpp:16,
                 from /usr/include/catch2/benchmark/catch_benchmark.hpp:16,
                 from /usr/include/catch2/benchmark/catch_benchmark_all.hpp:24,
                 from /usr/include/catch2/catch_all.hpp:25:
/usr/include/catch2/internal/catch_unique_ptr.hpp: In instantiation of ‘Catch::Detail::unique_ptr<T> Catch::Detail::make_unique(Args&& ...) [with T = SaneStateListener; Args = {const Catch::IConfig*&}]’:
/usr/include/catch2/reporters/catch_reporter_registrars.hpp:86:46:   required from ‘Catch::IEventListenerPtr Catch::ListenerRegistrar<T>::TypedListenerFactory::create(const Catch::IConfig*) const [with T = SaneStateListener; Catch::IEventListenerPtr = Catch::Detail::unique_ptr<Catch::IEventListener>]’
/usr/include/catch2/reporters/catch_reporter_registrars.hpp:85:31:   required from here
/usr/include/catch2/internal/catch_unique_ptr.hpp:111:30: error: no matching function for call to ‘SaneStateListener::SaneStateListener(const Catch::IConfig*&)’
  111 |         return unique_ptr<T>(new T(CATCH_FORWARD(args)...));
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../tests/tests.cpp:42:5: note: candidate: ‘SaneStateListener::SaneStateListener(const Catch::ReporterConfig&)’
   42 |     SaneStateListener(Catch::ReporterConfig const& _config) : Catch::TestEventListenerBase(_config) {
      |     ^~~~~~~~~~~~~~~~~
../tests/tests.cpp:42:52: note:   no known conversion for argument 1 from ‘const Catch::IConfig*’ to ‘const Catch::ReporterConfig&’
   42 |     SaneStateListener(Catch::ReporterConfig const& _config) : Catch::TestEventListenerBase(_config) {
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
../tests/tests.cpp:41:8: note: candidate: ‘constexpr SaneStateListener::SaneStateListener(const SaneStateListener&)’
   41 | struct SaneStateListener : Catch::TestEventListenerBase {
      |        ^~~~~~~~~~~~~~~~~
../tests/tests.cpp:41:8: note:   no known conversion for argument 1 from ‘const Catch::IConfig*’ to ‘const SaneStateListener&’
../tests/tests.cpp:41:8: note: candidate: ‘constexpr SaneStateListener::SaneStateListener(SaneStateListener&&)’
../tests/tests.cpp:41:8: note:   no known conversion for argument 1 from ‘const Catch::IConfig*’ to ‘SaneStateListener&&’
ninja: build stopped: subcommand failed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.