Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 1 | # Copyright (C) 2016 Intel Corporation |
| 2 | # Released under the MIT license (see COPYING.MIT) |
| 3 | |
| 4 | import shutil |
| 5 | import subprocess |
| 6 | |
| 7 | from oeqa.sdkext.case import OESDKExtTestCase |
| 8 | from oeqa.core.decorator.depends import OETestDepends |
| 9 | from oeqa.core.decorator.oeid import OETestID |
| 10 | |
| 11 | class DevtoolTest(OESDKExtTestCase): |
| 12 | @classmethod |
| 13 | def setUpClass(cls): |
| 14 | myapp_src = os.path.join(cls.tc.esdk_files_dir, "myapp") |
| 15 | cls.myapp_dst = os.path.join(cls.tc.sdk_dir, "myapp") |
| 16 | shutil.copytree(myapp_src, cls.myapp_dst) |
| 17 | |
| 18 | myapp_cmake_src = os.path.join(cls.tc.esdk_files_dir, "myapp_cmake") |
| 19 | cls.myapp_cmake_dst = os.path.join(cls.tc.sdk_dir, "myapp_cmake") |
| 20 | shutil.copytree(myapp_cmake_src, cls.myapp_cmake_dst) |
| 21 | |
| 22 | @classmethod |
| 23 | def tearDownClass(cls): |
| 24 | shutil.rmtree(cls.myapp_dst) |
| 25 | shutil.rmtree(cls.myapp_cmake_dst) |
| 26 | |
| 27 | def _test_devtool_build(self, directory): |
| 28 | self._run('devtool add myapp %s' % directory) |
| 29 | try: |
| 30 | self._run('devtool build myapp') |
| 31 | finally: |
| 32 | self._run('devtool reset myapp') |
| 33 | |
| 34 | def _test_devtool_build_package(self, directory): |
| 35 | self._run('devtool add myapp %s' % directory) |
| 36 | try: |
| 37 | self._run('devtool package myapp') |
| 38 | finally: |
| 39 | self._run('devtool reset myapp') |
| 40 | |
| 41 | def test_devtool_location(self): |
| 42 | output = self._run('which devtool') |
| 43 | self.assertEqual(output.startswith(self.tc.sdk_dir), True, \ |
| 44 | msg="Seems that devtool isn't the eSDK one: %s" % output) |
| 45 | |
| 46 | @OETestDepends(['test_devtool_location']) |
| 47 | def test_devtool_add_reset(self): |
| 48 | self._run('devtool add myapp %s' % self.myapp_dst) |
| 49 | self._run('devtool reset myapp') |
| 50 | |
| 51 | @OETestID(1605) |
| 52 | @OETestDepends(['test_devtool_location']) |
| 53 | def test_devtool_build_make(self): |
| 54 | self._test_devtool_build(self.myapp_dst) |
| 55 | |
| 56 | @OETestID(1606) |
| 57 | @OETestDepends(['test_devtool_location']) |
| 58 | def test_devtool_build_esdk_package(self): |
| 59 | self._test_devtool_build_package(self.myapp_dst) |
| 60 | |
| 61 | @OETestID(1607) |
| 62 | @OETestDepends(['test_devtool_location']) |
| 63 | def test_devtool_build_cmake(self): |
| 64 | self._test_devtool_build(self.myapp_cmake_dst) |
| 65 | |
| 66 | @OETestID(1608) |
| 67 | @OETestDepends(['test_devtool_location']) |
| 68 | def test_extend_autotools_recipe_creation(self): |
| 69 | req = 'https://github.com/rdfa/librdfa' |
| 70 | recipe = "librdfa" |
| 71 | self._run('devtool sdk-install libxml2') |
| 72 | self._run('devtool add %s %s' % (recipe, req) ) |
| 73 | try: |
| 74 | self._run('devtool build %s' % recipe) |
| 75 | finally: |
| 76 | self._run('devtool reset %s' % recipe) |
| 77 | |
| 78 | @OETestID(1609) |
| 79 | @OETestDepends(['test_devtool_location']) |
| 80 | def test_devtool_kernelmodule(self): |
| 81 | docfile = 'https://github.com/umlaeute/v4l2loopback.git' |
| 82 | recipe = 'v4l2loopback-driver' |
| 83 | self._run('devtool add %s %s' % (recipe, docfile) ) |
| 84 | try: |
| 85 | self._run('devtool build %s' % recipe) |
| 86 | finally: |
| 87 | self._run('devtool reset %s' % recipe) |
| 88 | |
| 89 | @OETestID(1610) |
| 90 | @OETestDepends(['test_devtool_location']) |
| 91 | def test_recipes_for_nodejs(self): |
| 92 | package_nodejs = "npm://registry.npmjs.org;name=winston;version=2.2.0" |
| 93 | self._run('devtool add %s ' % package_nodejs) |
| 94 | try: |
| 95 | self._run('devtool build %s ' % package_nodejs) |
| 96 | finally: |
| 97 | self._run('devtool reset %s '% package_nodejs) |