Windows: make plugin and runtime test guards portable

- Do not build the pthread-based C ABI fixtures on Windows (their tests
  skip without the path macros); the C++ plugin fixtures still build.
- Plugin tests: drop the dlfcn.h proxy guard now that Windows uses
  LoadLibrary; mark the C ABI hardening file @requires-posix.
- RuntimeSignals is POSIX-only (@requires-posix).

Refs #65
This commit is contained in:
faumaray committed 2026-12-06 02:56:59 +03:00
1 parent 8510ea197f
commit 6fa77eed93
8 files changed
+11 -11

No files matched your search

+4
View File
@@ -315,6 +315,9 @@ if(TARGET VoidTests AND TARGET Void::Plugin)
add_dependencies(VoidTests VoidServicePluginV1 VoidServicePluginV2) add_dependencies(VoidTests VoidServicePluginV1 VoidServicePluginV2)
endif() endif()
# The pure-C ABI fixtures use pthreads/nanosleep; they are POSIX-only for
# now (the C++ plugin fixtures above still cover Plugin on Windows).
if(NOT WIN32)
enable_language(C) enable_language(C)
function(_void_add_cabi_fixture target_name source_file) function(_void_add_cabi_fixture target_name source_file)
add_library(${target_name} SHARED "${CMAKE_CURRENT_SOURCE_DIR}/plugins/${source_file}") add_library(${target_name} SHARED "${CMAKE_CURRENT_SOURCE_DIR}/plugins/${source_file}")
@@ -370,4 +373,5 @@ if(TARGET VoidTests AND TARGET Void::Plugin)
"VOID_CABI_CYC_A_PATH=\"$<TARGET_FILE:VoidCAbiCycA>\"" "VOID_CABI_CYC_A_PATH=\"$<TARGET_FILE:VoidCAbiCycA>\""
"VOID_CABI_CYC_B_PATH=\"$<TARGET_FILE:VoidCAbiCycB>\"" "VOID_CABI_CYC_B_PATH=\"$<TARGET_FILE:VoidCAbiCycB>\""
) )
endif() # NOT WIN32
endif() endif()
+1 -1
View File
@@ -11,7 +11,7 @@
using namespace Void::Plugin; using namespace Void::Plugin;
#if defined(VOID_CONFIGURABLE_PATH) && __has_include(<dlfcn.h>) #if defined(VOID_CONFIGURABLE_PATH)
namespace namespace
{ {
+1 -2
View File
@@ -10,8 +10,7 @@
using namespace Void::Plugin; using namespace Void::Plugin;
#if defined(VOID_TEST_PLUGIN_PATH) && defined(VOID_STATEFUL_V1_PATH) && \ #if defined(VOID_TEST_PLUGIN_PATH) && defined(VOID_STATEFUL_V1_PATH)
__has_include(<dlfcn.h>)
Void::Testing::Test discovery_loads_all_plugins_in_filename_order() Void::Testing::Test discovery_loads_all_plugins_in_filename_order()
{ {
@@ -14,8 +14,7 @@
using namespace Void::Plugin; using namespace Void::Plugin;
#if defined(VOID_STATEFUL_V1_PATH) && defined(VOID_STATEFUL_V2_PATH) && \ #if defined(VOID_STATEFUL_V1_PATH) && defined(VOID_STATEFUL_V2_PATH)
__has_include(<dlfcn.h>)
namespace namespace
{ {
+1 -2
View File
@@ -14,8 +14,7 @@
using namespace Void::Plugin; using namespace Void::Plugin;
#if defined(VOID_STATEFUL_V1_PATH) && defined(VOID_STATEFUL_V2_PATH) && \ #if defined(VOID_STATEFUL_V1_PATH) && defined(VOID_STATEFUL_V2_PATH)
__has_include(<dlfcn.h>)
namespace namespace
{ {
-2
View File
@@ -25,7 +25,6 @@ Void::Testing::Test plugin_load_missing_file_returns_error()
Void::Testing::DisabledTest plugin_load_and_query_skipped() {} Void::Testing::DisabledTest plugin_load_and_query_skipped() {}
#ifdef VOID_TEST_PLUGIN_PATH #ifdef VOID_TEST_PLUGIN_PATH
# if __has_include(<dlfcn.h>)
Void::Testing::Test plugin_load_test_plugin() Void::Testing::Test plugin_load_test_plugin()
{ {
@@ -77,5 +76,4 @@ Void::Testing::Test plugin_abi_version_matches()
Void::Testing::expect_eq(r->info().abi_version, Void::Plugin::ABI_VERSION); Void::Testing::expect_eq(r->info().abi_version, Void::Plugin::ABI_VERSION);
} }
# endif // has dlfcn.h
#endif // VOID_TEST_PLUGIN_PATH #endif // VOID_TEST_PLUGIN_PATH
+2 -2
View File
@@ -1,6 +1,7 @@
#include <Void/Plugin/CAbi.h> #include <Void/Plugin/CAbi.h>
#include <Void/Plugin/CAbiAdapter.hpp> #include <Void/Plugin/CAbiAdapter.hpp>
#include <Void/Plugin/Host.hpp> #include <Void/Plugin/Host.hpp>
// @requires-posix: C ABI plugin fixtures use pthreads/nanosleep.
#include <Void/Plugin/Manager.hpp> #include <Void/Plugin/Manager.hpp>
#include <Void/System/TempDir.hpp> #include <Void/System/TempDir.hpp>
#include <Void/Testing/Assert.hpp> #include <Void/Testing/Assert.hpp>
@@ -47,8 +48,7 @@ namespace
} }
} // namespace } // namespace
#if defined(VOID_CABI_V1_PATH) && defined(VOID_CABI_V2_PATH) && \ #if defined(VOID_CABI_V1_PATH) && defined(VOID_CABI_V2_PATH)
__has_include(<dlfcn.h>)
Void::Testing::Test plugin_cabi_v1_to_v2_stateful_quiesce_and_reload() Void::Testing::Test plugin_cabi_v1_to_v2_stateful_quiesce_and_reload()
{ {
@@ -1,3 +1,4 @@
// @requires-posix: exercises POSIX signal delivery with pthreads.
#include <Void/Async/Task.hpp> #include <Void/Async/Task.hpp>
#include <Void/Runtime/Host.hpp> #include <Void/Runtime/Host.hpp>
#include <Void/Runtime/Lifecycle.hpp> #include <Void/Runtime/Lifecycle.hpp>