aboutsummaryrefslogtreecommitdiff
path: root/ssl
diff options
context:
space:
mode:
authorMike Bland <mbland@acm.org>2014-06-07 13:05:50 -0400
committerMatt Caswell <matt@openssl.org>2014-06-10 19:20:25 +0100
commit3ead9f3798cb6de93b9824d6f833da9f00d8f5d7 (patch)
tree0c9ee6578dec597e54f05710448671aa09555051 /ssl
parent7a9d59c148b773f59a41f8697eeecf369a0974c2 (diff)
downloadopenssl-3ead9f3798cb6de93b9824d6f833da9f00d8f5d7.zip
openssl-3ead9f3798cb6de93b9824d6f833da9f00d8f5d7.tar.gz
openssl-3ead9f3798cb6de93b9824d6f833da9f00d8f5d7.tar.bz2
Create test/testutil.h for unit test helper macros
Defines SETUP_TEST_FIXTURE and EXECUTE_TEST, and updates ssl/heartbeat_test.c using these macros. SETUP_TEST_FIXTURE makes use of the new TEST_CASE_NAME macro, defined to use __func__ or __FUNCTION__ on platforms that support those symbols, or to use the file name and line number otherwise. This should fix several reported build problems related to lack of C99 support.
Diffstat (limited to 'ssl')
-rw-r--r--ssl/heartbeat_test.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/ssl/heartbeat_test.c b/ssl/heartbeat_test.c
index eddadbe..a0a3690 100644
--- a/ssl/heartbeat_test.c
+++ b/ssl/heartbeat_test.c
@@ -38,6 +38,7 @@
* http://mike-bland.com/tags/heartbleed.html
*/
+#include "../test/testutil.h"
#include "../ssl/ssl_locl.h"
#include <ctype.h>
#include <stdio.h>
@@ -190,7 +191,7 @@ static void print_payload(const char* const prefix,
else printf("\\x%02x", c);
}
printf("\"\n");
-}
+ }
static int execute_heartbeat(HEARTBEAT_TEST_FIXTURE fixture)
{
@@ -263,13 +264,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()
{