summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--p11-kit/test-managed.c9
-rw-r--r--p11-kit/test-rpc.c9
-rw-r--r--p11-kit/test-transport.c12
3 files changed, 30 insertions, 0 deletions
diff --git a/p11-kit/test-managed.c b/p11-kit/test-managed.c
index c4ccd9a..fc673ea 100644
--- a/p11-kit/test-managed.c
+++ b/p11-kit/test-managed.c
@@ -43,7 +43,9 @@
#include "virtual.h"
#include <sys/types.h>
+#ifdef OS_UNIX
#include <sys/wait.h>
+#endif
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
@@ -196,6 +198,8 @@ test_separate_close_all_sessions (void)
teardown_mock_module (second);
}
+#ifdef OS_UNIX
+
static void
test_fork_and_reinitialize (void)
{
@@ -239,6 +243,8 @@ test_fork_and_reinitialize (void)
teardown_mock_module (module);
}
+#endif /* OS_UNIX */
+
/* Bring in all the mock module tests */
#include "test-mock.c"
@@ -252,7 +258,10 @@ main (int argc,
p11_test (test_initialize_finalize, "/managed/test_initialize_finalize");
p11_test (test_initialize_fail, "/managed/test_initialize_fail");
p11_test (test_separate_close_all_sessions, "/managed/test_separate_close_all_sessions");
+
+#ifdef OS_UNIX
p11_test (test_fork_and_reinitialize, "/managed/fork-and-reinitialize");
+#endif
test_mock_add_tests ("/managed");
diff --git a/p11-kit/test-rpc.c b/p11-kit/test-rpc.c
index 0ce2c55..8c20a40 100644
--- a/p11-kit/test-rpc.c
+++ b/p11-kit/test-rpc.c
@@ -47,7 +47,9 @@
#include "virtual.h"
#include <sys/types.h>
+#ifdef OS_UNIX
#include <sys/wait.h>
+#endif
#include <assert.h>
#include <string.h>
#include <stdio.h>
@@ -963,6 +965,8 @@ test_simultaneous_functions (void)
p11_mutex_uninit (&delay_mutex);
}
+#ifdef OS_UNIX
+
static void
test_fork_and_reinitialize (void)
{
@@ -1006,6 +1010,8 @@ test_fork_and_reinitialize (void)
teardown_mock_module (rpc_module);
}
+#endif /* OS_UNIX */
+
#include "test-mock.c"
int
@@ -1053,7 +1059,10 @@ main (int argc,
p11_test (test_get_info_stand_in, "/rpc/get-info-stand-in");
p11_test (test_get_slot_list_no_device, "/rpc/get-slot-list-no-device");
p11_test (test_simultaneous_functions, "/rpc/simultaneous-functions");
+
+#ifdef OS_UNIX
p11_test (test_fork_and_reinitialize, "/rpc/fork-and-reinitialize");
+#endif
test_mock_add_tests ("/rpc");
diff --git a/p11-kit/test-transport.c b/p11-kit/test-transport.c
index c302230..5fde436 100644
--- a/p11-kit/test-transport.c
+++ b/p11-kit/test-transport.c
@@ -44,7 +44,9 @@
#include "rpc.h"
#include <sys/types.h>
+#ifdef OS_UNIX
#include <sys/wait.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
@@ -61,7 +63,11 @@ setup_remote (void *unused)
test.directory = p11_test_directory ("p11-test-config");
test.user_modules = p11_path_build (test.directory, "modules", NULL);
+#ifdef OS_UNIX
if (mkdir (test.user_modules, 0700) < 0)
+#else
+ if (mkdir (test.user_modules) < 0)
+#endif
assert_not_reached ();
data = "user-config: only\n";
@@ -196,6 +202,8 @@ test_simultaneous_functions (void)
p11_kit_modules_release (modules);
}
+#ifdef OS_UNIX
+
static void
test_fork_and_reinitialize (void)
{
@@ -248,6 +256,7 @@ test_fork_and_reinitialize (void)
p11_kit_modules_release (modules);
}
+#endif /* OS_UNIX */
#include "test-mock.c"
@@ -273,7 +282,10 @@ main (int argc,
p11_fixture (setup_remote, teardown_remote);
p11_test (test_basic_exec, "/transport/basic");
p11_test (test_simultaneous_functions, "/transport/simultaneous-functions");
+
+#ifdef OS_UNIX
p11_test (test_fork_and_reinitialize, "/transport/fork-and-reinitialize");
+#endif
test_mock_add_tests ("/transport");