summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/hashserv/tests.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-07-24 09:13:55 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-08-06 11:21:31 +0100
commitca04aaf7b51e3ee2bb04da970d5f20f2c9982cb8 (patch)
treeee5fe5d5e780cd965bbe7f9a0d25d91d280b1834 /bitbake/lib/hashserv/tests.py
parentd9aafb85072bef3b5baa54408969d54a8425a111 (diff)
downloadpoky-ca04aaf7b51e3ee2bb04da970d5f20f2c9982cb8.tar.gz
bitbake: cooker/hashserv: Allow autostarting of a local hash server using BB_HASHSERVE
Its useful, particularly in the local developer model of usage, for bitbake to start and stop a hash equivalence server on local port, rather than relying on one being started by the user before the build. The new BB_HASHSERVE variable supports this. The database handling is moved internally into the hashserv code so that different threads/processes can be used for the server without errors. (Bitbake rev: a4fa8f1bd88995ae60e10430316fbed63d478587) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/hashserv/tests.py')
-rw-r--r--bitbake/lib/hashserv/tests.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/bitbake/lib/hashserv/tests.py b/bitbake/lib/hashserv/tests.py
index 8300a25599..15f4a52ee9 100644
--- a/bitbake/lib/hashserv/tests.py
+++ b/bitbake/lib/hashserv/tests.py
@@ -11,14 +11,15 @@ import sqlite3
11import hashlib 11import hashlib
12import urllib.request 12import urllib.request
13import json 13import json
14import tempfile
14from . import create_server 15from . import create_server
15 16
16class TestHashEquivalenceServer(unittest.TestCase): 17class TestHashEquivalenceServer(unittest.TestCase):
17 def setUp(self): 18 def setUp(self):
18 # Start an in memory hash equivalence server in the background bound to 19 # Start a hash equivalence server in the background bound to
19 # an ephemeral port 20 # an ephemeral port
20 db = sqlite3.connect(':memory:', check_same_thread=False) 21 self.dbfile = tempfile.NamedTemporaryFile(prefix="bb-hashserv-db-")
21 self.server = create_server(('localhost', 0), db) 22 self.server = create_server(('localhost', 0), self.dbfile.name)
22 self.server_addr = 'http://localhost:%d' % self.server.socket.getsockname()[1] 23 self.server_addr = 'http://localhost:%d' % self.server.socket.getsockname()[1]
23 self.server_thread = threading.Thread(target=self.server.serve_forever) 24 self.server_thread = threading.Thread(target=self.server.serve_forever)
24 self.server_thread.start() 25 self.server_thread.start()