From 477321d0780df177c1582db119c2bb6795912fc6 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 2 Aug 2019 15:32:27 +0100 Subject: tests/runqueue: Add hashserv+runqueue test Add a test which tests the runqueue adaptations for hash equivalency. Signed-off-by: Richard Purdie --- lib/bb/siggen.py | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'lib/bb/siggen.py') diff --git a/lib/bb/siggen.py b/lib/bb/siggen.py index 912c92c8b..b50355930 100644 --- a/lib/bb/siggen.py +++ b/lib/bb/siggen.py @@ -12,6 +12,7 @@ import bb.data import difflib import simplediff from bb.checksum import FileChecksumCache +from bb import runqueue logger = logging.getLogger('BitBake.SigGen') @@ -473,10 +474,12 @@ class SignatureGeneratorUniHashMixIn(object): locs = {'path': path, 'sigfile': sigfile, 'task': task, 'd': d} - (module, method) = self.method.rsplit('.', 1) - locs['method'] = getattr(importlib.import_module(module), method) - - outhash = bb.utils.better_eval('method(path, sigfile, task, d)', locs) + if "." in self.method: + (module, method) = self.method.rsplit('.', 1) + locs['method'] = getattr(importlib.import_module(module), method) + outhash = bb.utils.better_eval('method(path, sigfile, task, d)', locs) + else: + outhash = bb.utils.better_eval(self.method + '(path, sigfile, task, d)', locs) try: url = '%s/v1/equivalent' % self.server @@ -527,6 +530,18 @@ class SignatureGeneratorUniHashMixIn(object): except OSError: pass + +# +# Dummy class used for bitbake-selftest +# +class SignatureGeneratorTestEquivHash(SignatureGeneratorUniHashMixIn, SignatureGeneratorBasicHash): + name = "TestEquivHash" + def init_rundepcheck(self, data): + super().init_rundepcheck(data) + self.server = "http://" + data.getVar('BB_HASHSERVE') + self.method = "sstate_output_hash" + + def dump_this_task(outfile, d): import bb.parse fn = d.getVar("BB_FILENAME") -- cgit 1.2.3-korg