summaryrefslogtreecommitdiffstats
path: root/debian/tests/storage
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/storage
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/storage')
-rwxr-xr-xdebian/tests/storage22
1 files changed, 16 insertions, 6 deletions
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*')))