1# 2# Copyright OpenEmbedded Contributors 3# 4# SPDX-License-Identifier: MIT 5# 6 7import os.path 8 9from oeqa.selftest.case import OESelftestTestCase 10from oeqa.utils.commands import bitbake, get_bb_vars 11 12class SDKTests(OESelftestTestCase): 13 14 def load_manifest(self, filename): 15 manifest = {} 16 with open(filename) as f: 17 for line in f: 18 name, arch, version = line.split(maxsplit=3) 19 manifest[name] = (version, arch) 20 return manifest 21 22 def test_sdk_manifests(self): 23 image = "core-image-minimal" 24 25 self.write_config(""" 26TOOLCHAIN_HOST_TASK:append = " nativesdk-selftest-hello" 27IMAGE_INSTALL:append = " selftest-hello" 28""") 29 30 bitbake(f"{image} -c populate_sdk") 31 vars = get_bb_vars(['SDK_DEPLOY', 'TOOLCHAIN_OUTPUTNAME'], image) 32 33 path = os.path.join(vars["SDK_DEPLOY"], vars["TOOLCHAIN_OUTPUTNAME"] + ".host.manifest") 34 self.assertNotEqual(os.path.getsize(path), 0, msg="Host manifest is empty") 35 self.assertIn("nativesdk-selftest-hello", self.load_manifest(path)) 36 37 path = os.path.join(vars["SDK_DEPLOY"], vars["TOOLCHAIN_OUTPUTNAME"] + ".target.manifest") 38 self.assertNotEqual(os.path.getsize(path), 0, msg="Target manifest is empty") 39 self.assertIn("selftest-hello", self.load_manifest(path)) 40