udisks2/SOURCES/udisks-2.10.0-integration_t...

34 lines
1.4 KiB
Diff

From def82f87dcc0b21e4890e12d82e6007f98551dcb Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Tue, 30 May 2023 18:23:08 +0200
Subject: [PATCH] tests: Forcefully set scsi_debug cd drive as read-only
There's something fishy in newer kernels and read-only detection
doesn't seem to work properly. As suggested in
https://github.com/util-linux/util-linux/issues/18#issuecomment-8453739
setting device ro by `blockdev --setro` seems to fix the issue.
---
src/tests/integration-test | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/tests/integration-test b/src/tests/integration-test
index 5f68217e0..10cdff85e 100755
--- a/src/tests/integration-test
+++ b/src/tests/integration-test
@@ -1096,6 +1096,7 @@ class FS(UDisksTestCase):
time.sleep(5)
self.sync()
cd_fs = self.udisks_filesystem(cd=True)
+ subprocess.call(['blockdev', '--setro', self.cd_device])
# forcing mount CD drive as 'rw' should fail
try:
@@ -1748,6 +1749,7 @@ class Polkit(UDisksTestCase, test_polkitd.PolkitTestCase):
try:
fs = self.udisks_filesystem(cd=True)
self.assertNotEqual(fs, None)
+ subprocess.call(['blockdev', '--setro', self.cd_device])
mount_path = fs.call_mount_sync(no_options, None)
self.assertIn('/media/', mount_path)