Add code to run test, get malloc counts
#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
