You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@serf.apache.org by br...@apache.org on 2026/01/13 14:14:12 UTC
svn commit: r1931293 - serf/trunk/test
Author: brane
Date: Tue Jan 13 14:14:11 2026
New Revision: 1931293
Log:
Allow tests to only output messages from error callbacks, without
cluttering the output with low-level logging.
* test/test_serf.h
(TEST_VERBOSE): Explain what the value does.
* test/test_util.c
(setup_test_context): Register the error callback if TEST_VERBOSE > 0.
Configure console logging if TEST_VERBOSE > 1.
(test__log, test__log_nopref, test__log_skt): Require that the verbose_flag
is greater than 1 in order to log anything.
Modified:
serf/trunk/test/test_serf.h
serf/trunk/test/test_util.c
Modified: serf/trunk/test/test_serf.h
==============================================================================
--- serf/trunk/test/test_serf.h Tue Jan 13 13:54:30 2026 (r1931292)
+++ serf/trunk/test/test_serf.h Tue Jan 13 14:14:11 2026 (r1931293)
@@ -30,8 +30,10 @@
#include "CuTest.h"
#include "MockHTTPinC/MockHTTP.h"
-/* Test logging facilities, set flag to 1 to enable console logging for
- the test suite. */
+/* Test logging facilities; set this flag to:
+ 1 to show messages from error callbacks;
+ 2 or more to also enable console logging the test suite.
+*/
#define TEST_VERBOSE 0
/* Preferred proxy port */
Modified: serf/trunk/test/test_util.c
==============================================================================
--- serf/trunk/test/test_util.c Tue Jan 13 13:54:30 2026 (r1931292)
+++ serf/trunk/test/test_util.c Tue Jan 13 14:14:11 2026 (r1931293)
@@ -498,14 +498,17 @@ static apr_status_t test_error_callback(
apr_status_t
setup_test_context(test_baton_t *tb, apr_pool_t *pool)
{
- serf_log_output_t *output;
apr_status_t status = APR_SUCCESS;
if (!tb->context) {
tb->context = serf_context_create(pool);
- if (TEST_VERBOSE) {
+ if (TEST_VERBOSE > 0) {
serf_global_error_callback_set(test_error_callback, NULL);
+ }
+
+ if (TEST_VERBOSE > 1) {
+ serf_log_output_t *output;
status = serf_logging_create_stream_output(&output, tb->context,
SERF_LOG_DEBUG,
SERF_LOGCOMP_ALL,
@@ -782,7 +785,7 @@ void test__log(int verbose_flag, const c
{
va_list argp;
- if (verbose_flag) {
+ if (verbose_flag > 1) {
log_time();
if (filename)
@@ -798,7 +801,7 @@ void test__log_nopref(int verbose_flag,
{
va_list argp;
- if (verbose_flag) {
+ if (verbose_flag > 1) {
va_start(argp, fmt);
vfprintf(stderr, fmt, argp);
va_end(argp);
@@ -810,7 +813,7 @@ void test__log_skt(int verbose_flag, con
{
va_list argp;
- if (verbose_flag) {
+ if (verbose_flag > 1) {
apr_sockaddr_t *sa;
log_time();
Re: svn commit: r1931293 - serf/trunk/test
Posted by Branko Čibej <br...@apache.org>.
On 13. 1. 26 15:14, brane@apache.org wrote:
> Author: brane
> Date: Tue Jan 13 14:14:11 2026
> New Revision: 1931293
>
> Log:
> Allow tests to only output messages from error callbacks, without
> cluttering the output with low-level logging.
>
> * test/test_serf.h
> (TEST_VERBOSE): Explain what the value does.
>
> * test/test_util.c
> (setup_test_context): Register the error callback if TEST_VERBOSE > 0.
> Configure console logging if TEST_VERBOSE > 1.
> (test__log, test__log_nopref, test__log_skt): Require that the verbose_flag
> is greater than 1 in order to log anything.
Now, with #define TEST_VERBOSE 1, we can do something like this:
$ srcdir=$(cd ../serf-trunk/ && pwd) ./test/test_all ssl
ERROR: <120172> *g--- error:0A00042E:SSL routines::tlsv1 alert protocol version
ERROR: <120172> *g--- error:0A000410:SSL routines::ssl/tls alert handshake failure
.................................................
OK (49 tests)
without having to wade through several hundred lines of logging output.
-- Brane