[PATCH 0/1] maintenance: fix test t7900-maintenance.sh

STALE1800d

2 messages, 1 author, 2021-09-27 · open the first message on its own page

[PATCH 0/1] maintenance: fix test t7900-maintenance.sh

From: Lénaïc Huard <hidden>
Date: 2021-09-27 21:32:36

The test t7900-maintenance.sh seems to be currently broken on the
master branch on some platforms.
Since commit b681b191, one of the test leverages `systemd-analyze
verify` utility to check the correctness of systemd unit files
generated by git.

But, whereas it works on Arch Linux with a recent version of systemd,
it fails on Ubuntu 18.04 and systemd 237 with this error [1]:

  Failed to create /user.slice/user-1000.slice/session-44.scope/init.scope control group: Permission denied
  Failed to initialize manager: Permission denied

It also fails on CentOS 7.9 and systemd 219 with this error [2]:

    Failed to open /dev/tty0: Permission denied
    Failed to load systemd/user/git-maintenance@.service: Invalid argument

This patch changes the prerequisite used in the test to check if
`system-analyze verify` can be used.
As a result, this step should be now skipped on the two
above-mentioned platforms instead of making the test fail.

[1] https://lore.kernel.org/git/4c0c1fd4-f3f4-5e3a-abd2-0350c18b18b7@gmail.com/
[2] https://lore.kernel.org/git/874ka618n4.fsf@evledraar.gmail.com/

Lénaïc Huard (1):
  maintenance: fix test t7900-maintenance.sh

 t/t7900-maintenance.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

-- 
2.33.0

[PATCH 1/1] maintenance: fix test t7900-maintenance.sh

From: Lénaïc Huard <hidden>
Date: 2021-09-27 21:32:38

Commit b681b191 introduced the support of systemd timers for git
maintenance.
A test is leveraging the `systemd-analyze verify` utility to verify the
correctness of the systemd unit files generated by git.

But on some systems, although the `systemd-analyze` tool is installed
and supports the `verify` subcommand, it fails with some permission
errors.

So, instead of only checking if the `verify` subcommand exists, a more
reliable way of detecting whether `systemd-analyze verify` can be used
is to try to use it.

The SYSTEMD_ANALYZE prerequisite is now trying to run `systemd-analyze
verify` on a systemd unit file which is shipped by systemd itself.
We can reasonably think that, on systemd hosts, this file is present and
valid.

Signed-off-by: Lénaïc Huard <redacted>
---
 t/t7900-maintenance.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh
index 36a4218745..6b4941980c 100755
--- a/t/t7900-maintenance.sh
+++ b/t/t7900-maintenance.sh
@@ -21,8 +21,7 @@ test_xmllint () {
 }
 
 test_lazy_prereq SYSTEMD_ANALYZE '
-	systemd-analyze --help >out &&
-	grep verify out
+	systemd-analyze verify /lib/systemd/system/basic.target
 '
 
 test_systemd_analyze_verify () {
-- 
2.33.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help