summaryrefslogtreecommitdiff
path: root/p11-kit/tests
diff options
context:
space:
mode:
authorStef Walter <stefw@gnome.org>2013-04-02 20:40:53 +0200
committerStef Walter <stefw@gnome.org>2013-04-03 10:39:09 +0200
commitfcc3a83cc4d540bc2c4096524b5e8003046ba561 (patch)
tree5bc566d6813448f83269797ce05aadeb02cdf36f /p11-kit/tests
parentae7dd1be6d431f25b101bc7e2b3fa373a8cbb47b (diff)
Separate library init from message code
Put library init/uninit code its into their own statically linked library so that they don't get linked into the p11-kit executable. Refactor the message code so that the library initialization can plug in its per thread message buffer. https://bugs.freedesktop.org/show_bug.cgi?id=63046
Diffstat (limited to 'p11-kit/tests')
-rw-r--r--p11-kit/tests/Makefile.am6
-rw-r--r--p11-kit/tests/conf-test.c31
-rw-r--r--p11-kit/tests/test-iter.c1
-rw-r--r--p11-kit/tests/test-modules.c1
-rw-r--r--p11-kit/tests/uri-test.c5
5 files changed, 22 insertions, 22 deletions
diff --git a/p11-kit/tests/Makefile.am b/p11-kit/tests/Makefile.am
index bc96bf4..c7b87ae 100644
--- a/p11-kit/tests/Makefile.am
+++ b/p11-kit/tests/Makefile.am
@@ -12,8 +12,7 @@ INCLUDES = \
LDADD = \
$(top_builddir)/p11-kit/libp11-kit-testable.la \
$(top_builddir)/common/libp11-mock.la \
- $(top_builddir)/common/libp11-library.la \
- $(top_builddir)/common/libp11-compat.la \
+ $(top_builddir)/common/libp11-common.la \
$(CUTEST_LIBS) \
$(LTLIBINTL)
@@ -47,8 +46,7 @@ mock_one_la_CFLAGS = \
mock_one_la_LIBADD = \
$(top_builddir)/common/libp11-mock.la \
- $(top_builddir)/common/libp11-library.la \
- $(top_builddir)/common/libp11-compat.la \
+ $(top_builddir)/common/libp11-common.la \
$(NULL)
mock_one_la_LDFLAGS = \
diff --git a/p11-kit/tests/conf-test.c b/p11-kit/tests/conf-test.c
index e74da1b..d259cf8 100644
--- a/p11-kit/tests/conf-test.c
+++ b/p11-kit/tests/conf-test.c
@@ -41,7 +41,8 @@
#include <string.h>
#include "conf.h"
-#include "library.h"
+#include "debug.h"
+#include "message.h"
#include "p11-kit.h"
#include "private.h"
@@ -78,7 +79,7 @@ test_parse_ignore_missing (CuTest *tc)
CuAssertPtrNotNull (tc, map);
CuAssertIntEquals (tc, 0, p11_dict_size (map));
- CuAssertPtrEquals (tc, NULL, (void*)p11_kit_message ());
+ CuAssertPtrEquals (tc, NULL, (void*)p11_message_last ());
p11_dict_free (map);
}
@@ -89,7 +90,7 @@ test_parse_fail_missing (CuTest *tc)
map = _p11_conf_parse_file (SRCDIR "/files/non-existant.conf", 0);
CuAssertPtrEquals (tc, map, NULL);
- CuAssertPtrNotNull (tc, p11_kit_message ());
+ CuAssertPtrNotNull (tc, p11_message_last ());
}
static void
@@ -131,7 +132,7 @@ test_load_globals_merge (CuTest *tc)
SRCDIR "/files/test-user.conf",
&user_mode);
CuAssertPtrNotNull (tc, config);
- CuAssertStrEquals (tc, NULL, p11_kit_message ());
+ CuAssertStrEquals (tc, NULL, p11_message_last ());
CuAssertIntEquals (tc, CONF_USER_MERGE, user_mode);
CuAssertStrEquals (tc, p11_dict_get (config, "key1"), "system1");
@@ -153,7 +154,7 @@ test_load_globals_no_user (CuTest *tc)
SRCDIR "/files/test-user.conf",
&user_mode);
CuAssertPtrNotNull (tc, config);
- CuAssertStrEquals (tc, NULL, p11_kit_message ());
+ CuAssertStrEquals (tc, NULL, p11_message_last ());
CuAssertIntEquals (tc, CONF_USER_NONE, user_mode);
CuAssertStrEquals (tc, p11_dict_get (config, "key1"), "system1");
@@ -175,7 +176,7 @@ test_load_globals_user_sets_only (CuTest *tc)
SRCDIR "/files/test-user-only.conf",
&user_mode);
CuAssertPtrNotNull (tc, config);
- CuAssertStrEquals (tc, NULL, p11_kit_message ());
+ CuAssertStrEquals (tc, NULL, p11_message_last ());
CuAssertIntEquals (tc, CONF_USER_ONLY, user_mode);
CuAssertStrEquals (tc, p11_dict_get (config, "key1"), NULL);
@@ -197,7 +198,7 @@ test_load_globals_system_sets_only (CuTest *tc)
SRCDIR "/files/test-user.conf",
&user_mode);
CuAssertPtrNotNull (tc, config);
- CuAssertStrEquals (tc, NULL, p11_kit_message ());
+ CuAssertStrEquals (tc, NULL, p11_message_last ());
CuAssertIntEquals (tc, CONF_USER_ONLY, user_mode);
CuAssertStrEquals (tc, p11_dict_get (config, "key1"), NULL);
@@ -222,7 +223,7 @@ test_load_globals_system_sets_invalid (CuTest *tc)
error = errno;
CuAssertPtrEquals (tc, NULL, config);
CuAssertIntEquals (tc, EINVAL, error);
- CuAssertPtrNotNull (tc, p11_kit_message ());
+ CuAssertPtrNotNull (tc, p11_message_last ());
p11_dict_free (config);
}
@@ -242,7 +243,7 @@ test_load_globals_user_sets_invalid (CuTest *tc)
error = errno;
CuAssertPtrEquals (tc, NULL, config);
CuAssertIntEquals (tc, EINVAL, error);
- CuAssertPtrNotNull (tc, p11_kit_message ());
+ CuAssertPtrNotNull (tc, p11_message_last ());
p11_dict_free (config);
}
@@ -267,7 +268,7 @@ test_load_modules_merge (CuTest *tc)
SRCDIR "/files/system-modules",
SRCDIR "/files/user-modules");
CuAssertPtrNotNull (tc, configs);
- CuAssertTrue (tc, assert_msg_contains (p11_kit_message (), "invalid config filename"));
+ CuAssertTrue (tc, assert_msg_contains (p11_message_last (), "invalid config filename"));
config = p11_dict_get (configs, "one");
CuAssertPtrNotNull (tc, config);
@@ -300,7 +301,7 @@ test_load_modules_user_none (CuTest *tc)
SRCDIR "/files/system-modules",
SRCDIR "/files/user-modules");
CuAssertPtrNotNull (tc, configs);
- CuAssertTrue (tc, assert_msg_contains (p11_kit_message (), "invalid config filename"));
+ CuAssertTrue (tc, assert_msg_contains (p11_message_last (), "invalid config filename"));
config = p11_dict_get (configs, "one");
CuAssertPtrNotNull (tc, config);
@@ -331,7 +332,7 @@ test_load_modules_user_only (CuTest *tc)
SRCDIR "/files/system-modules",
SRCDIR "/files/user-modules");
CuAssertPtrNotNull (tc, configs);
- CuAssertPtrEquals (tc, NULL, (void *)p11_kit_message ());
+ CuAssertPtrEquals (tc, NULL, (void *)p11_message_last ());
config = p11_dict_get (configs, "one");
CuAssertPtrNotNull (tc, config);
@@ -362,7 +363,7 @@ test_load_modules_no_user (CuTest *tc)
SRCDIR "/files/system-modules",
SRCDIR "/files/non-existant");
CuAssertPtrNotNull (tc, configs);
- CuAssertTrue (tc, assert_msg_contains (p11_kit_message (), "invalid config filename"));
+ CuAssertTrue (tc, assert_msg_contains (p11_message_last (), "invalid config filename"));
config = p11_dict_get (configs, "one");
CuAssertPtrNotNull (tc, config);
@@ -398,7 +399,7 @@ main (void)
int ret;
putenv ("P11_KIT_STRICT=1");
- p11_library_init ();
+ p11_debug_init ();
SUITE_ADD_TEST (suite, test_parse_conf_1);
SUITE_ADD_TEST (suite, test_parse_ignore_missing);
@@ -416,8 +417,6 @@ main (void)
SUITE_ADD_TEST (suite, test_load_modules_user_none);
SUITE_ADD_TEST (suite, test_parse_boolean);
- p11_kit_be_quiet ();
-
CuSuiteRun (suite);
CuSuiteSummary (suite, output);
CuSuiteDetails (suite, output);
diff --git a/p11-kit/tests/test-iter.c b/p11-kit/tests/test-iter.c
index ccfce2c..08e43b3 100644
--- a/p11-kit/tests/test-iter.c
+++ b/p11-kit/tests/test-iter.c
@@ -40,6 +40,7 @@
#include "attrs.h"
#include "iter.h"
#include "library.h"
+#include "message.h"
#include "mock.h"
#include <assert.h>
diff --git a/p11-kit/tests/test-modules.c b/p11-kit/tests/test-modules.c
index 3f0e4e0..3a6e968 100644
--- a/p11-kit/tests/test-modules.c
+++ b/p11-kit/tests/test-modules.c
@@ -40,6 +40,7 @@
#include <stdio.h>
#include <string.h>
+#include "debug.h"
#include "library.h"
#include "p11-kit.h"
#include "private.h"
diff --git a/p11-kit/tests/uri-test.c b/p11-kit/tests/uri-test.c
index 18ee706..2bc121c 100644
--- a/p11-kit/tests/uri-test.c
+++ b/p11-kit/tests/uri-test.c
@@ -35,7 +35,8 @@
#include "config.h"
#include "CuTest.h"
-#include "library.h"
+#include "debug.h"
+#include "message.h"
#include <assert.h>
#include <string.h>
@@ -1203,7 +1204,7 @@ main (void)
int ret;
putenv ("P11_KIT_STRICT=1");
- p11_library_init ();
+ p11_debug_init ();
SUITE_ADD_TEST (suite, test_uri_parse);
SUITE_ADD_TEST (suite, test_uri_parse_bad_scheme);