Files
Library/tests/standalone/System/SignalWatcher.cpp
faumaray 3851aeb703
CI / GCC 16 / C++26 / werror (push) Failing after 3m9s
CI / GCC 16 / C++26 / sanitizers (push) Failing after 10m15s
CI / GCC 16 / C++26 / default (push) Failing after 13m1s
Update
Signed-off-by: faumaray <faumaray@gmail.com>
2026-07-20 01:18:53 +03:00

23 lines
733 B
C++

#include <Void/System/SignalWatcher.hpp>
#include <Void/Testing/Assert.hpp>
#include <Void/Testing/Test.hpp>
#include <chrono>
#include <csignal>
Void::Testing::Test signal_watcher_polls_and_receives_blocked_signal()
{
#ifdef __linux__
auto watcher = Void::Process::SignalWatcher::create({SIGUSR1});
Void::Testing::require(watcher.has_value());
auto empty = watcher->poll();
Void::Testing::require(empty.has_value());
Void::Testing::expect(!empty->has_value());
Void::Testing::require(::raise(SIGUSR1) == 0);
auto received = watcher->wait(std::chrono::milliseconds{100});
Void::Testing::require(received.has_value());
Void::Testing::require(received->has_value());
Void::Testing::expect_eq(**received, SIGUSR1);
#endif
}