Merge issue-38-targets follow-up: Windows runtime qualification and MinGW portability
This commit is contained in:
commit
08a40ad5fc
8 files changed
+73
-27
No files matched your search
@@ -315,9 +315,11 @@ Void::Testing::Test io_mock_stop_completion_races_and_clock_timeout()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
Void::Testing::Test io_epoll_socketpair_fragmented_half_close_and_fd_reuse()
|
||||
{
|
||||
#ifndef __linux__
|
||||
Void::Testing::skip("epoll backend is Linux-only");
|
||||
#else
|
||||
ManualExecutor exec;
|
||||
auto drv_res = Driver::create(
|
||||
exec,
|
||||
@@ -453,10 +455,14 @@ Void::Testing::Test io_epoll_socketpair_fragmented_half_close_and_fd_reuse()
|
||||
(reused->first.id().generation > a_orig_id.generation) ||
|
||||
(reused->second.id().generation > a_orig_id.generation);
|
||||
Void::Testing::expect(bumped);
|
||||
#endif
|
||||
}
|
||||
|
||||
Void::Testing::Test io_epoll_cross_thread_wake_poll_and_stop_tsan()
|
||||
{
|
||||
#ifndef __linux__
|
||||
Void::Testing::skip("epoll backend is Linux-only");
|
||||
#else
|
||||
ManualExecutor exec;
|
||||
auto drv_res = Driver::create(exec, BackendOptions{.preference = BackendPreference::epoll});
|
||||
Void::Testing::require(drv_res.has_value());
|
||||
@@ -505,5 +511,5 @@ Void::Testing::Test io_epoll_cross_thread_wake_poll_and_stop_tsan()
|
||||
driver.wake();
|
||||
poller.join();
|
||||
(void)b.valid();
|
||||
}
|
||||
#endif // __linux__
|
||||
#endif
|
||||
}
|
||||
@@ -44,6 +44,20 @@ namespace
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
#if defined(_WIN32)
|
||||
// The MinGW CRT has no O_CLOEXEC and no fcntl(F_GETFD); the POSIX-only
|
||||
// descriptor assertions below are guarded separately.
|
||||
int open_readonly(const std::filesystem::path& path)
|
||||
{
|
||||
return ::_wopen(path.c_str(), _O_RDONLY);
|
||||
}
|
||||
#else
|
||||
int open_readonly(const std::filesystem::path& path)
|
||||
{
|
||||
return ::open(path.c_str(), O_RDONLY | O_CLOEXEC);
|
||||
}
|
||||
#endif
|
||||
|
||||
using Void::Async::ManualExecutor;
|
||||
using Void::Async::OperationOptions;
|
||||
using Void::Async::TaskScope;
|
||||
@@ -535,7 +549,7 @@ Void::Testing::Test io_file_native_roundtrip_isolated_tmpdir()
|
||||
expect_eq(drv->telemetry().active_descriptors, std::size_t{0});
|
||||
|
||||
// adopt_file_fd and a default (read-only) open of the same path.
|
||||
auto ro = drv->adopt_file_fd(::open(path.c_str(), O_RDONLY | O_CLOEXEC));
|
||||
auto ro = drv->adopt_file_fd(open_readonly(path));
|
||||
require(ro.has_value());
|
||||
File ro_file = std::move(*ro);
|
||||
auto ro2 = drv->open_file(path);
|
||||
@@ -1814,10 +1828,12 @@ Void::Testing::Test io_file_counts_against_max_descriptors()
|
||||
expect(!std::filesystem::exists(third));
|
||||
|
||||
// adopt_file_fd takes ownership only on success.
|
||||
const int fd = ::open(dir.file("first.bin").c_str(), O_RDONLY | O_CLOEXEC);
|
||||
const int fd = open_readonly(dir.file("first.bin"));
|
||||
require(fd >= 0);
|
||||
expect(failed_with(drv->adopt_file_fd(fd), IoErrorCode::overloaded));
|
||||
#if !defined(_WIN32)
|
||||
expect(::fcntl(fd, F_GETFD) != -1);
|
||||
#endif
|
||||
|
||||
spawn(scope, do_close(&file, {}, &c));
|
||||
(void)exec.drain();
|
||||
|
||||
@@ -368,5 +368,6 @@ Void::Testing::Test log_formatters_multilogger_and_file_sync_reopen()
|
||||
std::string content{(std::istreambuf_iterator<char>(ifs)), {}};
|
||||
expect(content.find("before-reopen") != std::string::npos);
|
||||
expect(content.find("after-reopen") != std::string::npos);
|
||||
ifs.close();
|
||||
std::filesystem::remove_all(base);
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <Void/Testing/Test.hpp>
|
||||
|
||||
#include <cmath>
|
||||
#include <numbers>
|
||||
|
||||
static constexpr float EPS = 1e-5f;
|
||||
|
||||
@@ -129,7 +130,7 @@ Void::Testing::Test mat4_scale()
|
||||
Void::Testing::Test mat4_rotation_z_90_degrees()
|
||||
{
|
||||
const auto R = Void::Math::Mat4f::rotation_z(
|
||||
static_cast<float>(M_PI) / 2.f);
|
||||
std::numbers::pi_v<float> / 2.f);
|
||||
const Void::Math::Vec4f v{1, 0, 0, 0};
|
||||
const auto r = R * v;
|
||||
Void::Testing::expect(std::abs(r.x - 0.f) < EPS);
|
||||
|
||||
@@ -224,6 +224,9 @@ Void::Testing::Test testing_subprocess_isolation_exit_crash_timeout_and_flood()
|
||||
using namespace Void::Testing;
|
||||
|
||||
const std::string exe = current_executable_path();
|
||||
if (exe.empty()) {
|
||||
skip("subprocess isolation is not implemented on this platform");
|
||||
}
|
||||
require(!exe.empty());
|
||||
|
||||
// 1. Passing self-invocation on skipped/tiny test
|
||||
|
||||
Reference in new issue
Block a user