Followup on RT3334 fix: make sure that a directory that's the empty
[openssl.git] / ssl / heartbeat_test.c
index 26a01c08042cde02244c7610d1248a9e7f07d33e..de9d39761ef824e0b44a15495ef8a0ab3531aa43 100644 (file)
  * http://mike-bland.com/tags/heartbleed.html
  */
 
+#define OPENSSL_UNIT_TEST
+
+#include "../test/testutil.h"
+
 #include "../ssl/ssl_locl.h"
 #include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
+#if !defined(OPENSSL_NO_HEARTBEATS) && !defined(OPENSSL_NO_UNIT_TEST)
+
 /* As per https://tools.ietf.org/html/rfc6520#section-4 */
 #define MIN_PADDING_SIZE       16
 
@@ -261,13 +267,10 @@ static int honest_payload_size(unsigned char payload_buf[])
        }
 
 #define SETUP_HEARTBEAT_TEST_FIXTURE(type)\
-       HEARTBEAT_TEST_FIXTURE fixture = set_up_##type(__func__);\
-       int result = 0
+  SETUP_TEST_FIXTURE(HEARTBEAT_TEST_FIXTURE, set_up_##type)
 
 #define EXECUTE_HEARTBEAT_TEST()\
-       if (execute_heartbeat(fixture) != 0) result = 1;\
-       tear_down(fixture);\
-       return result
+  EXECUTE_TEST(execute_heartbeat, tear_down)
 
 static int test_dtls1_not_bleeding()
        {
@@ -453,3 +456,11 @@ int main(int argc, char *argv[])
                }
        return EXIT_SUCCESS;
        }
+
+#else /* OPENSSL_NO_HEARTBEATS*/
+
+int main(int argc, char *argv[])
+       {
+               return EXIT_SUCCESS;
+       }
+#endif /* OPENSSL_NO_HEARTBEATS */