Initial commit

This commit is contained in:
Your Name
2026-04-23 17:07:55 +08:00
commit b7e39e063b
16725 changed files with 1625565 additions and 0 deletions
@@ -0,0 +1,2 @@
These test cases are used by buildtools-tarball, and are not used by the testsdk
class.
@@ -0,0 +1,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
@@ -0,0 +1,31 @@
#
# Copyright OpenEmbedded Contributors
#
# SPDX-License-Identifier: MIT
#
import os.path
from oeqa.sdk.case import OESDKTestCase
class GccTests(OESDKTestCase):
def test_verify_specs(self):
"""
Verify that the compiler has been relocated successfully and isn't
looking in the hard-coded prefix.
"""
# Canonicalise the SDK root
sdk_base = os.path.realpath(self.tc.sdk_dir)
# Canonicalise the location of GCC
gcc_path = os.path.realpath(self._run("command -v gcc").strip())
# Skip the test if the GCC didn't come from the buildtools, as it only
# comes with buildtools-extended-tarball.
if os.path.commonprefix((sdk_base, gcc_path)) != sdk_base:
self.skipTest("Buildtools does not provide GCC")
# This is the prefix that GCC is build with, and should be replaced at
# installation time.
sdkpath = self.td.get("SDKPATH")
self.assertTrue(sdkpath)
for line in self._run('gcc -dumpspecs').splitlines():
self.assertNotIn(sdkpath, line)
@@ -0,0 +1,22 @@
#
# Copyright OpenEmbedded Contributors
#
# SPDX-License-Identifier: MIT
#
from oeqa.sdk.case import OESDKTestCase
from oeqa.utils.subprocesstweak import errors_have_output
errors_have_output()
class HTTPTests(OESDKTestCase):
"""
Verify that HTTPS certificates are working correctly, as this depends on
environment variables being set correctly.
"""
def test_wget(self):
self._run('env -i wget --debug --output-document /dev/null https://yoctoproject.org/connectivity.html')
def test_python(self):
# urlopen() returns a file-like object on success and throws an exception otherwise
self._run('python3 -c \'import urllib.request; urllib.request.urlopen("https://yoctoproject.org/connectivity.html")\'')
@@ -0,0 +1,24 @@
#
# Copyright OpenEmbedded Contributors
#
# SPDX-License-Identifier: MIT
#
import shutil
import os.path
from oeqa.sdk.case import OESDKTestCase
class SanityTests(OESDKTestCase):
def test_tools(self):
"""
Test that wget and tar come from the buildtools, not the host. This
verifies that the buildtools have installed correctly. We can't check
for gcc as that is only installed by buildtools-extended.
"""
for command in ("tar", "wget"):
# Canonicalise the SDK root
sdk_base = os.path.realpath(self.tc.sdk_dir)
# Canonicalise the location of this command
tool_path = os.path.realpath(self._run("command -v %s" % command).strip())
# Assert that the tool was found inside the SDK root
self.assertEquals(os.path.commonprefix((sdk_base, tool_path)), sdk_base)