Fix race in test_bubblewrap_leak
proc entries can be removed during this list comprehension Change-Id: I6b981b539090dba22636778ab72304eace2c0226
This commit is contained in:
parent
9bf871168f
commit
fd8896958f
|
@ -70,9 +70,12 @@ class TestBubblewrap(testtools.TestCase):
|
|||
self.assertEqual(0, true_proc.wait())
|
||||
cmdline = "sleep\x000x%X\x00" % leak_time
|
||||
for x in iterate_timeout(30, "process to exit"):
|
||||
try:
|
||||
sleep_proc = [pid for pid in os.listdir("/proc") if
|
||||
os.path.isfile("/proc/%s/cmdline" % pid) and
|
||||
open("/proc/%s/cmdline" % pid).read() == cmdline]
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
if not sleep_proc:
|
||||
break
|
||||
time.sleep(1)
|
||||
|
|
Loading…
Reference in New Issue