xref: /OK3568_Linux_fs/yocto/poky/meta/lib/oeqa/sdk/buildtools-cases/build.py (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1#
2# SPDX-License-Identifier: MIT
3#
4
5import os, tempfile
6import time
7from oeqa.sdk.case import OESDKTestCase
8from oeqa.utils.subprocesstweak import errors_have_output
9errors_have_output()
10
11class BuildTests(OESDKTestCase):
12    """
13    Verify that bitbake can build virtual/libc inside the buildtools.
14    """
15    def test_libc(self):
16        with tempfile.TemporaryDirectory(prefix='bitbake-build-', dir=self.tc.sdk_dir) as testdir:
17            corebase = self.td['COREBASE']
18
19            self._run('. %s/oe-init-build-env %s' % (corebase, testdir))
20            with open(os.path.join(testdir, 'conf', 'local.conf'), 'ta') as conf:
21                conf.write('\n')
22                conf.write('DL_DIR = "%s"\n' % self.td['DL_DIR'])
23
24            try:
25                self._run('. %s/oe-init-build-env %s && bitbake virtual/libc' % (corebase, testdir))
26            finally:
27                delay = 10
28                while delay and (os.path.exists(testdir + "/bitbake.lock") or os.path.exists(testdir + "/cache/hashserv.db-wal")):
29                    time.sleep(1)
30                    delay = delay - 1
31