summaryrefslogtreecommitdiffstats
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:24:46 +0100
commit2fddc5fc09be520232ea2799f14791bedd23c3a4 (patch)
treedbbf7bd3ab4a33f1bce0a35305c7bd2f740ef2db /ssl
parente3beef1e1bdd70031d009dc61ab88b74a4c884c8 (diff)
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.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/ssl/heartbeat_test.c b/ssl/heartbeat_test.c
index d8cc559981..a0a3690096 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>
@@ -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()
{