summaryrefslogtreecommitdiffstats
path: root/debian/tests/boot-and-services
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 03:50:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 03:50:44 +0000
commit5c4ff5cee2b18c18b315c8887ab60e5b7940ae0b (patch)
tree52c412d94cd9319af800bb1ddda8d906136fbd0a /debian/tests/boot-and-services
parentMerging upstream version 256. (diff)
downloadsystemd-5c4ff5cee2b18c18b315c8887ab60e5b7940ae0b.tar.xz
systemd-5c4ff5cee2b18c18b315c8887ab60e5b7940ae0b.zip
Adding debian version 256-1.debian/256-1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests/boot-and-services')
-rwxr-xr-xdebian/tests/boot-and-services45
1 files changed, 10 insertions, 35 deletions
diff --git a/debian/tests/boot-and-services b/debian/tests/boot-and-services
index dc35840..e4ed862 100755
--- a/debian/tests/boot-and-services
+++ b/debian/tests/boot-and-services
@@ -93,8 +93,9 @@ class ServicesTest(unittest.TestCase):
self.active_unit('NetworkManager')
def test_cron(self):
- out = subprocess.check_output(['ps', 'u', '-C', 'cron'])
- self.assertIn(b'root', out)
+ pid = subprocess.check_output(['pidof', 'cron'], universal_newlines=True).strip()
+ out = subprocess.check_output(['ps', 'u', pid], universal_newlines=True)
+ self.assertIn('root', out)
self.active_unit('cron')
def test_logind(self):
@@ -105,8 +106,9 @@ class ServicesTest(unittest.TestCase):
@unittest.skipIf('pkg.systemd.upstream' in os.environ.get('DEB_BUILD_PROFILES', ''),
'Forwarding to rsyslog is a Debian patch')
def test_rsyslog(self):
- out = subprocess.check_output(['ps', 'u', '-C', 'rsyslogd'])
- self.assertIn(b'bin/rsyslogd', out)
+ pid = subprocess.check_output(['pidof', 'rsyslogd'], universal_newlines=True).strip()
+ out = subprocess.check_output(['ps', 'u', pid], universal_newlines=True)
+ self.assertIn('bin/rsyslogd', out)
self.active_unit('rsyslog')
with open('/var/log/syslog') as f:
log = f.read()
@@ -124,32 +126,6 @@ class ServicesTest(unittest.TestCase):
self.assertIn(b'\nP: /devices/', out)
self.active_unit('systemd-udevd')
- def test_tmp_mount(self):
- # check if we want to mount /tmp in fstab
- want_tmp_mount = False
- try:
- with open('/etc/fstab') as f:
- for l in f:
- try:
- if not l.startswith('#') and l.split()[1] in ('/tmp', '/tmp/'):
- want_tmp_mount = True
- break
- except IndexError:
- pass
- except FileNotFoundError:
- pass
-
- # ensure that we actually do/don't have a /tmp mount
- (status, status_out) = subprocess.getstatusoutput('systemctl status tmp.mount')
- findmnt = subprocess.call(['findmnt', '-n', '/tmp'], stdout=subprocess.PIPE)
- if want_tmp_mount:
- self.assertEqual(status, 0, status_out)
- self.assertEqual(findmnt, 0)
- else:
- # 4 is correct (since upstream commit ca473d57), accept 3 for systemd <= 230
- self.assertIn(status, [3, 4], status_out)
- self.assertNotEqual(findmnt, 0)
-
@unittest.skipIf('pkg.systemd.upstream' in os.environ.get('DEB_BUILD_PROFILES', ''),
'Debian specific configuration, N/A for upstream')
def test_tmp_cleanup(self):
@@ -163,17 +139,16 @@ class ServicesTest(unittest.TestCase):
# all files in /tmp/ should get cleaned up on boot
self.assertFalse(os.path.exists('/tmp/oldfile.test'))
self.assertFalse(os.path.exists('/tmp/newfile.test'))
- # files in /var/tmp/ older than 30d should get cleaned up
- # XXX FIXME: /var/tmp/ cleanup was disabled in #675422
- # if not is_container:
- # self.assertFalse(os.path.exists('/var/tmp/oldfile.test'))
+ # files in /var/tmp/ older than 30d should get cleaned up, unless legacy
+ # compat tmpfiles.d is installed
+ if not is_container and not os.path.exists('/etc/tmpfiles.d/tmp.conf'):
+ self.assertFalse(os.path.exists('/var/tmp/oldfile.test'))
self.assertTrue(os.path.exists('/var/tmp/newfile.test'))
# next run should leave the recent ones
os.close(os.open('/tmp/newfile.test',
os.O_CREAT | os.O_EXCL | os.O_WRONLY))
subprocess.check_call(['systemctl', 'start', 'systemd-tmpfiles-clean'])
- wait_unit_stop('systemd-tmpfiles-clean')
self.assertTrue(os.path.exists('/tmp/newfile.test'))
# Helper methods