]> granicus.if.org Git - p11-kit/commitdiff
p11-kit: Fix tests when building with MinGW
authorMichael Cronenworth <mike@cchtml.com>
Tue, 9 Sep 2014 14:19:34 +0000 (16:19 +0200)
committerStef Walter <stef@thewalter.net>
Tue, 9 Sep 2014 14:20:21 +0000 (16:20 +0200)
Signed-off-by: Michael Cronenworth <mike@cchtml.com>
p11-kit/test-managed.c
p11-kit/test-rpc.c
p11-kit/test-transport.c

index c4ccd9a3c5b11cbf851c765753cf8f7f4297f725..fc673eaa4167b5b5d04907bf05d64b87478e6bf6 100644 (file)
@@ -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");
 
index 0ce2c553cfb2b834e30e936af21eb8fc16e26664..8c20a406f969b6df553f1bafe682db636ff91443 100644 (file)
@@ -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");
 
index c302230bcee3387f8022abf6fbeb93a0a59a82a8..5fde436448f85e14c6bc53a870103e50fda47b89 100644 (file)
@@ -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");