summaryrefslogtreecommitdiff
path: root/meta/lib/oeqa/sdkext/cases/devtool.py
blob: f0abc95bc66921c4cd549b8c32b26093d314493c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# 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
from oeqa.core.decorator.data import skipIfNotDataVar

class DevtoolTest(OESDKExtTestCase):
    @classmethod
    def setUpClass(self):
        self.myapp_src = os.path.join(self.tc.esdk_files_dir, "myapp")
        self.myapp_dst = os.path.join(self.tc.sdk_dir, "myapp")
        shutil.copytree(self.myapp_src, self.myapp_dst)

        self.myapp_cmake_src = os.path.join(self.tc.esdk_files_dir, "myapp_cmake")
        self.myapp_cmake_dst = os.path.join(self.tc.sdk_dir, "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.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'])
    @skipIfNotDataVar('SDK_INCLUDE_TOOLCHAIN', '1', 'SDK does not include toolchain')
    def test_devtool_build_make(self):
        self._test_devtool_build(self.myapp_dst)
    
    @OETestID(1606)
    @OETestDepends(['test_devtool_location'])
    @skipIfNotDataVar('SDK_INCLUDE_TOOLCHAIN', '1', 'SDK does not include toolchain')
    def test_devtool_build_esdk_package(self):
        self._test_devtool_build_package(self.myapp_dst)

    @OETestID(1607)
    @OETestDepends(['test_devtool_location'])
    @skipIfNotDataVar('SDK_INCLUDE_TOOLCHAIN', '1', 'SDK does not include toolchain')
    def test_devtool_build_cmake(self):
        self._test_devtool_build(self.myapp_cmake_dst)
    
    @OETestID(1608)
    @OETestDepends(['test_devtool_location'])
    @skipIfNotDataVar('SDK_INCLUDE_TOOLCHAIN', '1', 'SDK does not include toolchain')
    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)

    @OETestID(1609)
    @OETestDepends(['test_devtool_location'])
    @skipIfNotDataVar('SDK_INCLUDE_TOOLCHAIN', '1', 'SDK does not include toolchain')
    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)
        except Exception as e:
            print(e.output)
            self._run('devtool reset %s' % recipe)
            raise e
        self._run('devtool reset %s' % recipe)

    @OETestID(1610)
    @OETestDepends(['test_devtool_location'])
    @skipIfNotDataVar('SDK_INCLUDE_TOOLCHAIN', '1', 'SDK does not include toolchain')
    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)
        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)