On Tue, Nov 2, 2021 at 10:25 AM Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> wrote: > Fix tests added in b681b191f92 (maintenance: add support for systemd > timers on Linux, 2021-09-04) to run successfully no systems where s/no/on/ > systemd-analyze is installed, but on which there's a discrepancy > between a FILE argument of "/lib/systemd/system/basic.target" and > "systemd/user/git-maintenance@.service" succeeding. > > There was an attempt to work around previous breakage in these tests > in 670e5973992 (maintenance: fix test t7900-maintenance.sh, > 2021-09-27), as noted in my [1] that commit is wrong about its > assumption that we can use "/lib/systemd/system/basic.target" as a > canary.argument. > > To fix this let's adjust this test to test what it really should be > testing: If we've got systemd-analyze reporting anything useful, we > should use it to check the syntax of our just-generated > "systemd/user/git-maintenance@.service" file. > > Even on systems where this previously succeeded we weren't effectively > doing that, because "systemd-analyze" will pass various syntax errors > by and exit with a status code of 0, e.g. if the "[Unit]" section is > replaced with a nonsensical "[HlaghUnfUnf]" section. > > To do that ignore whatever exit code we get from "systemd-analyze > verify", and filter its stderr output to extract the sorts of lines it > emits no note syntax warnings and errors. We need to filter out s/no/on/ > "Failed to load", which would be emitted e.g. on the > gcc135.fsffrance.org test box[1]. > > We also need to pipe this output to FD's 5 & 6, to avoid mixing up the > trace output with our own output under "-x". > > 1. https://lore.kernel.org/git/211026.8635oo11jk.gmgdl@xxxxxxxxxxxxxxxxxxx/ > > Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>