From: Rich Salz Date: Thu, 15 Mar 2018 14:51:17 +0000 (-0400) Subject: Add code to run test, get malloc counts X-Git-Tag: OpenSSL_1_1_1-pre3~64 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f297e4ecc3e5bd9f460ffc99f38680e34d6d4d2f;p=oweals%2Fopenssl.git Add code to run test, get malloc counts Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/4528) --- diff --git a/test/sslapitest.c b/test/sslapitest.c index 2c122be3c8..8e91151780 100644 --- a/test/sslapitest.c +++ b/test/sslapitest.c @@ -17,6 +17,7 @@ #include "ssltestlib.h" #include "testutil.h" +#include "testutil/output.h" #include "internal/nelem.h" #include "../ssl/ssl_locl.h" @@ -3638,6 +3639,22 @@ int setup_tests(void) || !TEST_ptr(privkey = test_get_argument(1))) return 0; + if (getenv("OPENSSL_TEST_GETCOUNTS") != NULL) { +#ifdef OPENSSL_NO_CRYPTO_MDEBUG + TEST_error("not supported in this build"); + return 0; +#else + int i, mcount, rcount, fcount; + + for (i = 0; i < 4; i++) + test_export_key_mat(i); + CRYPTO_get_alloc_counts(&mcount, &rcount, &fcount); + test_printf_stdout("malloc %d realloc %d free %d\n", + mcount, rcount, fcount); + return 1; +#endif + } + ADD_TEST(test_large_message_tls); ADD_TEST(test_large_message_tls_read_ahead); #ifndef OPENSSL_NO_DTLS