summaryrefslogtreecommitdiff
path: root/regress/unittests/test_helper/test_helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'regress/unittests/test_helper/test_helper.c')
-rw-r--r--regress/unittests/test_helper/test_helper.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/regress/unittests/test_helper/test_helper.c b/regress/unittests/test_helper/test_helper.c
index d0bc67833..6f7f381c7 100644
--- a/regress/unittests/test_helper/test_helper.c
+++ b/regress/unittests/test_helper/test_helper.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: test_helper.c,v 1.2 2014/05/02 09:41:32 andre Exp $ */ 1/* $OpenBSD: test_helper.c,v 1.3 2015/01/13 14:51:51 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller <djm@mindrot.org> 3 * Copyright (c) 2011 Damien Miller <djm@mindrot.org>
4 * 4 *
@@ -21,6 +21,7 @@
21 21
22#include <sys/types.h> 22#include <sys/types.h>
23#include <sys/param.h> 23#include <sys/param.h>
24#include <sys/uio.h>
24 25
25#include <fcntl.h> 26#include <fcntl.h>
26#include <stdio.h> 27#include <stdio.h>
@@ -31,6 +32,7 @@
31#include <string.h> 32#include <string.h>
32#include <assert.h> 33#include <assert.h>
33#include <unistd.h> 34#include <unistd.h>
35#include <signal.h>
34 36
35#include <openssl/bn.h> 37#include <openssl/bn.h>
36 38
@@ -39,6 +41,7 @@
39#endif 41#endif
40 42
41#include "test_helper.h" 43#include "test_helper.h"
44#include "atomicio.h"
42 45
43#define TEST_CHECK_INT(r, pred) do { \ 46#define TEST_CHECK_INT(r, pred) do { \
44 switch (pred) { \ 47 switch (pred) { \
@@ -180,6 +183,24 @@ test_data_file(const char *name)
180} 183}
181 184
182void 185void
186test_info(char *s, size_t len)
187{
188 snprintf(s, len, "In test %u - \"%s\"\n", test_number,
189 active_test_name == NULL ? "<none>" : active_test_name);
190}
191
192#ifdef SIGINFO
193static void
194siginfo(int unused __unused)
195{
196 char buf[256];
197
198 test_info(buf, sizeof(buf));
199 atomicio(vwrite, STDERR_FILENO, buf, strlen(buf));
200}
201#endif
202
203void
183test_start(const char *n) 204test_start(const char *n)
184{ 205{
185 assert(active_test_name == NULL); 206 assert(active_test_name == NULL);
@@ -187,6 +208,9 @@ test_start(const char *n)
187 if (verbose_mode) 208 if (verbose_mode)
188 printf("test %u - \"%s\": ", test_number, active_test_name); 209 printf("test %u - \"%s\": ", test_number, active_test_name);
189 test_number++; 210 test_number++;
211#ifdef SIGINFO
212 signal(SIGINFO, siginfo);
213#endif
190} 214}
191 215
192void 216void