diff options
author | Richard Levitte <levitte@openssl.org> | 2017-04-19 13:06:08 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2017-04-24 18:09:01 +0200 |
commit | f044cd05a1d28c998731108dfcd25ba580cdda07 (patch) | |
tree | 4015bf01610cfd969b16bdfb91cf4b899d9ff7cf /test/bioprinttest.c | |
parent | a9c6d221055c3a85edb23b1364cd60baafed4b9f (diff) |
Avoid using BIO streams in bioprinttest.c
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3243)
Diffstat (limited to 'test/bioprinttest.c')
-rw-r--r-- | test/bioprinttest.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/test/bioprinttest.c b/test/bioprinttest.c index 418d6e4c8d..56aa0b0dec 100644 --- a/test/bioprinttest.c +++ b/test/bioprinttest.c @@ -7,8 +7,16 @@ * https://www.openssl.org/source/license.html */ +#define TESTUTIL_NO_size_t_COMPARISON + #include <stdio.h> #include <string.h> +#include <openssl/e_os2.h> +#ifdef OPENSSL_SYS_WINDOWS +# include <winsock.h> +#else +# include OPENSSL_UNISTD +#endif #include <openssl/bio.h> #include "internal/numbers.h" #include "testutil.h" @@ -245,3 +253,55 @@ int test_main(int argc, char **argv) return run_tests(argv[0]); } + +/* + * Replace testutil output routines. We do this to eliminate possible sources + * of BIO error + */ +void test_open_streams(void) +{ +} + +void test_close_streams(void) +{ +} + +int test_puts_stdout(const char *str) +{ + return write(1, str, strlen(str)); +} + +int test_puts_stderr(const char *str) +{ + return write(2, str, strlen(str)); +} + +static char vprint_buf[10240]; + +int test_vprintf_stdout(const char *fmt, va_list ap) +{ + size_t len = vsnprintf(vprint_buf, sizeof(vprint_buf), fmt, ap); + + if (len >= sizeof(vprint_buf)) + return -1; + return test_puts_stdout(vprint_buf); +} + +int test_vprintf_stderr(const char *fmt, va_list ap) +{ + size_t len = vsnprintf(vprint_buf, sizeof(vprint_buf), fmt, ap); + + if (len >= sizeof(vprint_buf)) + return -1; + return test_puts_stderr(vprint_buf); +} + +int test_flush_stdout(void) +{ + return 0; +} + +int test_flush_stderr(void) +{ + return 0; +} |