summaryrefslogtreecommitdiffstats
path: root/debian/tests
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
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')
-rwxr-xr-xdebian/tests/boot-and-services45
-rw-r--r--debian/tests/control11
-rwxr-xr-xdebian/tests/logind6
-rwxr-xr-xdebian/tests/storage22
4 files changed, 41 insertions, 43 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
diff --git a/debian/tests/control b/debian/tests/control
index a68437f..c167f97 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -12,6 +12,7 @@ Restrictions: needs-root, isolation-container, skippable, breaks-testbed
Tests: unit-config
Depends: systemd,
systemd-resolved,
+ systemd-dev,
libpam-systemd,
libnss-systemd,
acl,
@@ -75,15 +76,17 @@ Depends: systemd-sysv,
systemd-container,
systemd-coredump,
systemd-resolved,
+ systemd-dev,
libpam-systemd,
libdw-dev,
libelf-dev,
xserver-xorg-video-dummy,
xserver-xorg,
- gdm3 [!s390x],
+ gdm3 [!s390x !riscv64],
cron,
network-manager,
busybox-static,
+ sysvinit-utils,
rsyslog,
apparmor,
pkgconf,
@@ -126,6 +129,7 @@ Restrictions: needs-root, isolation-container, breaks-testbed
Tests: upstream
Depends: systemd-tests,
+ systemd-dev,
systemd-journal-remote,
systemd-container,
systemd-coredump,
@@ -220,13 +224,16 @@ Depends: systemd-tests,
softhsm2,
openssh-client,
openssh-server,
+ polkitd,
+ open-iscsi,
+ tgt,
Restrictions: needs-root, allow-stderr, isolation-machine
Tests: boot-smoke
Depends: systemd-sysv,
systemd-resolved,
network-manager,
- gdm3 [!s390x],
+ gdm3 [!s390x !riscv64],
xserver-xorg-video-dummy,
Restrictions: needs-root, isolation-container, allow-stderr, breaks-testbed
diff --git a/debian/tests/logind b/debian/tests/logind
index eea4005..a53910c 100755
--- a/debian/tests/logind
+++ b/debian/tests/logind
@@ -202,6 +202,12 @@ EOF
# main
#
+# Make sure we are running with the logind package under test instead of the one
+# from the base distro
+if [ -z "$AUTOPKGTEST_REBOOT_MARK" ]; then
+ /tmp/autopkgtest-reboot 1
+fi
+
test_started
test_properties
test_in_logind_session
diff --git a/debian/tests/storage b/debian/tests/storage
index d1e42df..d2baf8f 100755
--- a/debian/tests/storage
+++ b/debian/tests/storage
@@ -21,15 +21,25 @@ TIMEOUT_SCSI_DEBUG_ADD_HOST = 5
SCSI_DEBUG_DIR = '/sys/bus/pseudo/drivers/scsi_debug'
+
+def have_scsi_debug():
+ return os.path.isdir(SCSI_DEBUG_DIR)
+
+
+def load_scsi_debug():
+ return subprocess.call(['modprobe', 'scsi_debug', 'dev_size_mb=32'],
+ stderr=subprocess.STDOUT) == 0
+
+
+# Some custom Ubuntu kernels do not build the scsi_debug module at all,
+# so skip the test if we can't load the module (LP: #1847816)
+# This doesn't (currently) apply to Debian, as scsi_debug should always
+# be available in Debian kernels
+@unittest.skipIf(not have_scsi_debug() and not load_scsi_debug(), 'Failed to load scsi_debug module')
class FakeDriveTestBase(unittest.TestCase):
@classmethod
def setUpClass(cls):
- if os.path.isdir(SCSI_DEBUG_DIR):
- return
-
- # Consider missing scsi_debug module a test failure
- subprocess.check_call(['modprobe', 'scsi_debug', 'dev_size_mb=32'])
- assert os.path.isdir(SCSI_DEBUG_DIR)
+ assert have_scsi_debug()
def setUp(self):
existing_adapters = set(glob(os.path.join(SCSI_DEBUG_DIR, 'adapter*')))