diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-10-02 10:14:24 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-10-02 14:18:59 +0100 |
| commit | 562de41ce7c576c96d55586637c156313c428ff4 (patch) | |
| tree | c0fec8f3bf621aaa2831a825f8f13f76d42e4b27 /bitbake/lib/bb | |
| parent | 0b9f2ac2e1fabe0230801c4bda5ae6b0a2d10e6f (diff) | |
| download | poky-562de41ce7c576c96d55586637c156313c428ff4.tar.gz | |
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>
Diffstat (limited to 'bitbake/lib/bb')
| -rw-r--r-- | bitbake/lib/bb/tests/runqueue.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/runqueue.py b/bitbake/lib/bb/tests/runqueue.py index 50b3392bc1..5e6439156d 100644 --- a/bitbake/lib/bb/tests/runqueue.py +++ b/bitbake/lib/bb/tests/runqueue.py | |||
| @@ -12,6 +12,7 @@ import os | |||
| 12 | import tempfile | 12 | import tempfile |
| 13 | import subprocess | 13 | import subprocess |
| 14 | import sys | 14 | import sys |
| 15 | import time | ||
| 15 | 16 | ||
| 16 | # | 17 | # |
| 17 | # TODO: | 18 | # TODO: |
| @@ -257,6 +258,8 @@ class RunQueueTests(unittest.TestCase): | |||
| 257 | 'a1:package_write_ipk_setscene', 'a1:package_qa_setscene'] | 258 | 'a1:package_write_ipk_setscene', 'a1:package_qa_setscene'] |
| 258 | self.assertEqual(set(tasks), set(expected)) | 259 | self.assertEqual(set(tasks), set(expected)) |
| 259 | 260 | ||
| 261 | self.shutdown(tempdir) | ||
| 262 | |||
| 260 | @unittest.skipIf(sys.version_info < (3, 5, 0), 'Python 3.5 or later required') | 263 | @unittest.skipIf(sys.version_info < (3, 5, 0), 'Python 3.5 or later required') |
| 261 | def test_hashserv_double(self): | 264 | def test_hashserv_double(self): |
| 262 | with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir: | 265 | with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir: |
| @@ -280,6 +283,7 @@ class RunQueueTests(unittest.TestCase): | |||
| 280 | 'a1:package_write_rpm_setscene', 'b1:package_write_ipk_setscene', 'a1:packagedata_setscene'] | 283 | 'a1:package_write_rpm_setscene', 'b1:package_write_ipk_setscene', 'a1:packagedata_setscene'] |
| 281 | self.assertEqual(set(tasks), set(expected)) | 284 | self.assertEqual(set(tasks), set(expected)) |
| 282 | 285 | ||
| 286 | self.shutdown(tempdir) | ||
| 283 | 287 | ||
| 284 | @unittest.skipIf(sys.version_info < (3, 5, 0), 'Python 3.5 or later required') | 288 | @unittest.skipIf(sys.version_info < (3, 5, 0), 'Python 3.5 or later required') |
| 285 | def test_hashserv_multiple_setscene(self): | 289 | def test_hashserv_multiple_setscene(self): |
| @@ -309,3 +313,11 @@ class RunQueueTests(unittest.TestCase): | |||
| 309 | for i in expected: | 313 | for i in expected: |
| 310 | self.assertEqual(tasks.count(i), 1, "%s not in task list once" % i) | 314 | self.assertEqual(tasks.count(i), 1, "%s not in task list once" % i) |
| 311 | 315 | ||
| 316 | self.shutdown(tempdir) | ||
| 317 | |||
| 318 | def shutdown(self, tempdir): | ||
| 319 | # Wait for the hashserve socket to disappear else we'll see races with the tempdir cleanup | ||
| 320 | while os.path.exists(tempdir + "/hashserve.sock"): | ||
| 321 | time.sleep(0.5) | ||
| 322 | |||
| 323 | |||
