summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2024-02-19 20:41:49 +0100
committerFrantisek Sumsal <frantisek@sumsal.cz>2024-02-20 15:45:50 +0100
commit5083e42765d9b7311004479a66505831e744bc3f (patch)
tree0520f8b33479f88a50015d6c05e6769ba69c9e66 /tools
parenttest: fix mixed indent (diff)
downloadsystemd-5083e42765d9b7311004479a66505831e744bc3f.tar.xz
systemd-5083e42765d9b7311004479a66505831e744bc3f.zip
test: verify our own units (where applicable)
This is inspired by one of our internal tests that does pretty much the same thing. However, it is slightly more convoluted than I'd like it to be, since I really don't want to duplicate the list of our units in another place, so we need to, somehow, pass the list from the meson file to the test script. I originally envisioned this to be a part of the unit test suite, but this doesn't work for unit files with absolute paths to binaries, as we'd have to install the build first (maybe using a chroot would work?). It doesn't check man pages (since they might not be installed on the test machine) and also skip recursive dependencies (as that would trip over issues in files that are not under our direct control), but it should still cover typos and such. There are currently two units for which the check had to be disabled - syslog.socket, as the corresponding syslog.service might not be installed, and rc-local.service as that's a compat API and the necessary /etc/rc.d/rc.local file may not (and most likely won't be) present.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/meson-extract-unit-files.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/meson-extract-unit-files.py b/tools/meson-extract-unit-files.py
new file mode 100755
index 0000000000..f2b4fa30e7
--- /dev/null
+++ b/tools/meson-extract-unit-files.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+import json
+import re
+import subprocess
+import sys
+
+def main():
+ build_dir = sys.argv[1]
+
+ out = subprocess.run(["meson", "introspect", "--installed", build_dir],
+ stdout=subprocess.PIPE, check=True)
+ files = json.loads(out.stdout)
+ for file in sorted(files.values()):
+ if re.search("^/usr/lib/systemd/(system|user)/", file) and not file.endswith(".conf"):
+ print(file)
+
+if __name__ == "__main__":
+ main()