summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2017-03-01 12:21:34 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-01 23:27:11 +0000
commit88c1fb2f0c52a05e7314b8790e6f72c66c4de5ef (patch)
treeaf744b7f90b2c22e9fbdf45efbc15b1aba781fb1 /meta/lib
parent726832895de0e8d98fea8dde422e46b249a7bcc9 (diff)
downloadpoky-88c1fb2f0c52a05e7314b8790e6f72c66c4de5ef.tar.gz
oeqa/sdkext/devtool: use finally instead of repeating cleanup
Use the finally: block to always to cleanup. Now that the test harness in testsdk.bbclass has monkey-patched CalledProcessException to display the output we don't need to do that in the test case. (From OE-Core rev: 9f0f6326083ee76b72b431fbfcbe12c1ab2793b2) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/sdkext/cases/devtool.py35
1 files changed, 10 insertions, 25 deletions
diff --git a/meta/lib/oeqa/sdkext/cases/devtool.py b/meta/lib/oeqa/sdkext/cases/devtool.py
index ffaa2f00a5..63431aaa95 100644
--- a/meta/lib/oeqa/sdkext/cases/devtool.py
+++ b/meta/lib/oeqa/sdkext/cases/devtool.py
@@ -29,38 +29,32 @@ class DevtoolTest(OESDKExtTestCase):
29 self._run('devtool add myapp %s' % directory) 29 self._run('devtool add myapp %s' % directory)
30 try: 30 try:
31 self._run('devtool build myapp') 31 self._run('devtool build myapp')
32 except Exception as e: 32 finally:
33 print(e.output)
34 self._run('devtool reset myapp') 33 self._run('devtool reset myapp')
35 raise e
36 self._run('devtool reset myapp')
37 34
38 def _test_devtool_build_package(self, directory): 35 def _test_devtool_build_package(self, directory):
39 self._run('devtool add myapp %s' % directory) 36 self._run('devtool add myapp %s' % directory)
40 try: 37 try:
41 self._run('devtool package myapp') 38 self._run('devtool package myapp')
42 except Exception as e: 39 finally:
43 print(e.output)
44 self._run('devtool reset myapp') 40 self._run('devtool reset myapp')
45 raise e
46 self._run('devtool reset myapp')
47 41
48 def test_devtool_location(self): 42 def test_devtool_location(self):
49 output = self._run('which devtool') 43 output = self._run('which devtool')
50 self.assertEqual(output.startswith(self.tc.sdk_dir), True, \ 44 self.assertEqual(output.startswith(self.tc.sdk_dir), True, \
51 msg="Seems that devtool isn't the eSDK one: %s" % output) 45 msg="Seems that devtool isn't the eSDK one: %s" % output)
52 46
53 @OETestDepends(['test_devtool_location']) 47 @OETestDepends(['test_devtool_location'])
54 def test_devtool_add_reset(self): 48 def test_devtool_add_reset(self):
55 self._run('devtool add myapp %s' % self.myapp_dst) 49 self._run('devtool add myapp %s' % self.myapp_dst)
56 self._run('devtool reset myapp') 50 self._run('devtool reset myapp')
57 51
58 @OETestID(1605) 52 @OETestID(1605)
59 @OETestDepends(['test_devtool_location']) 53 @OETestDepends(['test_devtool_location'])
60 @skipIfNotDataVar('SDK_INCLUDE_TOOLCHAIN', '1', 'SDK does not include toolchain') 54 @skipIfNotDataVar('SDK_INCLUDE_TOOLCHAIN', '1', 'SDK does not include toolchain')
61 def test_devtool_build_make(self): 55 def test_devtool_build_make(self):
62 self._test_devtool_build(self.myapp_dst) 56 self._test_devtool_build(self.myapp_dst)
63 57
64 @OETestID(1606) 58 @OETestID(1606)
65 @OETestDepends(['test_devtool_location']) 59 @OETestDepends(['test_devtool_location'])
66 @skipIfNotDataVar('SDK_INCLUDE_TOOLCHAIN', '1', 'SDK does not include toolchain') 60 @skipIfNotDataVar('SDK_INCLUDE_TOOLCHAIN', '1', 'SDK does not include toolchain')
@@ -72,7 +66,7 @@ class DevtoolTest(OESDKExtTestCase):
72 @skipIfNotDataVar('SDK_INCLUDE_TOOLCHAIN', '1', 'SDK does not include toolchain') 66 @skipIfNotDataVar('SDK_INCLUDE_TOOLCHAIN', '1', 'SDK does not include toolchain')
73 def test_devtool_build_cmake(self): 67 def test_devtool_build_cmake(self):
74 self._test_devtool_build(self.myapp_cmake_dst) 68 self._test_devtool_build(self.myapp_cmake_dst)
75 69
76 @OETestID(1608) 70 @OETestID(1608)
77 @OETestDepends(['test_devtool_location']) 71 @OETestDepends(['test_devtool_location'])
78 @skipIfNotDataVar('SDK_INCLUDE_TOOLCHAIN', '1', 'SDK does not include toolchain') 72 @skipIfNotDataVar('SDK_INCLUDE_TOOLCHAIN', '1', 'SDK does not include toolchain')
@@ -82,11 +76,8 @@ class DevtoolTest(OESDKExtTestCase):
82 self._run('devtool add %s %s' % (recipe, req) ) 76 self._run('devtool add %s %s' % (recipe, req) )
83 try: 77 try:
84 self._run('devtool build %s' % recipe) 78 self._run('devtool build %s' % recipe)
85 except Exception as e: 79 finally:
86 print(e.output)
87 self._run('devtool reset %s' % recipe) 80 self._run('devtool reset %s' % recipe)
88 raise e
89 self._run('devtool reset %s' % recipe)
90 81
91 @OETestID(1609) 82 @OETestID(1609)
92 @OETestDepends(['test_devtool_location']) 83 @OETestDepends(['test_devtool_location'])
@@ -97,11 +88,8 @@ class DevtoolTest(OESDKExtTestCase):
97 self._run('devtool add %s %s' % (recipe, docfile) ) 88 self._run('devtool add %s %s' % (recipe, docfile) )
98 try: 89 try:
99 self._run('devtool build %s' % recipe) 90 self._run('devtool build %s' % recipe)
100 except Exception as e: 91 finally:
101 print(e.output)
102 self._run('devtool reset %s' % recipe) 92 self._run('devtool reset %s' % recipe)
103 raise e
104 self._run('devtool reset %s' % recipe)
105 93
106 @OETestID(1610) 94 @OETestID(1610)
107 @OETestDepends(['test_devtool_location']) 95 @OETestDepends(['test_devtool_location'])
@@ -111,8 +99,5 @@ class DevtoolTest(OESDKExtTestCase):
111 self._run('devtool add %s ' % package_nodejs) 99 self._run('devtool add %s ' % package_nodejs)
112 try: 100 try:
113 self._run('devtool build %s ' % package_nodejs) 101 self._run('devtool build %s ' % package_nodejs)
114 except Exception as e: 102 finally:
115 print(e.output) 103 self._run('devtool reset %s '% package_nodejs)
116 self._run('devtool reset %s' % package_nodejs)
117 raise e
118 self._run('devtool reset %s '% package_nodejs)