From 579d0fabcddb4a0ec4307be420f0bc7c2eea6b7c Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Fri, 28 Apr 2017 14:37:19 +0200 Subject: [PATCH] testutil: Move printing function declarations to "internal" header These functions aren't meant to be used directly by the test programs, reflect that by making the declarations a little harder to reach, but still available enough if there's a need to override them. Reviewed-by: Andy Polyakov Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/3345) --- test/bioprinttest.c | 1 + test/testutil.h | 18 +----------------- test/testutil/basic_output.c | 1 + test/testutil/driver.c | 1 + test/testutil/output.h | 30 ++++++++++++++++++++++++++++++ test/testutil/test_main.c | 1 + test/testutil/tests.c | 1 + 7 files changed, 36 insertions(+), 17 deletions(-) create mode 100644 test/testutil/output.h diff --git a/test/bioprinttest.c b/test/bioprinttest.c index 2c2dc8c5d9..8ae0a5a04b 100644 --- a/test/bioprinttest.c +++ b/test/bioprinttest.c @@ -14,6 +14,7 @@ #include #include "internal/numbers.h" #include "testutil.h" +#include "testutil/output.h" #define nelem(x) (int)(sizeof(x) / sizeof((x)[0])) diff --git a/test/testutil.h b/test/testutil.h index ecf993445d..66b9e814ee 100644 --- a/test/testutil.h +++ b/test/testutil.h @@ -355,25 +355,9 @@ void test_info_c90(const char *desc, ...) PRINTF_FORMAT(1, 2); OPENSSL_assert(!#condition); \ } \ } while (0) -#endif /* HEADER_TESTUTIL_H */ - - -/* - * The basic I/O functions used by the test framework. These can be - * overriden when needed. Note that if one is, then all must be. - */ -void test_open_streams(void); -void test_close_streams(void); -/* The following ALL return the number of characters written */ -int test_puts_stdout(const char *str); -int test_puts_stderr(const char *str); -int test_vprintf_stdout(const char *fmt, va_list ap); -int test_vprintf_stderr(const char *fmt, va_list ap); -/* These return failure or success */ -int test_flush_stdout(void); -int test_flush_stderr(void); extern BIO *bio_out; extern BIO *bio_err; int subtest_level(void); +#endif /* HEADER_TESTUTIL_H */ diff --git a/test/testutil/basic_output.c b/test/testutil/basic_output.c index 9080aaec37..8cf5def714 100644 --- a/test/testutil/basic_output.c +++ b/test/testutil/basic_output.c @@ -8,6 +8,7 @@ */ #include "../testutil.h" +#include "output.h" #include #include diff --git a/test/testutil/driver.c b/test/testutil/driver.c index 29c97a9912..7914ea5201 100644 --- a/test/testutil/driver.c +++ b/test/testutil/driver.c @@ -8,6 +8,7 @@ */ #include "../testutil.h" +#include "output.h" #include #include diff --git a/test/testutil/output.h b/test/testutil/output.h new file mode 100644 index 0000000000..5e7d8c0954 --- /dev/null +++ b/test/testutil/output.h @@ -0,0 +1,30 @@ +/* + * Copyright 2014-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_TU_OUTPUT_H +# define HEADER_TU_OUTPUT_H + +#include + +/* + * The basic I/O functions used internally by the test framework. These + * can be overriden when needed. Note that if one is, then all must be. + */ +void test_open_streams(void); +void test_close_streams(void); +/* The following ALL return the number of characters written */ +int test_puts_stdout(const char *str); +int test_puts_stderr(const char *str); +int test_vprintf_stdout(const char *fmt, va_list ap); +int test_vprintf_stderr(const char *fmt, va_list ap); +/* These return failure or success */ +int test_flush_stdout(void); +int test_flush_stderr(void); + +#endif /* HEADER_TU_OUTPUT_H */ diff --git a/test/testutil/test_main.c b/test/testutil/test_main.c index 0152421fe1..7c9843c01c 100644 --- a/test/testutil/test_main.c +++ b/test/testutil/test_main.c @@ -8,6 +8,7 @@ */ #include "../testutil.h" +#include "output.h" #include diff --git a/test/testutil/tests.c b/test/testutil/tests.c index 67b20a572c..b7f5bfb2a1 100644 --- a/test/testutil/tests.c +++ b/test/testutil/tests.c @@ -8,6 +8,7 @@ */ #include "../testutil.h" +#include "output.h" #include #include "../../e_os.h" -- 2.25.1