summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/sdk/buildtools-cases/build.py
blob: c85c32496b3a024fea052dccb98bcbc77fc41f78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#
# Copyright OpenEmbedded Contributors
#
# SPDX-License-Identifier: MIT
#

import os, tempfile
import time
from oeqa.sdk.case import OESDKTestCase
from oeqa.utils.subprocesstweak import errors_have_output
errors_have_output()

class BuildTests(OESDKTestCase):
    """
    Verify that bitbake can build virtual/libc inside the buildtools.
    """
    def test_libc(self):
        with tempfile.TemporaryDirectory(prefix='bitbake-build-', dir=self.tc.sdk_dir) as testdir:
            corebase = self.td['COREBASE']

            self._run('. %s/oe-init-build-env %s' % (corebase, testdir))
            with open(os.path.join(testdir, 'conf', 'local.conf'), 'ta') as conf:
                conf.write('\n')
                conf.write('DL_DIR = "%s"\n' % self.td['DL_DIR'])

            try:
                self._run('. %s/oe-init-build-env %s && bitbake virtual/libc' % (corebase, testdir))
            finally:
                delay = 10
                while delay and (os.path.exists(testdir + "/bitbake.lock") or os.path.exists(testdir + "/cache/hashserv.db-wal")):
                    time.sleep(1)
                    delay = delay - 1