提交 0918b94c 编写于 作者: R Richard Levitte

testutil: Remove test_puts_std{out,err}, they are superfluous

Reviewed-by: NAndy Polyakov <appro@openssl.org>
Reviewed-by: NRich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3345)
上级 68e49bf2
...@@ -261,18 +261,6 @@ void test_close_streams(void) ...@@ -261,18 +261,6 @@ void test_close_streams(void)
{ {
} }
int test_puts_stdout(const char *str)
{
return fputs(str, stdout);
}
int test_puts_stderr(const char *str)
{
return fputs(str, stderr);
}
static char vprint_buf[10240];
/* /*
* This works out as long as caller doesn't use any "fancy" formats. * This works out as long as caller doesn't use any "fancy" formats.
* But we are caller's caller, and test_str_eq is the only one called, * But we are caller's caller, and test_str_eq is the only one called,
...@@ -280,20 +268,12 @@ static char vprint_buf[10240]; ...@@ -280,20 +268,12 @@ static char vprint_buf[10240];
*/ */
int test_vprintf_stdout(const char *fmt, va_list ap) int test_vprintf_stdout(const char *fmt, va_list ap)
{ {
size_t len = vsnprintf(vprint_buf, sizeof(vprint_buf), fmt, ap); return vfprintf(stdout, 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) int test_vprintf_stderr(const char *fmt, va_list ap)
{ {
size_t len = vsnprintf(vprint_buf, sizeof(vprint_buf), fmt, ap); return vfprintf(stderr, fmt, ap);
if (len >= sizeof(vprint_buf))
return -1;
return test_puts_stderr(vprint_buf);
} }
int test_flush_stdout(void) int test_flush_stdout(void)
......
...@@ -31,16 +31,6 @@ void test_close_streams(void) ...@@ -31,16 +31,6 @@ void test_close_streams(void)
BIO_free(bio_err); BIO_free(bio_err);
} }
int test_puts_stdout(const char *str)
{
return BIO_puts(bio_out, str);
}
int test_puts_stderr(const char *str)
{
return BIO_puts(bio_err, str);
}
int test_vprintf_stdout(const char *fmt, va_list ap) int test_vprintf_stdout(const char *fmt, va_list ap)
{ {
return BIO_vprintf(bio_out, fmt, ap); return BIO_vprintf(bio_out, fmt, ap);
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
void test_open_streams(void); void test_open_streams(void);
void test_close_streams(void); void test_close_streams(void);
/* The following ALL return the number of characters written */ /* 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_stdout(const char *fmt, va_list ap);
int test_vprintf_stderr(const char *fmt, va_list ap); int test_vprintf_stderr(const char *fmt, va_list ap);
/* These return failure or success */ /* These return failure or success */
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
int test_main(int argc, char *argv[]) int test_main(int argc, char *argv[])
{ {
if (argc > 1) if (argc > 1)
test_puts_stderr("Warning: ignoring extra command-line arguments.\n"); test_printf_stderr("Warning: ignoring extra command-line arguments.\n");
register_tests(); register_tests();
return run_tests(argv[0]); return run_tests(argv[0]);
......
...@@ -49,19 +49,17 @@ static void test_fail_message(const char *prefix, const char *file, int line, ...@@ -49,19 +49,17 @@ static void test_fail_message(const char *prefix, const char *file, int line,
static void test_fail_message_va(const char *prefix, const char *file, int line, static void test_fail_message_va(const char *prefix, const char *file, int line,
const char *type, const char *fmt, va_list ap) const char *type, const char *fmt, va_list ap)
{ {
test_printf_stderr("%*s# ", subtest_level(), ""); test_printf_stderr("%*s# %s: ", subtest_level(), "",
test_puts_stderr(prefix != NULL ? prefix : "ERROR"); prefix != NULL ? prefix : "ERROR");
test_puts_stderr(":");
if (type) if (type)
test_printf_stderr(" (%s)", type); test_printf_stderr("(%s)", type);
if (fmt != NULL) { if (fmt != NULL) {
test_puts_stderr(" ");
test_vprintf_stderr(fmt, ap); test_vprintf_stderr(fmt, ap);
} }
if (file != NULL) { if (file != NULL) {
test_printf_stderr(" @ %s:%d", file, line); test_printf_stderr(" @ %s:%d", file, line);
} }
test_puts_stderr("\n"); test_printf_stderr("\n");
test_flush_stderr(); test_flush_stderr();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册