dcavalca / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone
ac3a84
From 5ac8c56f111f2875467422c851a05891c0ec7d1b Mon Sep 17 00:00:00 2001
ac3a84
From: Frantisek Sumsal <frantisek@sumsal.cz>
ac3a84
Date: Mon, 31 Oct 2022 12:11:59 +0100
ac3a84
Subject: [PATCH] test: add a couple of sanity tests for journalctl
ac3a84
ac3a84
(cherry picked from commit ca46781c5ffa3aaa7a8fb6f09976357d003c4aae)
ac3a84
ac3a84
Related #2138081
ac3a84
---
ac3a84
 test/units/testsuite-04.sh | 38 ++++++++++++++++++++++++++++++++++++++
ac3a84
 1 file changed, 38 insertions(+)
ac3a84
ac3a84
diff --git a/test/units/testsuite-04.sh b/test/units/testsuite-04.sh
ac3a84
index b5468cbea4..fdc3273fea 100755
ac3a84
--- a/test/units/testsuite-04.sh
ac3a84
+++ b/test/units/testsuite-04.sh
ac3a84
@@ -119,6 +119,44 @@ systemctl start silent-success
ac3a84
 journalctl --sync
ac3a84
 [[ -z "$(journalctl -b -q -u silent-success.service)" ]]
ac3a84
 
ac3a84
+# Exercise the matching machinery
ac3a84
+SYSTEMD_LOG_LEVEL=debug journalctl -b -n 1 /dev/null /dev/zero /dev/null /dev/null /dev/null
ac3a84
+journalctl -b -n 1 /bin/true /bin/false
ac3a84
+journalctl -b -n 1 /bin/true + /bin/false
ac3a84
+journalctl -b -n 1 -r --unit "systemd*"
ac3a84
+
ac3a84
+systemd-run --user -M "testuser@.host" /bin/echo hello
ac3a84
+journalctl --sync
ac3a84
+journalctl -b -n 1 -r --user-unit "*"
ac3a84
+
ac3a84
+(! journalctl -b /dev/lets-hope-this-doesnt-exist)
ac3a84
+(! journalctl -b /dev/null /dev/zero /dev/this-also-shouldnt-exist)
ac3a84
+(! journalctl -b --unit "this-unit-should-not-exist*")
ac3a84
+
ac3a84
+# Facilities & priorities
ac3a84
+journalctl --facility help
ac3a84
+journalctl --facility kern -n 1
ac3a84
+journalctl --facility syslog --priority 0..3 -n 1
ac3a84
+journalctl --facility syslog --priority 3..0 -n 1
ac3a84
+journalctl --facility user --priority 0..0 -n 1
ac3a84
+journalctl --facility daemon --priority warning -n 1
ac3a84
+journalctl --facility daemon --priority warning..info -n 1
ac3a84
+journalctl --facility daemon --priority notice..crit -n 1
ac3a84
+journalctl --facility daemon --priority 5..crit -n 1
ac3a84
+
ac3a84
+(! journalctl --facility hopefully-an-unknown-facility)
ac3a84
+(! journalctl --priority hello-world)
ac3a84
+(! journalctl --priority 0..128)
ac3a84
+(! journalctl --priority 0..systemd)
ac3a84
+
ac3a84
+# Other options
ac3a84
+journalctl --disk-usage
ac3a84
+journalctl --dmesg -n 1
ac3a84
+journalctl --fields
ac3a84
+journalctl --list-boots
ac3a84
+journalctl --update-catalog
ac3a84
+journalctl --list-catalog
ac3a84
+
ac3a84
 # Add new tests before here, the journald restarts below
ac3a84
 # may make tests flappy.
ac3a84