* [PATCH 1/2] oeqa/sdkext: Adds test cases for devtool extensible SDK @ 2016-08-17 22:30 Francisco Pedraza 2016-08-17 22:31 ` [PATCH 2/2] oeqa/selftest Adds eSDK test cases to devtool verification Francisco Pedraza 0 siblings, 1 reply; 4+ messages in thread From: Francisco Pedraza @ 2016-08-17 22:30 UTC (permalink / raw) To: openembedded-core; +Cc: Francisco Pedraza Adds test cases in order to increase devtool verification. The changes cover add, reset, build make, build cmake, extend autotools recipe creation, kernel module and node.js. Signed-off-by: Francisco Pedraza <francisco.j.pedraza.gonzalez@intel.com> --- meta/lib/oeqa/sdkext/devtool.py | 90 ++++++++++++++++++++-- .../oeqa/sdkext/files/myapp_cmake/CMakeLists.txt | 11 +++ meta/lib/oeqa/sdkext/files/myapp_cmake/myapp.c | 9 +++ 3 files changed, 103 insertions(+), 7 deletions(-) create mode 100644 meta/lib/oeqa/sdkext/files/myapp_cmake/CMakeLists.txt create mode 100644 meta/lib/oeqa/sdkext/files/myapp_cmake/myapp.c diff --git a/meta/lib/oeqa/sdkext/devtool.py b/meta/lib/oeqa/sdkext/devtool.py index c5bb310..5d955eb 100644 --- a/meta/lib/oeqa/sdkext/devtool.py +++ b/meta/lib/oeqa/sdkext/devtool.py @@ -1,32 +1,108 @@ import shutil - +import subprocess +import urllib.request 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) + self.myapp_cmake_src = os.path.join(self.tc.sdkextfilesdir, "myapp_cmake") + self.myapp_cmake_dst = os.path.join(self.tc.sdktestdir, "myapp_cmake") + shutil.copytree(self.myapp_cmake_src, self.myapp_cmake_dst) + + def _test_devtool_build(self, directory): + self._run('devtool add myapp %s' % directory) + try: + self._run('devtool build myapp') + except Exception as e: + print(e.output) + self._run('devtool reset myapp') + raise e + 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') + except Exception as e: + print(e.output) + self._run('devtool reset myapp') + raise e + self._run('devtool reset myapp') + 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') + + @testcase(1473) + @skipUnlessPassed('test_devtool_location') + def test_devtool_build_make(self): + self._test_devtool_build(self.myapp_dst) + + @testcase(1474) + @skipUnlessPassed('test_devtool_location') + def test_devtool_build_esdk_package(self): + self._test_devtool_build_package(self.myapp_dst) + @testcase(1479) @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') + def test_devtool_build_cmake(self): + self._test_devtool_build(self.myapp_cmake_dst) + + @testcase(1482) + @skipUnlessPassed('test_devtool_location') + def test_extend_autotools_recipe_creation(self): + req = 'https://github.com/rdfa/librdfa' + recipe = "bbexample" + self._run('devtool add %s %s' % (recipe, req) ) + try: + self._run('devtool build %s' % recipe) + except Exception as e: + print(e.output) + self._run('devtool reset %s' % recipe) + raise e + self._run('devtool reset %s' % recipe) + + @testcase(1484) + @skipUnlessPassed('test_devtool_location') + def test_devtool_kernelmodule(self): + docfile = 'git://github.com/Mange/rtl8192eu-linux-driver.git' + recipe = 'rtl-linux-driver' + self._run('devtool add %s %s' % (recipe, docfile) ) + try: + self._run('devtool build %s' % recipe) + except Exception as e: + print(e.output) + self._run('devtool reset %s' % recipe) + raise e + self._run('devtool reset %s' % recipe) + + @testcase(1478) + @skipUnlessPassed('test_devtool_location') + def test_recipes_for_nodejs(self): + package_nodejs = "npm://registry.npmjs.org;name=forever;version=0.15.1" + self._run('devtool add %s ' % package_nodejs) + try: + self._run('devtool build %s ' % package_nodejs) + except Exception as e: + print(e.output) + self._run('devtool reset %s' % package_nodejs) + raise e + self._run('devtool reset %s '% package_nodejs) + @classmethod def tearDownClass(self): shutil.rmtree(self.myapp_dst) + shutil.rmtree(self.myapp_cmake_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 0000000..19d773d --- /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 0000000..f0b63f0 --- /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; +} -- 2.5.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] oeqa/selftest Adds eSDK test cases to devtool verification. 2016-08-17 22:30 [PATCH 1/2] oeqa/sdkext: Adds test cases for devtool extensible SDK Francisco Pedraza @ 2016-08-17 22:31 ` Francisco Pedraza 2016-08-19 22:13 ` Richard Purdie 0 siblings, 1 reply; 4+ messages in thread From: Francisco Pedraza @ 2016-08-17 22:31 UTC (permalink / raw) To: openembedded-core; +Cc: Francisco Pedraza The covered functions are, install libraries headers, image generation binary feeds and sdk update devtool. Signed-off-by: Francisco Pedraza <francisco.j.pedraza.gonzalez@intel.com> --- meta/lib/oeqa/selftest/eSDK.py | 147 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 meta/lib/oeqa/selftest/eSDK.py diff --git a/meta/lib/oeqa/selftest/eSDK.py b/meta/lib/oeqa/selftest/eSDK.py new file mode 100644 index 0000000..76fe660 --- /dev/null +++ b/meta/lib/oeqa/selftest/eSDK.py @@ -0,0 +1,147 @@ +import unittest +import tempfile +import shutil +import os +import glob +import logging +import subprocess +import oeqa.utils.ftools as ftools +from oeqa.utils.decorators import testcase +from oeqa.selftest.base import oeSelfTest +from oeqa.utils.commands import runCmd, bitbake, get_bb_var +from oeqa.utils.httpserver import HTTPService + +class oeSDKExtSelfTest(oeSelfTest): + """ + # Bugzilla Test Plan: 6033 + # This code is planned to be part of the automation for eSDK containig + # Install libraries and headers, image generation binary feeds, Node.js Installation, Node.js test recipes + # and sdk update devtool. + """ + + @staticmethod + def get_esdk_environment(env_eSDK, tmpdir_eSDKQA): + # XXX: at this time use the first env need to investigate + # what environment load oe-selftest, i586, x86_64 + pattern = os.path.join(tmpdir_eSDKQA, 'environment-setup-*') + return glob.glob(pattern)[0] + + @staticmethod + def run_esdk_cmd(env_eSDK, tmpdir_eSDKQA, cmd, postconfig=None, **options): + if postconfig: + esdk_conf_file = os.path.join(tmpdir_eSDKQA, 'conf', 'local.conf') + with open(esdk_conf_file, 'a+') as f: + f.write(postconfig) + if not options: + options = {} + if not 'shell' in options: + options['shell'] = True + + runCmd("cd %s; . %s; %s" % (tmpdir_eSDKQA, env_eSDK, cmd), **options) + + @staticmethod + def generate_eSDK(image): + pn_task = '%s -c populate_sdk_ext' % image + bitbake(pn_task) + + @staticmethod + def get_eSDK_toolchain(image): + pn_task = '%s -c populate_sdk_ext' % image + + sdk_deploy = get_bb_var('SDK_DEPLOY', pn_task) + toolchain_name = get_bb_var('TOOLCHAINEXT_OUTPUTNAME', pn_task) + return os.path.join(sdk_deploy, toolchain_name + '.sh') + + + @classmethod + def setUpClass(cls): + # Start to serve sstate dir + sstate_dir = os.path.join(os.environ['BUILDDIR'], 'sstate-cache') + cls.http_service = HTTPService(sstate_dir) + cls.http_service.start() + + http_url = "127.0.0.1:%d" % cls.http_service.port + + image = 'core-image-minimal' + + cls.tmpdir_eSDKQA = tempfile.mkdtemp(prefix='eSDKQA') + oeSDKExtSelfTest.generate_eSDK(image) + + # Install eSDK + ext_sdk_path = oeSDKExtSelfTest.get_eSDK_toolchain(image) + runCmd("%s -y -d \"%s\"" % (ext_sdk_path, cls.tmpdir_eSDKQA)) + + cls.env_eSDK = oeSDKExtSelfTest.get_esdk_environment('', cls.tmpdir_eSDKQA) + + # Configure eSDK to use sstate mirror from poky + sstate_config=""" +SDK_LOCAL_CONF_WHITELIST = "SSTATE_MIRRORS" +SSTATE_MIRRORS = "file://.* http://%s/PATH" + """ % http_url + with open(os.path.join(cls.tmpdir_eSDKQA, 'conf', 'local.conf'), 'a+') as f: + f.write(sstate_config) + + # Common variables + cls.package_nodejs = "npm://registry.npmjs.org;name=forever;version=0.15.1" + + @classmethod + def tearDownClass(cls): + shutil.rmtree(cls.tmpdir_eSDKQA) + cls.http_service.stop() + + @testcase (1471) + def test_install_libraries_headers(self): + pn_sstate = 'bc' + bitbake(pn_sstate) + cmd = "devtool sdk-install %s " % pn_sstate + oeSDKExtSelfTest.run_esdk_cmd(self.env_eSDK, self.tmpdir_eSDKQA, cmd) + + @testcase(1472) + def test_image_generation_binary_feeds(self): + image = 'core-image-minimal' + cmd = "devtool build-image %s" % image + oeSDKExtSelfTest.run_esdk_cmd(self.env_eSDK, self.tmpdir_eSDKQA, cmd) + + + @testcase(1487) + def test_sdkupdate_devtool(self): + image = 'core-image-sato' + + tmpdir_publish_eSDK = tempfile.mkdtemp(prefix='publish_eSDK') + + http_service = HTTPService(tmpdir_publish_eSDK) + http_service.start() + http_url = "http://127.0.0.1:%d" % http_service.port + + sstate_config = """ +SDK_LOCAL_CONF_WHITELIST = "SSTATE_MIRRORS" +SSTATE_MIRRORS = "file://.* http://%s/PATH" +EXAMPLE_VAR = "qemux86" + """ %http_url + + with open (os.path.join(self.tmpdir_eSDKQA, 'conf', 'local.conf'), 'a+') as f: + f.write(sstate_config) + + try: + oeSDKExtSelfTest.generate_eSDK(image) + ext_sdk_path_sato = oeSDKExtSelfTest.get_eSDK_toolchain(image) + + cmd = "oe-publish-sdk %s %s" % (ext_sdk_path_sato, tmpdir_publish_eSDK) + subprocess.check_output(cmd, shell=True) + + cmd = 'devtool sdk-update %s' % http_url + oeSDKExtSelfTest.run_esdk_cmd(self.env_eSDK, tmpdir_publish_eSDK, cmd) + with open(os.path.join(self.tmpdir_eSDKQA, 'conf', 'local.conf')) as f: + for line in f: + if line.strip() == 'EXAMPLE_VAR = "qemux86"': + break + else: + self.fail("Test configuration missing.") + + finally: + http_service.stop() + shutil.rmtree(tmpdir_publish_eSDK) + self.remove_config(sstate_config) + +if __name__ == '__main__': + unittest.main() -- 2.5.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] oeqa/selftest Adds eSDK test cases to devtool verification. 2016-08-17 22:31 ` [PATCH 2/2] oeqa/selftest Adds eSDK test cases to devtool verification Francisco Pedraza @ 2016-08-19 22:13 ` Richard Purdie 2016-08-19 22:49 ` Richard Purdie 0 siblings, 1 reply; 4+ messages in thread From: Richard Purdie @ 2016-08-19 22:13 UTC (permalink / raw) To: Francisco Pedraza, openembedded-core On Wed, 2016-08-17 at 17:31 -0500, Francisco Pedraza wrote: > The covered functions are, install libraries headers, image > generation binary feeds and > sdk update devtool. > > Signed-off-by: Francisco Pedraza < > francisco.j.pedraza.gonzalez@intel.com> > --- > meta/lib/oeqa/selftest/eSDK.py | 147 > +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 147 insertions(+) > create mode 100644 meta/lib/oeqa/selftest/eSDK.py I do love the idea of this and having more tests but the kernel module ESDK test fails on ppc and mips: https://autobuilder.yoctoproject.org/main/builders/nightly-ppc/builds/911/steps/Running%20ESDK%20Sanity%20Tests/logs/stdio https://autobuilder.yoctoproject.org/main/builders/nightly-mips/builds/898 Cheers, Richard ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] oeqa/selftest Adds eSDK test cases to devtool verification. 2016-08-19 22:13 ` Richard Purdie @ 2016-08-19 22:49 ` Richard Purdie 0 siblings, 0 replies; 4+ messages in thread From: Richard Purdie @ 2016-08-19 22:49 UTC (permalink / raw) To: Francisco Pedraza, openembedded-core On Fri, 2016-08-19 at 23:13 +0100, Richard Purdie wrote: > On Wed, 2016-08-17 at 17:31 -0500, Francisco Pedraza wrote: > > The covered functions are, install libraries headers, image > > generation binary feeds and > > sdk update devtool. > > > > Signed-off-by: Francisco Pedraza < > > francisco.j.pedraza.gonzalez@intel.com> > > --- > > meta/lib/oeqa/selftest/eSDK.py | 147 > > +++++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 147 insertions(+) > > create mode 100644 meta/lib/oeqa/selftest/eSDK.py > > I do love the idea of this and having more tests but the kernel > module > ESDK test fails on ppc and mips: > > https://autobuilder.yoctoproject.org/main/builders/nightly-ppc/builds > /911/steps/Running%20ESDK%20Sanity%20Tests/logs/stdio > > https://autobuilder.yoctoproject.org/main/builders/nightly-mips/build > s/898 and: https://autobuilder.yoctoproject.org/main/builders/nightly-oe-selftest/builds/649/steps/Running%20oe-selftest/logs/stdio (sorry!) Cheers, Richard ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-08-19 22:50 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-08-17 22:30 [PATCH 1/2] oeqa/sdkext: Adds test cases for devtool extensible SDK Francisco Pedraza 2016-08-17 22:31 ` [PATCH 2/2] oeqa/selftest Adds eSDK test cases to devtool verification Francisco Pedraza 2016-08-19 22:13 ` Richard Purdie 2016-08-19 22:49 ` Richard Purdie
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox