summaryrefslogtreecommitdiff
path: root/tests/init_roundtrip.c
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2009-06-08 18:41:55 +0200
committerSimon Josefsson <simon@josefsson.org>2009-06-08 18:41:55 +0200
commit2ef9f788c4fb02e71ee0f618c8bce32973abe4c2 (patch)
tree28a8f0c2ba1d4dcbbae2d5548a6d7f45ab65a706 /tests/init_roundtrip.c
parent86ca9d6ce227a8775c29a378802cc37afcd860c8 (diff)
downloadgnutls-2ef9f788c4fb02e71ee0f618c8bce32973abe4c2.tar.gz
Add self-test to detect extension init/deinit problem.
Diffstat (limited to 'tests/init_roundtrip.c')
-rw-r--r--tests/init_roundtrip.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/init_roundtrip.c b/tests/init_roundtrip.c
new file mode 100644
index 0000000000..13dbc3e1c6
--- /dev/null
+++ b/tests/init_roundtrip.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2004, 2005, 2008, 2009 Free Software Foundation
+ *
+ * Author: Simon Josefsson
+ *
+ * This file is part of GNUTLS.
+ *
+ * GNUTLS is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GNUTLS is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNUTLS; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+
+#include "utils.h"
+
+/* See <http://bugs.gentoo.org/272388>. */
+
+void
+doit (void)
+{
+ int res;
+
+ res = gnutls_global_init ();
+ if (res != 0)
+ fail ("gnutls_global_init\n");
+
+ gnutls_global_deinit ();
+
+ res = gnutls_global_init ();
+ if (res != 0)
+ fail ("gnutls_global_init2\n");
+
+ gnutls_global_deinit ();
+
+ success ("init-deinit round-trip success\n");
+}