Home | History | Annotate | Line # | Download | only in testutil
      1      1.1  christos /*
      2      1.1  christos  * Copyright 2014-2020 The OpenSSL Project Authors. All Rights Reserved.
      3      1.1  christos  *
      4      1.1  christos  * Licensed under the Apache License 2.0 (the "License").  You may not use
      5      1.1  christos  * this file except in compliance with the License.  You can obtain a copy
      6      1.1  christos  * in the file LICENSE in the source distribution or at
      7      1.1  christos  * https://www.openssl.org/source/license.html
      8      1.1  christos  */
      9      1.1  christos 
     10      1.1  christos #ifndef OSSL_TESTUTIL_OUTPUT_H
     11  1.1.1.2  christos #define OSSL_TESTUTIL_OUTPUT_H
     12      1.1  christos 
     13  1.1.1.2  christos #include <stdarg.h>
     14      1.1  christos 
     15  1.1.1.2  christos #define ossl_test__attr__(x)
     16  1.1.1.2  christos #if defined(__GNUC__) && defined(__STDC_VERSION__)    \
     17      1.1  christos     && !defined(__MINGW32__) && !defined(__MINGW64__) \
     18      1.1  christos     && !defined(__APPLE__)
     19  1.1.1.2  christos /*
     20  1.1.1.2  christos  * Because we support the 'z' modifier, which made its appearance in C99,
     21  1.1.1.2  christos  * we can't use __attribute__ with pre C99 dialects.
     22  1.1.1.2  christos  */
     23  1.1.1.2  christos #if __STDC_VERSION__ >= 199901L
     24  1.1.1.2  christos #undef ossl_test__attr__
     25  1.1.1.2  christos #define ossl_test__attr__ __attribute__
     26  1.1.1.2  christos #if __GNUC__ * 10 + __GNUC_MINOR__ >= 44
     27  1.1.1.2  christos #define ossl_test__printf__ __gnu_printf__
     28  1.1.1.2  christos #else
     29  1.1.1.2  christos #define ossl_test__printf__ __printf__
     30  1.1.1.2  christos #endif
     31  1.1.1.2  christos #endif
     32  1.1.1.2  christos #endif
     33      1.1  christos /*
     34      1.1  christos  * The basic I/O functions used internally by the test framework.  These
     35      1.1  christos  * can be overridden when needed. Note that if one is, then all must be.
     36      1.1  christos  */
     37      1.1  christos void test_open_streams(void);
     38      1.1  christos void test_close_streams(void);
     39      1.1  christos void test_adjust_streams_tap_level(int level);
     40      1.1  christos /* The following ALL return the number of characters written */
     41      1.1  christos int test_vprintf_stdout(const char *fmt, va_list ap)
     42      1.1  christos     ossl_test__attr__((__format__(ossl_test__printf__, 1, 0)));
     43      1.1  christos int test_vprintf_tapout(const char *fmt, va_list ap)
     44      1.1  christos     ossl_test__attr__((__format__(ossl_test__printf__, 1, 0)));
     45      1.1  christos int test_vprintf_stderr(const char *fmt, va_list ap)
     46      1.1  christos     ossl_test__attr__((__format__(ossl_test__printf__, 1, 0)));
     47      1.1  christos int test_vprintf_taperr(const char *fmt, va_list ap)
     48      1.1  christos     ossl_test__attr__((__format__(ossl_test__printf__, 1, 0)));
     49      1.1  christos /* These return failure or success */
     50      1.1  christos int test_flush_stdout(void);
     51      1.1  christos int test_flush_tapout(void);
     52      1.1  christos int test_flush_stderr(void);
     53      1.1  christos int test_flush_taperr(void);
     54      1.1  christos 
     55      1.1  christos /* Commodity functions.  There's no need to override these */
     56      1.1  christos int test_printf_stdout(const char *fmt, ...)
     57      1.1  christos     ossl_test__attr__((__format__(ossl_test__printf__, 1, 2)));
     58      1.1  christos int test_printf_tapout(const char *fmt, ...)
     59      1.1  christos     ossl_test__attr__((__format__(ossl_test__printf__, 1, 2)));
     60      1.1  christos int test_printf_stderr(const char *fmt, ...)
     61      1.1  christos     ossl_test__attr__((__format__(ossl_test__printf__, 1, 2)));
     62      1.1  christos int test_printf_taperr(const char *fmt, ...)
     63      1.1  christos     ossl_test__attr__((__format__(ossl_test__printf__, 1, 2)));
     64      1.1  christos 
     65  1.1.1.2  christos #undef ossl_test__printf__
     66  1.1.1.2  christos #undef ossl_test__attr__
     67      1.1  christos 
     68  1.1.1.2  christos #endif /* OSSL_TESTUTIL_OUTPUT_H */
     69