diff options
Diffstat (limited to 'meta/lib/oeqa/sdkext')
| -rw-r--r-- | meta/lib/oeqa/sdkext/__init__.py | 3 | ||||
| -rw-r--r-- | meta/lib/oeqa/sdkext/case.py | 21 | ||||
| -rw-r--r-- | meta/lib/oeqa/sdkext/cases/devtool.py | 97 | ||||
| -rw-r--r-- | meta/lib/oeqa/sdkext/cases/sdk_update.py (renamed from meta/lib/oeqa/sdkext/sdk_update.py) | 17 | ||||
| -rw-r--r-- | meta/lib/oeqa/sdkext/context.py | 29 | ||||
| -rw-r--r-- | meta/lib/oeqa/sdkext/devtool.py | 32 | ||||
| -rw-r--r-- | meta/lib/oeqa/sdkext/files/myapp_cmake/CMakeLists.txt | 11 | ||||
| -rw-r--r-- | meta/lib/oeqa/sdkext/files/myapp_cmake/myapp.c | 9 |
8 files changed, 177 insertions, 42 deletions
diff --git a/meta/lib/oeqa/sdkext/__init__.py b/meta/lib/oeqa/sdkext/__init__.py index 4cf3fa76b6..e69de29bb2 100644 --- a/meta/lib/oeqa/sdkext/__init__.py +++ b/meta/lib/oeqa/sdkext/__init__.py @@ -1,3 +0,0 @@ -# Enable other layers to have tests in the same named directory -from pkgutil import extend_path -__path__ = extend_path(__path__, __name__) diff --git a/meta/lib/oeqa/sdkext/case.py b/meta/lib/oeqa/sdkext/case.py new file mode 100644 index 0000000000..21b718831c --- /dev/null +++ b/meta/lib/oeqa/sdkext/case.py @@ -0,0 +1,21 @@ +# Copyright (C) 2016 Intel Corporation +# Released under the MIT license (see COPYING.MIT) + +import os +import subprocess + +from oeqa.utils import avoid_paths_in_environ +from oeqa.sdk.case import OESDKTestCase + +class OESDKExtTestCase(OESDKTestCase): + def _run(self, cmd): + # extensible sdk shows a warning if found bitbake in the path + # because can cause contamination, i.e. use devtool from + # poky/scripts instead of eSDK one. + env = os.environ.copy() + paths_to_avoid = ['bitbake/bin', 'poky/scripts'] + env['PATH'] = avoid_paths_in_environ(paths_to_avoid) + + return subprocess.check_output(". %s > /dev/null;"\ + " %s;" % (self.tc.sdk_env, cmd), stderr=subprocess.STDOUT, + shell=True, env=env, universal_newlines=True) diff --git a/meta/lib/oeqa/sdkext/cases/devtool.py b/meta/lib/oeqa/sdkext/cases/devtool.py new file mode 100644 index 0000000000..a01bc0bfe2 --- /dev/null +++ b/meta/lib/oeqa/sdkext/cases/devtool.py @@ -0,0 +1,97 @@ +# Copyright (C) 2016 Intel Corporation +# Released under the MIT license (see COPYING.MIT) + +import shutil +import subprocess + +from oeqa.sdkext.case import OESDKExtTestCase +from oeqa.core.decorator.depends import OETestDepends +from oeqa.core.decorator.oeid import OETestID + +class DevtoolTest(OESDKExtTestCase): + @classmethod + def setUpClass(cls): + myapp_src = os.path.join(cls.tc.esdk_files_dir, "myapp") + cls.myapp_dst = os.path.join(cls.tc.sdk_dir, "myapp") + shutil.copytree(myapp_src, cls.myapp_dst) + + myapp_cmake_src = os.path.join(cls.tc.esdk_files_dir, "myapp_cmake") + cls.myapp_cmake_dst = os.path.join(cls.tc.sdk_dir, "myapp_cmake") + shutil.copytree(myapp_cmake_src, cls.myapp_cmake_dst) + + @classmethod + def tearDownClass(cls): + shutil.rmtree(cls.myapp_dst) + shutil.rmtree(cls.myapp_cmake_dst) + + def _test_devtool_build(self, directory): + self._run('devtool add myapp %s' % directory) + try: + self._run('devtool build myapp') + finally: + self._run('devtool reset myapp') + + def _test_devtool_build_package(self, directory): + self._run('devtool add myapp %s' % directory) + try: + self._run('devtool package myapp') + finally: + self._run('devtool reset myapp') + + def test_devtool_location(self): + output = self._run('which devtool') + self.assertEqual(output.startswith(self.tc.sdk_dir), True, \ + msg="Seems that devtool isn't the eSDK one: %s" % output) + + @OETestDepends(['test_devtool_location']) + def test_devtool_add_reset(self): + self._run('devtool add myapp %s' % self.myapp_dst) + self._run('devtool reset myapp') + + @OETestID(1605) + @OETestDepends(['test_devtool_location']) + def test_devtool_build_make(self): + self._test_devtool_build(self.myapp_dst) + + @OETestID(1606) + @OETestDepends(['test_devtool_location']) + def test_devtool_build_esdk_package(self): + self._test_devtool_build_package(self.myapp_dst) + + @OETestID(1607) + @OETestDepends(['test_devtool_location']) + def test_devtool_build_cmake(self): + self._test_devtool_build(self.myapp_cmake_dst) + + @OETestID(1608) + @OETestDepends(['test_devtool_location']) + def test_extend_autotools_recipe_creation(self): + req = 'https://github.com/rdfa/librdfa' + recipe = "librdfa" + self._run('devtool sdk-install libxml2') + self._run('devtool add %s %s' % (recipe, req) ) + try: + self._run('devtool build %s' % recipe) + finally: + self._run('devtool reset %s' % recipe) + + @OETestID(1609) + @OETestDepends(['test_devtool_location']) + def test_devtool_kernelmodule(self): + docfile = 'https://github.com/umlaeute/v4l2loopback.git' + recipe = 'v4l2loopback-driver' + self._run('devtool add %s %s' % (recipe, docfile) ) + try: + self._run('devtool build %s' % recipe) + finally: + self._run('devtool reset %s' % recipe) + + @OETestID(1610) + @OETestDepends(['test_devtool_location']) + def test_recipes_for_nodejs(self): + package_nodejs = "npm://registry.npmjs.org;name=winston;version=2.2.0" + self._run('devtool add %s ' % package_nodejs) + try: + self._run('devtool build %s ' % package_nodejs) + finally: + self._run('devtool reset %s '% package_nodejs) diff --git a/meta/lib/oeqa/sdkext/sdk_update.py b/meta/lib/oeqa/sdkext/cases/sdk_update.py index 2ade839c05..2f8598bbe5 100644 --- a/meta/lib/oeqa/sdkext/sdk_update.py +++ b/meta/lib/oeqa/sdkext/cases/sdk_update.py @@ -1,23 +1,26 @@ +# Copyright (C) 2016 Intel Corporation +# Released under the MIT license (see COPYING.MIT) + import os import shutil import subprocess -from oeqa.oetest import oeSDKExtTest +from oeqa.sdkext.case import OESDKExtTestCase from oeqa.utils.httpserver import HTTPService -class SdkUpdateTest(oeSDKExtTest): - +class SdkUpdateTest(OESDKExtTestCase): @classmethod def setUpClass(self): - self.publish_dir = os.path.join(self.tc.sdktestdir, 'esdk_publish') + self.publish_dir = os.path.join(self.tc.sdk_dir, 'esdk_publish') if os.path.exists(self.publish_dir): shutil.rmtree(self.publish_dir) os.mkdir(self.publish_dir) - tcname_new = self.tc.d.expand( - "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}-new.sh") + base_tcname = "%s/%s" % (self.td.get("SDK_DEPLOY", ''), + self.td.get("TOOLCHAINEXT_OUTPUTNAME", '')) + tcname_new = "%s-new.sh" % base_tcname if not os.path.exists(tcname_new): - tcname_new = self.tc.tcname + tcname_new = "%s.sh" % base_tcname cmd = 'oe-publish-sdk %s %s' % (tcname_new, self.publish_dir) subprocess.check_output(cmd, shell=True) diff --git a/meta/lib/oeqa/sdkext/context.py b/meta/lib/oeqa/sdkext/context.py new file mode 100644 index 0000000000..65da4c6e1b --- /dev/null +++ b/meta/lib/oeqa/sdkext/context.py @@ -0,0 +1,29 @@ +# Copyright (C) 2016 Intel Corporation +# Released under the MIT license (see COPYING.MIT) + +import os +from oeqa.sdk.context import OESDKTestContext, OESDKTestContextExecutor + +class OESDKExtTestContext(OESDKTestContext): + esdk_files_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "files") + + # FIXME - We really need to do better mapping of names here, this at + # least allows some tests to run + def hasHostPackage(self, pkg): + # We force a toolchain to be installed into the eSDK even if its minimal + if pkg.startswith("packagegroup-cross-canadian-"): + return True + return self._hasPackage(self.host_pkg_manifest, pkg) + +class OESDKExtTestContextExecutor(OESDKTestContextExecutor): + _context_class = OESDKExtTestContext + + name = 'esdk' + help = 'esdk test component' + description = 'executes esdk tests' + + default_cases = OESDKTestContextExecutor.default_cases + \ + [os.path.join(os.path.abspath(os.path.dirname(__file__)), 'cases')] + default_test_data = None + +_executor_class = OESDKExtTestContextExecutor diff --git a/meta/lib/oeqa/sdkext/devtool.py b/meta/lib/oeqa/sdkext/devtool.py deleted file mode 100644 index c5bb3102a6..0000000000 --- a/meta/lib/oeqa/sdkext/devtool.py +++ /dev/null @@ -1,32 +0,0 @@ -import shutil - -from oeqa.oetest import oeSDKExtTest -from oeqa.utils.decorators import * - -class DevtoolTest(oeSDKExtTest): - - @classmethod - def setUpClass(self): - self.myapp_src = os.path.join(self.tc.sdkextfilesdir, "myapp") - self.myapp_dst = os.path.join(self.tc.sdktestdir, "myapp") - shutil.copytree(self.myapp_src, self.myapp_dst) - - def test_devtool_location(self): - output = self._run('which devtool') - self.assertEqual(output.startswith(self.tc.sdktestdir), True, \ - msg="Seems that devtool isn't the eSDK one: %s" % output) - - @skipUnlessPassed('test_devtool_location') - def test_devtool_add_reset(self): - self._run('devtool add myapp %s' % self.myapp_dst) - self._run('devtool reset myapp') - - @skipUnlessPassed('test_devtool_location') - def test_devtool_build(self): - self._run('devtool add myapp %s' % self.myapp_dst) - self._run('devtool build myapp') - self._run('devtool reset myapp') - - @classmethod - def tearDownClass(self): - shutil.rmtree(self.myapp_dst) diff --git a/meta/lib/oeqa/sdkext/files/myapp_cmake/CMakeLists.txt b/meta/lib/oeqa/sdkext/files/myapp_cmake/CMakeLists.txt new file mode 100644 index 0000000000..19d773dd63 --- /dev/null +++ b/meta/lib/oeqa/sdkext/files/myapp_cmake/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required (VERSION 2.6) +project (myapp) +# The version number. +set (myapp_VERSION_MAJOR 1) +set (myapp_VERSION_MINOR 0) + +# add the executable +add_executable (myapp myapp.c) + +install(TARGETS myapp + RUNTIME DESTINATION bin) diff --git a/meta/lib/oeqa/sdkext/files/myapp_cmake/myapp.c b/meta/lib/oeqa/sdkext/files/myapp_cmake/myapp.c new file mode 100644 index 0000000000..f0b63f03f3 --- /dev/null +++ b/meta/lib/oeqa/sdkext/files/myapp_cmake/myapp.c @@ -0,0 +1,9 @@ +#include <stdio.h> + +int +main(int argc, char *argv[]) +{ + printf("Hello world\n"); + + return 0; +} |
