diff options
Diffstat (limited to 'meta/classes/testsdk.bbclass')
| -rw-r--r-- | meta/classes/testsdk.bbclass | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/meta/classes/testsdk.bbclass b/meta/classes/testsdk.bbclass index 104c7a15f4..06e7a77398 100644 --- a/meta/classes/testsdk.bbclass +++ b/meta/classes/testsdk.bbclass | |||
| @@ -13,7 +13,8 @@ def testsdk_main(d): | |||
| 13 | import oeqa.sdk | 13 | import oeqa.sdk |
| 14 | import time | 14 | import time |
| 15 | import subprocess | 15 | import subprocess |
| 16 | from oeqa.oetest import loadTests, runTests, get_test_suites, get_tests_list | 16 | from oeqa.oetest import loadTests, runTests, \ |
| 17 | get_test_suites, get_tests_list, SDKTestContext | ||
| 17 | 18 | ||
| 18 | pn = d.getVar("PN", True) | 19 | pn = d.getVar("PN", True) |
| 19 | bb.utils.mkdirhier(d.getVar("TEST_LOG_DIR", True)) | 20 | bb.utils.mkdirhier(d.getVar("TEST_LOG_DIR", True)) |
| @@ -28,29 +29,6 @@ def testsdk_main(d): | |||
| 28 | if not os.path.exists(tcname): | 29 | if not os.path.exists(tcname): |
| 29 | bb.fatal("The toolchain is not built. Build it before running the tests: 'bitbake <image> -c populate_sdk' .") | 30 | bb.fatal("The toolchain is not built. Build it before running the tests: 'bitbake <image> -c populate_sdk' .") |
| 30 | 31 | ||
| 31 | class TestContext(object): | ||
| 32 | def __init__(self): | ||
| 33 | self.d = d | ||
| 34 | self.testslist = testslist | ||
| 35 | self.testsrequired = testsrequired | ||
| 36 | self.filesdir = os.path.join(os.path.dirname(os.path.abspath(oeqa.runtime.__file__)),"files") | ||
| 37 | self.sdktestdir = sdktestdir | ||
| 38 | self.sdkenv = sdkenv | ||
| 39 | self.imagefeatures = d.getVar("IMAGE_FEATURES", True).split() | ||
| 40 | self.distrofeatures = d.getVar("DISTRO_FEATURES", True).split() | ||
| 41 | manifest = d.getVar("SDK_TARGET_MANIFEST", True) | ||
| 42 | try: | ||
| 43 | with open(manifest) as f: | ||
| 44 | self.pkgmanifest = f.read() | ||
| 45 | except IOError as e: | ||
| 46 | bb.fatal("No package manifest file found. Did you build the sdk image?\n%s" % e) | ||
| 47 | hostmanifest = d.getVar("SDK_HOST_MANIFEST", True) | ||
| 48 | try: | ||
| 49 | with open(hostmanifest) as f: | ||
| 50 | self.hostpkgmanifest = f.read() | ||
| 51 | except IOError as e: | ||
| 52 | bb.fatal("No host package manifest file found. Did you build the sdk image?\n%s" % e) | ||
| 53 | |||
| 54 | sdktestdir = d.expand("${WORKDIR}/testimage-sdk/") | 32 | sdktestdir = d.expand("${WORKDIR}/testimage-sdk/") |
| 55 | bb.utils.remove(sdktestdir, True) | 33 | bb.utils.remove(sdktestdir, True) |
| 56 | bb.utils.mkdirhier(sdktestdir) | 34 | bb.utils.mkdirhier(sdktestdir) |
| @@ -63,8 +41,7 @@ def testsdk_main(d): | |||
| 63 | targets = glob.glob(d.expand(sdktestdir + "/tc/environment-setup-*")) | 41 | targets = glob.glob(d.expand(sdktestdir + "/tc/environment-setup-*")) |
| 64 | for sdkenv in targets: | 42 | for sdkenv in targets: |
| 65 | bb.plain("Testing %s" % sdkenv) | 43 | bb.plain("Testing %s" % sdkenv) |
| 66 | # test context | 44 | tc = SDKTestContext(d, testslist, testsrequired, sdktestdir, sdkenv) |
| 67 | tc = TestContext() | ||
| 68 | 45 | ||
| 69 | # this is a dummy load of tests | 46 | # this is a dummy load of tests |
| 70 | # we are doing that to find compile errors in the tests themselves | 47 | # we are doing that to find compile errors in the tests themselves |
