blob: d322f86c73e08b929aedeb9a7bac9e2ef4bb3de1 [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001# Copyright (C) 2016 Intel Corporation
2# Released under the MIT license (see COPYING.MIT)
3
Brad Bishopd7bf8c12018-02-25 22:55:05 -05004import os
Brad Bishop6e60e8b2018-02-01 10:27:11 -05005import shutil
6import subprocess
7
8from oeqa.sdkext.case import OESDKExtTestCase
Brad Bishop6e60e8b2018-02-01 10:27:11 -05009from oeqa.core.decorator.oeid import OETestID
Brad Bishopd7bf8c12018-02-25 22:55:05 -050010from oeqa.utils.httpserver import HTTPService
Brad Bishop6e60e8b2018-02-01 10:27:11 -050011
Brad Bishop19323692019-04-05 15:28:33 -040012from oeqa.utils.subprocesstweak import errors_have_output
13errors_have_output()
14
Brad Bishop6e60e8b2018-02-01 10:27:11 -050015class DevtoolTest(OESDKExtTestCase):
16 @classmethod
17 def setUpClass(cls):
18 myapp_src = os.path.join(cls.tc.esdk_files_dir, "myapp")
19 cls.myapp_dst = os.path.join(cls.tc.sdk_dir, "myapp")
20 shutil.copytree(myapp_src, cls.myapp_dst)
21
22 myapp_cmake_src = os.path.join(cls.tc.esdk_files_dir, "myapp_cmake")
23 cls.myapp_cmake_dst = os.path.join(cls.tc.sdk_dir, "myapp_cmake")
24 shutil.copytree(myapp_cmake_src, cls.myapp_cmake_dst)
25
26 @classmethod
27 def tearDownClass(cls):
28 shutil.rmtree(cls.myapp_dst)
29 shutil.rmtree(cls.myapp_cmake_dst)
30
31 def _test_devtool_build(self, directory):
32 self._run('devtool add myapp %s' % directory)
33 try:
34 self._run('devtool build myapp')
35 finally:
36 self._run('devtool reset myapp')
37
38 def _test_devtool_build_package(self, directory):
39 self._run('devtool add myapp %s' % directory)
40 try:
41 self._run('devtool package myapp')
42 finally:
43 self._run('devtool reset myapp')
44
45 def test_devtool_location(self):
46 output = self._run('which devtool')
47 self.assertEqual(output.startswith(self.tc.sdk_dir), True, \
48 msg="Seems that devtool isn't the eSDK one: %s" % output)
49
Brad Bishop6e60e8b2018-02-01 10:27:11 -050050 def test_devtool_add_reset(self):
51 self._run('devtool add myapp %s' % self.myapp_dst)
52 self._run('devtool reset myapp')
53
54 @OETestID(1605)
Brad Bishop6e60e8b2018-02-01 10:27:11 -050055 def test_devtool_build_make(self):
56 self._test_devtool_build(self.myapp_dst)
57
58 @OETestID(1606)
Brad Bishop6e60e8b2018-02-01 10:27:11 -050059 def test_devtool_build_esdk_package(self):
60 self._test_devtool_build_package(self.myapp_dst)
61
62 @OETestID(1607)
Brad Bishop6e60e8b2018-02-01 10:27:11 -050063 def test_devtool_build_cmake(self):
64 self._test_devtool_build(self.myapp_cmake_dst)
65
66 @OETestID(1608)
Brad Bishop6e60e8b2018-02-01 10:27:11 -050067 def test_extend_autotools_recipe_creation(self):
68 req = 'https://github.com/rdfa/librdfa'
69 recipe = "librdfa"
70 self._run('devtool sdk-install libxml2')
71 self._run('devtool add %s %s' % (recipe, req) )
72 try:
73 self._run('devtool build %s' % recipe)
74 finally:
75 self._run('devtool reset %s' % recipe)
76
77 @OETestID(1609)
Brad Bishop6e60e8b2018-02-01 10:27:11 -050078 def test_devtool_kernelmodule(self):
79 docfile = 'https://github.com/umlaeute/v4l2loopback.git'
80 recipe = 'v4l2loopback-driver'
81 self._run('devtool add %s %s' % (recipe, docfile) )
82 try:
83 self._run('devtool build %s' % recipe)
84 finally:
85 self._run('devtool reset %s' % recipe)
86
87 @OETestID(1610)
Brad Bishop6e60e8b2018-02-01 10:27:11 -050088 def test_recipes_for_nodejs(self):
89 package_nodejs = "npm://registry.npmjs.org;name=winston;version=2.2.0"
90 self._run('devtool add %s ' % package_nodejs)
91 try:
92 self._run('devtool build %s ' % package_nodejs)
93 finally:
94 self._run('devtool reset %s '% package_nodejs)
Brad Bishopd7bf8c12018-02-25 22:55:05 -050095
96class SdkUpdateTest(OESDKExtTestCase):
97 @classmethod
98 def setUpClass(self):
99 self.publish_dir = os.path.join(self.tc.sdk_dir, 'esdk_publish')
100 if os.path.exists(self.publish_dir):
101 shutil.rmtree(self.publish_dir)
102 os.mkdir(self.publish_dir)
103
104 base_tcname = "%s/%s" % (self.td.get("SDK_DEPLOY", ''),
105 self.td.get("TOOLCHAINEXT_OUTPUTNAME", ''))
106 tcname_new = "%s-new.sh" % base_tcname
107 if not os.path.exists(tcname_new):
108 tcname_new = "%s.sh" % base_tcname
109
110 cmd = 'oe-publish-sdk %s %s' % (tcname_new, self.publish_dir)
111 subprocess.check_output(cmd, shell=True)
112
113 self.http_service = HTTPService(self.publish_dir)
114 self.http_service.start()
115
116 self.http_url = "http://127.0.0.1:%d" % self.http_service.port
117
118 def test_sdk_update_http(self):
119 output = self._run("devtool sdk-update \"%s\"" % self.http_url)
120
121 @classmethod
122 def tearDownClass(self):
123 self.http_service.stop()
124 shutil.rmtree(self.publish_dir)