mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
bitbake: tests/runqueue: Fix hashserve shutdown race
The hashserve can delete its socket whilst the cleanup us happening leading to backtraces and test failures. Add code to avoid this race condition. [YOCTO #13542] (Bitbake rev: efd7b025cee25d0ee668c09476395d08fcf5ae1a) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -12,6 +12,7 @@ import os
|
||||
import tempfile
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
#
|
||||
# TODO:
|
||||
@@ -257,6 +258,8 @@ class RunQueueTests(unittest.TestCase):
|
||||
'a1:package_write_ipk_setscene', 'a1:package_qa_setscene']
|
||||
self.assertEqual(set(tasks), set(expected))
|
||||
|
||||
self.shutdown(tempdir)
|
||||
|
||||
@unittest.skipIf(sys.version_info < (3, 5, 0), 'Python 3.5 or later required')
|
||||
def test_hashserv_double(self):
|
||||
with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir:
|
||||
@@ -280,6 +283,7 @@ class RunQueueTests(unittest.TestCase):
|
||||
'a1:package_write_rpm_setscene', 'b1:package_write_ipk_setscene', 'a1:packagedata_setscene']
|
||||
self.assertEqual(set(tasks), set(expected))
|
||||
|
||||
self.shutdown(tempdir)
|
||||
|
||||
@unittest.skipIf(sys.version_info < (3, 5, 0), 'Python 3.5 or later required')
|
||||
def test_hashserv_multiple_setscene(self):
|
||||
@@ -309,3 +313,11 @@ class RunQueueTests(unittest.TestCase):
|
||||
for i in expected:
|
||||
self.assertEqual(tasks.count(i), 1, "%s not in task list once" % i)
|
||||
|
||||
self.shutdown(tempdir)
|
||||
|
||||
def shutdown(self, tempdir):
|
||||
# Wait for the hashserve socket to disappear else we'll see races with the tempdir cleanup
|
||||
while os.path.exists(tempdir + "/hashserve.sock"):
|
||||
time.sleep(0.5)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user