summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorStef Walter <stefw@collabora.co.uk>2011-06-09 09:42:55 +0200
committerStef Walter <stefw@collabora.co.uk>2011-06-09 09:42:55 +0200
commit48a08272bfcc0153887b850b4ea82e8fb7d8f1ae (patch)
treed17ab88ff14e5e515edb6a7126e0778dd95f34cf /tests
parent21333019a5afceb5f07637fb50b784a4ecd9f9ff (diff)
Store last failure message per thread.
* Add p11_kit_message() function to get last message.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am3
-rw-r--r--tests/conf-test.c13
2 files changed, 8 insertions, 8 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index cabe1f7..6b988b8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -3,7 +3,8 @@ INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/p11-kit \
-I$(srcdir)/cutest \
- -DSRCDIR=\"$(srcdir)\"
+ -DSRCDIR=\"$(srcdir)\" \
+ -DP11_KIT_FUTURE_UNSTABLE_API
noinst_PROGRAMS = \
hash-test \
diff --git a/tests/conf-test.c b/tests/conf-test.c
index 2ef4e5c..4b2f820 100644
--- a/tests/conf-test.c
+++ b/tests/conf-test.c
@@ -40,8 +40,7 @@
#include <string.h>
#include "conf.h"
-
-static int n_errors = 0;
+#include "p11-kit.h"
static void
test_parse_conf_1 (CuTest *tc)
@@ -72,12 +71,11 @@ test_parse_ignore_missing (CuTest *tc)
{
hash_t *ht;
- n_errors = 0;
ht = _p11_conf_parse_file (SRCDIR "/files/non-existant.conf", CONF_IGNORE_MISSING);
CuAssertPtrNotNull (tc, ht);
CuAssertIntEquals (tc, 0, hash_count (ht));
- CuAssertIntEquals (tc, 0, n_errors);
+ CuAssertPtrEquals (tc, NULL, (void*)p11_kit_message ());
hash_free (ht);
}
@@ -86,10 +84,9 @@ test_parse_fail_missing (CuTest *tc)
{
hash_t *ht;
- n_errors = 0;
ht = _p11_conf_parse_file (SRCDIR "/files/non-existant.conf", 0);
CuAssertPtrEquals (tc, ht, NULL);
- CuAssertIntEquals (tc, 1, n_errors);
+ CuAssertPtrNotNull (tc, p11_kit_message ());
}
static void
@@ -107,7 +104,7 @@ test_merge_defaults (CuTest *tc)
hash_set (defaults, strdup ("two"), strdup ("default2"));
hash_set (defaults, strdup ("three"), strdup ("default3"));
- if (!_p11_conf_merge_defaults (values, defaults))
+ if (_p11_conf_merge_defaults (values, defaults) < 0)
CuFail (tc, "should not be reached");
hash_free (defaults);
@@ -131,6 +128,8 @@ main (void)
SUITE_ADD_TEST (suite, test_parse_fail_missing);
SUITE_ADD_TEST (suite, test_merge_defaults);
+ p11_kit_be_quiet ();
+
CuSuiteRun (suite);
CuSuiteSummary (suite, output);
CuSuiteDetails (suite, output);