tests/logging: ensure both stream and wqueue modes are tested

Change-Id: I37e789b5b287d72c443f50fd99a5284bc7296c0b
This commit is contained in:
Vadim Yanitskiy 2022-01-29 20:02:43 +06:00
parent 846db1b3c3
commit 27961906ad
5 changed files with 33 additions and 7 deletions

View File

@ -363,7 +363,9 @@ EXTRA_DIST = testsuite.at $(srcdir)/package.m4 $(TESTSUITE) \
gb/gprs_ns2_test.ok \
gprs/gprs_test.ok kasumi/kasumi_test.ok \
msgfile/msgfile_test.ok msgfile/msgconfig.cfg \
logging/logging_test.ok logging/logging_test.err \
logging/logging_test.ok \
logging/logging_test_stream.err \
logging/logging_test_wqueue.err \
logging/logging_vty_test.vty \
fr/fr_test.ok loggingrb/logging_test.ok \
loggingrb/logging_test.err strrb/strrb_test.ok \
@ -501,9 +503,12 @@ endif
>$(srcdir)/gsm48/rest_octets_test.ok
gprs/gprs_test \
>$(srcdir)/gprs/gprs_test.ok
logging/logging_test \
logging/logging_test wqueue \
>$(srcdir)/logging/logging_test.ok \
2>$(srcdir)/logging/logging_test.err
2>$(srcdir)/logging/logging_test_wqueue.err
logging/logging_test stream \
>$(srcdir)/logging/logging_test.ok \
2>$(srcdir)/logging/logging_test_stream.err
codec/codec_test \
>$(srcdir)/codec/codec_test.ok
codec/codec_ecu_fr_test \

View File

@ -78,6 +78,11 @@ int main(int argc, char **argv)
log_set_print_category(stderr_target, 1);
log_set_use_color(stderr_target, 0);
if (argc > 1 && !strcmp(argv[1], "wqueue"))
log_target_file_switch_to_wqueue(stderr_target);
else
log_target_file_switch_to_stream(stderr_target);
log_parse_category_mask(stderr_target, "DRLL:DCC");
log_parse_category_mask(stderr_target, "DRLL");

View File

@ -0,0 +1,9 @@
DRLL You should see this
DCC You should see this
DRLL You should see this
DLGLOBAL You should see this on DLGLOBAL (a)
DLGLOBAL You should see this on DLGLOBAL (b)
DLGLOBAL You should see this on DLGLOBAL (c)
DLGLOBAL You should see this on DLGLOBAL (d)
DLGLOBAL You should see this on DLGLOBAL (e)
DLGLOBAL You should see this (DLGLOBAL on DEBUG)

View File

@ -168,11 +168,18 @@ cat $abs_srcdir/gprs/gprs_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/gprs/gprs_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([logging])
AT_KEYWORDS([logging])
AT_SETUP([logging_stream])
AT_KEYWORDS([logging_stream])
cat $abs_srcdir/logging/logging_test.ok > expout
cat $abs_srcdir/logging/logging_test.err > experr
AT_CHECK([$abs_top_builddir/tests/logging/logging_test], [0], [expout], [experr])
cat $abs_srcdir/logging/logging_test_stream.err > experr
AT_CHECK([$abs_top_builddir/tests/logging/logging_test stream], [0], [expout], [experr])
AT_CLEANUP
AT_SETUP([logging_wqueue])
AT_KEYWORDS([logging_wqueue])
cat $abs_srcdir/logging/logging_test.ok > expout
cat $abs_srcdir/logging/logging_test_wqueue.err > experr
AT_CHECK([$abs_top_builddir/tests/logging/logging_test wqueue], [0], [expout], [experr])
AT_CLEANUP
AT_SETUP([codec])