]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: send stdout/stderr of testsuite units to journal & console
authorFrantisek Sumsal <frantisek@sumsal.cz>
Thu, 16 Jun 2022 20:16:53 +0000 (22:16 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 17 Jun 2022 03:54:50 +0000 (12:54 +0900)
to make debugging in CIs slightly easier.

test/test-functions
test/units/testsuite-22.service
test/units/testsuite-35.service
test/units/testsuite-45.service
test/units/testsuite-64.service
test/units/testsuite-71.service
test/units/testsuite-73.service

index d5462d1be898e294e027802d817e824d1d5adf18..98650a503fe97408b064f88115fc28d0951e099c 100644 (file)
@@ -2941,6 +2941,18 @@ test_setup() {
             mask_supporting_services
         fi
 
+        # Send stdout/stderr of testsuite-*.service units to both journal and
+        # console to make debugging in CIs easier
+        # Note: we can't use a dropin for `testsuite-.service`, since that also
+        #       overrides 'sub-units' of some tests that already use a specific
+        #       value for Standard(Output|Error)=
+        #       (e.g. test/units/testsuite-66-deviceisolation.service)
+        if ! get_bool "$INTERACTIVE_DEBUG"; then
+            local dropin_dir="${initdir:?}/etc/systemd/system/testsuite-${TESTID:?}.service.d"
+            mkdir -p "$dropin_dir"
+            printf '[Service]\nStandardOutput=journal+console\nStandardError=journal+console' >"$dropin_dir/99-stdout.conf"
+        fi
+
         if get_bool "$hook_defined"; then
             test_append_files "${initdir:?}"
         fi
index b9ecc4c5d63066e016a6e3bf1dc6bdab05a9a5ae..a5ed660c62370b3e799b9f06901526a1b7a9fc29 100644 (file)
@@ -9,5 +9,3 @@ Wants=getty-pre.target
 ExecStartPre=rm -f /failed /testok
 ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
 Type=oneshot
-StandardOutput=tty
-StandardError=tty
index 556a57a384421bf14857787ab614b3f7f33c794c..0599f6104ea4fafc08556931684414224a996bf0 100644 (file)
@@ -5,6 +5,4 @@ Description=TEST-35-LOGIN
 [Service]
 ExecStartPre=rm -f /failed /testok
 ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
-StandardOutput=journal+console
-StandardError=journal+console
 Type=oneshot
index 79c0a6f117feea52dda2955f46c32a2e742c8795..b16ce9933f5eddb32d162d2b85960843157fb28e 100644 (file)
@@ -5,6 +5,4 @@ Description=TEST-45-TIMEDATE
 [Service]
 ExecStartPre=rm -f /failed /testok
 ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
-StandardOutput=journal+console
-StandardError=journal+console
 Type=oneshot
index 10b61e7e532810a7b0cc36babadf8283ac02d0ad..f75a3d7aad4ea8d898cd7ee07faa9b477c2fdee5 100644 (file)
@@ -6,5 +6,3 @@ Description=TEST-64-UDEV
 ExecStartPre=rm -f /failed /testok
 ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
 Type=oneshot
-StandardOutput=journal+console
-StandardError=journal+console
index 019e8bff24de33b54f7efde8456a44b43682f820..1718629c05a88c468f3f08ffe389d668188f86c8 100644 (file)
@@ -5,6 +5,4 @@ Description=TEST-71-HOSTNAME
 [Service]
 ExecStartPre=rm -f /failed /testok
 ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
-StandardOutput=journal+console
-StandardError=journal+console
 Type=oneshot
index bee8c4215d7b381606147b82eeb25fc73210df66..3ebd24da184fb396dc3d02e514c7ce19edc2ca11 100644 (file)
@@ -5,6 +5,4 @@ Description=TEST-73-LOCALE
 [Service]
 ExecStartPre=rm -f /failed /testok
 ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
-StandardOutput=journal+console
-StandardError=journal+console
 Type=oneshot