aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2022-01-29 20:02:43 +0600
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2022-01-31 15:45:22 +0600
commit27961906ad77e42320b1a955cbf6a40c5113b129 (patch)
tree73883b82559249c62ba141b9cf2f3cceb41583cb /tests
parent846db1b3c3a224313f0459485d8e9cc7cb8cfd4b (diff)
tests/logging: ensure both stream and wqueue modes are tested
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am11
-rw-r--r--tests/logging/logging_test.c5
-rw-r--r--tests/logging/logging_test_stream.err (renamed from tests/logging/logging_test.err)0
-rw-r--r--tests/logging/logging_test_wqueue.err9
-rw-r--r--tests/testsuite.at15
5 files changed, 33 insertions, 7 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f54ce188..3375c45a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -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 \
diff --git a/tests/logging/logging_test.c b/tests/logging/logging_test.c
index ac6fc52d..12a7374f 100644
--- a/tests/logging/logging_test.c
+++ b/tests/logging/logging_test.c
@@ -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");
diff --git a/tests/logging/logging_test.err b/tests/logging/logging_test_stream.err
index 17b3cad0..17b3cad0 100644
--- a/tests/logging/logging_test.err
+++ b/tests/logging/logging_test_stream.err
diff --git a/tests/logging/logging_test_wqueue.err b/tests/logging/logging_test_wqueue.err
new file mode 100644
index 00000000..17b3cad0
--- /dev/null
+++ b/tests/logging/logging_test_wqueue.err
@@ -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)
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 882203e0..5da08e5f 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -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])