dcavalca / rpms / systemd

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