]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Add self-test to detect extension init/deinit problem.
authorSimon Josefsson <simon@josefsson.org>
Mon, 8 Jun 2009 16:41:55 +0000 (18:41 +0200)
committerSimon Josefsson <simon@josefsson.org>
Mon, 8 Jun 2009 16:41:55 +0000 (18:41 +0200)
tests/Makefile.am
tests/init_roundtrip.c [new file with mode: 0644]

index 5b77bfb841ed1e833b3be9f753473f935f613b80..c4b5c45ba64976435b8c3097464cc5044056ec26 100644 (file)
@@ -56,7 +56,8 @@ libutils_la_SOURCES = utils.h utils.c
 ctests = simple gc set_pkcs12_cred certder mpi                         \
        certificate_set_x509_crl dn parse_ca moredn crypto_rng mini     \
        finished hostname-check cve-2008-4989 pkcs12_s2k chainverify    \
-       crq_key_id x509sign-verify cve-2009-1415 cve-2009-1416 crq_apis
+       crq_key_id x509sign-verify cve-2009-1415 cve-2009-1416          \
+       crq_apis init_roundtrip
 
 if ENABLE_OPENSSL
 ctests +=  openssl
diff --git a/tests/init_roundtrip.c b/tests/init_roundtrip.c
new file mode 100644 (file)
index 0000000..13dbc3e
--- /dev/null
@@ -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");
+}