2 * Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
10 #include "../testutil.h"
12 #include <openssl/crypto.h>
13 #include <openssl/bio.h>
18 #ifdef OPENSSL_USE_APPLINK
20 * Using BIO_new_fd() obligates the use of applinks on platforms where it's
21 * relevant. Because it becomes a module of the libtestutil library and would
22 * be disregarded if not actively referred to, we have this dummy that does
23 * exactly this. For any module that uses the rest of the routines here,
24 * OPENSSL_Applink should tag along for sure.
26 void Applink_dummy(void);
27 void Applink_dummy(void)
29 OPENSSL_EXTERN void OPENSSL_Applink(void);
33 /* Generate an error for anyone who tries to actually use this dummy */
34 # define Applink_dummy "DON'T USE THIS"
37 void test_open_streams(void)
39 bio_out = BIO_new_fd(1, 0);
40 bio_err = BIO_new_fd(2, 0);
42 OPENSSL_assert(bio_out != NULL);
43 OPENSSL_assert(bio_err != NULL);
46 void test_close_streams(void)
52 int test_puts_stdout(const char *str)
54 return BIO_puts(bio_out, str);
57 int test_puts_stderr(const char *str)
59 return BIO_puts(bio_err, str);
62 int test_vprintf_stdout(const char *fmt, va_list ap)
64 return BIO_vprintf(bio_out, fmt, ap);
67 int test_vprintf_stderr(const char *fmt, va_list ap)
69 return BIO_vprintf(bio_err, fmt, ap);
72 int test_flush_stdout(void)
74 return BIO_flush(bio_out);
77 int test_flush_stderr(void)
79 return BIO_flush(bio_err);