summaryrefslogtreecommitdiff
path: root/regress/unittests/test_helper
diff options
context:
space:
mode:
Diffstat (limited to 'regress/unittests/test_helper')
-rw-r--r--regress/unittests/test_helper/test_helper.c33
-rw-r--r--regress/unittests/test_helper/test_helper.h4
2 files changed, 32 insertions, 5 deletions
diff --git a/regress/unittests/test_helper/test_helper.c b/regress/unittests/test_helper/test_helper.c
index 4cc70852c..e7a47b265 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.8 2018/02/08 08:46:20 djm Exp $ */ 1/* $OpenBSD: test_helper.c,v 1.11 2018/11/23 02:53:57 dtucker Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller <djm@mindrot.org> 3 * Copyright (c) 2011 Damien Miller <djm@mindrot.org>
4 * 4 *
@@ -35,11 +35,13 @@
35#include <signal.h> 35#include <signal.h>
36 36
37#include <openssl/bn.h> 37#include <openssl/bn.h>
38#include <openssl/err.h>
38 39
39#if defined(HAVE_STRNVIS) && defined(HAVE_VIS_H) && !defined(BROKEN_STRNVIS) 40#if defined(HAVE_STRNVIS) && defined(HAVE_VIS_H) && !defined(BROKEN_STRNVIS)
40# include <vis.h> 41# include <vis.h>
41#endif 42#endif
42 43
44#include "entropy.h"
43#include "test_helper.h" 45#include "test_helper.h"
44#include "atomicio.h" 46#include "atomicio.h"
45 47
@@ -115,12 +117,17 @@ static test_onerror_func_t *test_onerror = NULL;
115static void *onerror_ctx = NULL; 117static void *onerror_ctx = NULL;
116static const char *data_dir = NULL; 118static const char *data_dir = NULL;
117static char subtest_info[512]; 119static char subtest_info[512];
120static int fast = 0;
121static int slow = 0;
118 122
119int 123int
120main(int argc, char **argv) 124main(int argc, char **argv)
121{ 125{
122 int ch; 126 int ch;
123 127
128 seed_rng();
129 ERR_load_CRYPTO_strings();
130
124 /* Handle systems without __progname */ 131 /* Handle systems without __progname */
125 if (__progname == NULL) { 132 if (__progname == NULL) {
126 __progname = strrchr(argv[0], '/'); 133 __progname = strrchr(argv[0], '/');
@@ -134,8 +141,14 @@ main(int argc, char **argv)
134 } 141 }
135 } 142 }
136 143
137 while ((ch = getopt(argc, argv, "vqd:")) != -1) { 144 while ((ch = getopt(argc, argv, "Ffvqd:")) != -1) {
138 switch (ch) { 145 switch (ch) {
146 case 'F':
147 slow = 1;
148 break;
149 case 'f':
150 fast = 1;
151 break;
139 case 'd': 152 case 'd':
140 data_dir = optarg; 153 data_dir = optarg;
141 break; 154 break;
@@ -167,17 +180,29 @@ main(int argc, char **argv)
167} 180}
168 181
169int 182int
170test_is_verbose() 183test_is_verbose(void)
171{ 184{
172 return verbose_mode; 185 return verbose_mode;
173} 186}
174 187
175int 188int
176test_is_quiet() 189test_is_quiet(void)
177{ 190{
178 return quiet_mode; 191 return quiet_mode;
179} 192}
180 193
194int
195test_is_fast(void)
196{
197 return fast;
198}
199
200int
201test_is_slow(void)
202{
203 return slow;
204}
205
181const char * 206const char *
182test_data_file(const char *name) 207test_data_file(const char *name)
183{ 208{
diff --git a/regress/unittests/test_helper/test_helper.h b/regress/unittests/test_helper/test_helper.h
index 6da0066e9..1f893c8dd 100644
--- a/regress/unittests/test_helper/test_helper.h
+++ b/regress/unittests/test_helper/test_helper.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: test_helper.h,v 1.8 2018/02/08 08:46:20 djm Exp $ */ 1/* $OpenBSD: test_helper.h,v 1.9 2018/10/17 23:28:05 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller <djm@mindrot.org> 3 * Copyright (c) 2011 Damien Miller <djm@mindrot.org>
4 * 4 *
@@ -45,6 +45,8 @@ void set_onerror_func(test_onerror_func_t *f, void *ctx);
45void test_done(void); 45void test_done(void);
46int test_is_verbose(void); 46int test_is_verbose(void);
47int test_is_quiet(void); 47int test_is_quiet(void);
48int test_is_fast(void);
49int test_is_slow(void);
48void test_subtest_info(const char *fmt, ...) 50void test_subtest_info(const char *fmt, ...)
49 __attribute__((format(printf, 1, 2))); 51 __attribute__((format(printf, 1, 2)));
50void ssl_err_check(const char *file, int line); 52void ssl_err_check(const char *file, int line);