Hello,
I am attaching two patches that fix compiling with MinGW. They have been made
against git master. The trust test issue has been broken for a while. The
p11-kit tests have just recently been introduced with 0.20.4+.
The p11-kit tests are calling UNIX-specific features (getuid, fork, mkdir) and I
have commented out these sections and changed mkdir to the appropriate call.
Feel free to rewrite these tests if you would like to have them work on Windows.
Thanks,
Michael
>From 5cd0dafdd804e2cf062bea3befaf3be4981154ca Mon Sep 17 00:00:00 2001
From: Michael Cronenworth <m...@cchtml.com>
Date: Sun, 17 Aug 2014 16:26:56 -0500
Subject: [PATCH 1/2] trust: Fix token test when building with MinGW
Signed-off-by: Michael Cronenworth <m...@cchtml.com>
---
trust/test-token.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/trust/test-token.c b/trust/test-token.c
index c643f7e..d4c89ce 100644
--- a/trust/test-token.c
+++ b/trust/test-token.c
@@ -238,11 +238,15 @@ test_not_writable (void)
{
p11_token *token;
+#ifdef OS_UNIX
if (getuid () != 0) {
+#endif
token = p11_token_new (333, "/", "Label");
assert (!p11_token_is_writable (token));
p11_token_free (token);
+#ifdef OS_UNIX
}
+#endif
token = p11_token_new (333, "", "Label");
assert (!p11_token_is_writable (token));
--
1.9.3
>From e50374096e1edb6bdabe42afdfb42a9e7b9b240b Mon Sep 17 00:00:00 2001
From: Michael Cronenworth <m...@cchtml.com>
Date: Sun, 17 Aug 2014 16:27:41 -0500
Subject: [PATCH 2/2] p11-kit: Fix tests when building with MinGW
Signed-off-by: Michael Cronenworth <m...@cchtml.com>
---
p11-kit/test-managed.c | 6 ++++++
p11-kit/test-rpc.c | 6 ++++++
p11-kit/test-transport.c | 10 ++++++++++
3 files changed, 22 insertions(+)
diff --git a/p11-kit/test-managed.c b/p11-kit/test-managed.c
index c4ccd9a..d54615a 100644
--- a/p11-kit/test-managed.c
+++ b/p11-kit/test-managed.c
@@ -43,7 +43,9 @@
#include "virtual.h"
#include <sys/types.h>
+#ifndef WIN32
#include <sys/wait.h>
+#endif
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
@@ -196,6 +198,7 @@ test_separate_close_all_sessions (void)
teardown_mock_module (second);
}
+#ifndef WIN32
static void
test_fork_and_reinitialize (void)
{
@@ -238,6 +241,7 @@ test_fork_and_reinitialize (void)
teardown_mock_module (module);
}
+#endif
/* Bring in all the mock module tests */
#include "test-mock.c"
@@ -252,7 +256,9 @@ 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");
+#ifndef WIN32
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..587a038 100644
--- a/p11-kit/test-rpc.c
+++ b/p11-kit/test-rpc.c
@@ -47,7 +47,9 @@
#include "virtual.h"
#include <sys/types.h>
+#ifndef WIN32
#include <sys/wait.h>
+#endif
#include <assert.h>
#include <string.h>
#include <stdio.h>
@@ -963,6 +965,7 @@ test_simultaneous_functions (void)
p11_mutex_uninit (&delay_mutex);
}
+#ifndef WIN32
static void
test_fork_and_reinitialize (void)
{
@@ -1005,6 +1008,7 @@ test_fork_and_reinitialize (void)
teardown_mock_module (rpc_module);
}
+#endif
#include "test-mock.c"
@@ -1053,7 +1057,9 @@ 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");
+#ifndef WIN32
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..66f3ae4 100644
--- a/p11-kit/test-transport.c
+++ b/p11-kit/test-transport.c
@@ -44,7 +44,9 @@
#include "rpc.h"
#include <sys/types.h>
+#ifndef WIN32
#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);
+#ifndef WIN32
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,7 @@ test_simultaneous_functions (void)
p11_kit_modules_release (modules);
}
+#ifndef WIN32
static void
test_fork_and_reinitialize (void)
{
@@ -247,6 +254,7 @@ test_fork_and_reinitialize (void)
p11_kit_modules_release (modules);
}
+#endif
#include "test-mock.c"
@@ -273,7 +281,9 @@ main (int argc,
p11_fixture (setup_remote, teardown_remote);
p11_test (test_basic_exec, "/transport/basic");
p11_test (test_simultaneous_functions, "/transport/simultaneous-functions");
+#ifndef WIN32
p11_test (test_fork_and_reinitialize, "/transport/fork-and-reinitialize");
+#endif
test_mock_add_tests ("/transport");
--
1.9.3
_______________________________________________
p11-glue mailing list
p11-glue@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/p11-glue