File: lp2126596-tests-cd-disconnect.patch

package info (click to toggle)
gvfs 1.58.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,528 kB
  • sloc: ansic: 105,955; python: 1,466; xml: 944; sh: 146; makefile: 54
file content (41 lines) | stat: -rw-r--r-- 1,439 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From: Simon Poirier <simon.poirier@canonical.com>
Date: Tue, 21 Oct 2025 11:41:03 +0200
Subject: fix autopkgtest flakiness with cdrom

Waits in tests when disconnecting cdrom, leaving
time for the gio monitor to detect the removal before adding again.

Bug-Ubuntu: https://launchpad.net/bugs/2126596
Forwarded: https://gitlab.gnome.org/GNOME/gvfs/-/merge_requests/283
Last-Update: 2025-10-21
---
 test/gvfs-test | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/test/gvfs-test b/test/gvfs-test
index 876ebde..452c4e0 100755
--- a/test/gvfs-test
+++ b/test/gvfs-test
@@ -1004,6 +1004,7 @@ class Drive(GvfsTestCase):
         # we cannot write to a scsi_debug CD drive, so write it into it in hard
         # disk mode
         dev = self.create_host(PTYPE_DISK)
+        self.root_command('udevadm wait -t10 --settle /dev/%s' % dev)
 
         # put test.iso onto disk
         img = os.path.join(my_dir, 'files', fname)
@@ -1020,7 +1021,13 @@ class Drive(GvfsTestCase):
         ctx = GLib.MainContext().default()
         while ctx.iteration(False):
             pass
-        self.monitor.stdout.read()
+
+        # Let a few seconds the gio monitor settle and detect the removal.
+        for _ in range(20):
+            out = self.monitor.stdout.read()
+            if out and b"Drive disconnected" in out:
+                break
+            time.sleep(0.2)
 
     def setUp(self):
         super().setUp()