]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: don't pipe the whole journal through jq 29378/head
authorFrantisek Sumsal <frantisek@sumsal.cz>
Fri, 29 Sep 2023 21:26:15 +0000 (23:26 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Fri, 29 Sep 2023 21:26:15 +0000 (23:26 +0200)
Doing that in VMs without acceleration is prohibitively expensive (i.e.
20+ seconds in the C8S job). Thankfully, the recent [0] --lines=+n syntax
makes this all quite easy to fix.

[0] 8d6791d2aa9

test/units/testsuite-09.journal.sh

index c6c1f6eccb889db0b5face7020ffc81a79c45c42..2ef192c7a87b429ef5151afe75b85b2674dbaa1c 100755 (executable)
@@ -7,7 +7,7 @@ set -o pipefail
 . "$(dirname "$0")"/util.sh
 
 get_first_boot_id() {
-    journalctl -b "${1:?}" -o json | jq -sr '.[0]._BOOT_ID'
+    journalctl -b "${1:?}" -o json -n +1 | jq -r '._BOOT_ID'
 }
 
 get_last_boot_id() {
@@ -15,7 +15,7 @@ get_last_boot_id() {
 }
 
 get_first_timestamp() {
-    journalctl -b "${1:?}" -o json | jq -sr '.[0].__REALTIME_TIMESTAMP'
+    journalctl -b "${1:?}" -o json -n +1 | jq -r '.__REALTIME_TIMESTAMP'
 }
 
 get_last_timestamp() {