From: Simon Josefsson Date: Mon, 8 Jun 2009 16:41:55 +0000 (+0200) Subject: Add self-test to detect extension init/deinit problem. X-Git-Tag: gnutls_2_9_1~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2ef9f788c4fb02e71ee0f618c8bce32973abe4c2;p=thirdparty%2Fgnutls.git Add self-test to detect extension init/deinit problem. --- diff --git a/tests/Makefile.am b/tests/Makefile.am index 5b77bfb841..c4b5c45ba6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 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 +#endif + +#include + +#include "utils.h" + +/* See . */ + +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"); +}