diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2014-12-23 15:19:03 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-12-25 08:27:13 +0000 |
commit | 9c93079795290f09c47ddf78d45b0543a7822c8d (patch) | |
tree | e9d867403982fbd6dec9c0cbc7469787d74b6ccd /meta/lib | |
parent | 41f3dd1d330ec93765c7264383961b42135ffb8a (diff) | |
download | poky-9c93079795290f09c47ddf78d45b0543a7822c8d.tar.gz |
oeqa/selftest: improve failure messages for devtool tests
assertTrue prints "False is not True" if it fails, which is pretty much
useless. Use a more appropriate assertion test where practical and add a
message where it isn't.
(From OE-Core rev: 0e0dd2575bb2a1b6f6c5eba1f8cfb0d81cc1b091)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/selftest/devtool.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py index e8ff536c16..e158ad919f 100644 --- a/meta/lib/oeqa/selftest/devtool.py +++ b/meta/lib/oeqa/selftest/devtool.py | |||
@@ -25,15 +25,15 @@ class DevtoolTests(oeSelfTest): | |||
25 | result = runCmd('devtool create-workspace %s' % tempdir) | 25 | result = runCmd('devtool create-workspace %s' % tempdir) |
26 | self.assertTrue(os.path.isfile(os.path.join(tempdir, 'conf', 'layer.conf'))) | 26 | self.assertTrue(os.path.isfile(os.path.join(tempdir, 'conf', 'layer.conf'))) |
27 | result = runCmd('bitbake-layers show-layers') | 27 | result = runCmd('bitbake-layers show-layers') |
28 | self.assertTrue(tempdir in result.output) | 28 | self.assertIn(tempdir, result.output) |
29 | # Try creating a workspace layer with the default path | 29 | # Try creating a workspace layer with the default path |
30 | self.track_for_cleanup(workspacedir) | 30 | self.track_for_cleanup(workspacedir) |
31 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | 31 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') |
32 | result = runCmd('devtool create-workspace') | 32 | result = runCmd('devtool create-workspace') |
33 | self.assertTrue(os.path.isfile(os.path.join(workspacedir, 'conf', 'layer.conf'))) | 33 | self.assertTrue(os.path.isfile(os.path.join(workspacedir, 'conf', 'layer.conf'))) |
34 | result = runCmd('bitbake-layers show-layers') | 34 | result = runCmd('bitbake-layers show-layers') |
35 | self.assertTrue(tempdir not in result.output) | 35 | self.assertNotIn(tempdir, result.output) |
36 | self.assertTrue(workspacedir in result.output) | 36 | self.assertIn(workspacedir, result.output) |
37 | 37 | ||
38 | def test_recipetool_create(self): | 38 | def test_recipetool_create(self): |
39 | # Try adding a recipe | 39 | # Try adding a recipe |
@@ -74,7 +74,7 @@ class DevtoolTests(oeSelfTest): | |||
74 | recipefile = os.path.join(tempdir, 'libmatchbox.bb') | 74 | recipefile = os.path.join(tempdir, 'libmatchbox.bb') |
75 | srcuri = 'git://git.yoctoproject.org/libmatchbox' | 75 | srcuri = 'git://git.yoctoproject.org/libmatchbox' |
76 | result = runCmd('recipetool create -o %s %s -x %s' % (recipefile, srcuri, tempsrc)) | 76 | result = runCmd('recipetool create -o %s %s -x %s' % (recipefile, srcuri, tempsrc)) |
77 | self.assertTrue(os.path.isfile(recipefile)) | 77 | self.assertTrue(os.path.isfile(recipefile), 'recipetool did not create recipe file; output:\n%s' % result.output) |
78 | checkvars = {} | 78 | checkvars = {} |
79 | checkvars['LICENSE'] = 'LGPLv2.1' | 79 | checkvars['LICENSE'] = 'LGPLv2.1' |
80 | checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=7fbc338309ac38fefcd64b04bb903e34' | 80 | checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=7fbc338309ac38fefcd64b04bb903e34' |
@@ -111,7 +111,7 @@ class DevtoolTests(oeSelfTest): | |||
111 | result = runCmd('wget %s' % url, cwd=tempdir) | 111 | result = runCmd('wget %s' % url, cwd=tempdir) |
112 | result = runCmd('tar xfv pv-1.5.3.tar.bz2', cwd=tempdir) | 112 | result = runCmd('tar xfv pv-1.5.3.tar.bz2', cwd=tempdir) |
113 | srcdir = os.path.join(tempdir, 'pv-1.5.3') | 113 | srcdir = os.path.join(tempdir, 'pv-1.5.3') |
114 | self.assertTrue(os.path.isfile(os.path.join(srcdir, 'configure'))) | 114 | self.assertTrue(os.path.isfile(os.path.join(srcdir, 'configure')), 'Unable to find configure script in source directory') |
115 | # Test devtool add | 115 | # Test devtool add |
116 | self.track_for_cleanup(workspacedir) | 116 | self.track_for_cleanup(workspacedir) |
117 | self.add_command_to_tearDown('bitbake -c cleansstate pv') | 117 | self.add_command_to_tearDown('bitbake -c cleansstate pv') |
@@ -127,9 +127,9 @@ class DevtoolTests(oeSelfTest): | |||
127 | # Test devtool build | 127 | # Test devtool build |
128 | result = runCmd('devtool build pv') | 128 | result = runCmd('devtool build pv') |
129 | installdir = get_bb_var('D', 'pv') | 129 | installdir = get_bb_var('D', 'pv') |
130 | self.assertTrue(installdir) | 130 | self.assertTrue(installdir, 'Could not query installdir variable') |
131 | bindir = get_bb_var('bindir', 'pv') | 131 | bindir = get_bb_var('bindir', 'pv') |
132 | self.assertTrue(bindir) | 132 | self.assertTrue(bindir, 'Could not query bindir variable') |
133 | if bindir[0] == '/': | 133 | if bindir[0] == '/': |
134 | bindir = bindir[1:] | 134 | bindir = bindir[1:] |
135 | self.assertTrue(os.path.isfile(os.path.join(installdir, bindir, 'pv')), 'pv binary not found in D') | 135 | self.assertTrue(os.path.isfile(os.path.join(installdir, bindir, 'pv')), 'pv binary not found in D') |
@@ -167,9 +167,9 @@ class DevtoolTests(oeSelfTest): | |||
167 | result = runCmd("sed -i 's!^\.TH.*!.TH MDADM 8 \"\" v9.999-custom!' %s" % os.path.join(tempdir, 'mdadm.8.in')) | 167 | result = runCmd("sed -i 's!^\.TH.*!.TH MDADM 8 \"\" v9.999-custom!' %s" % os.path.join(tempdir, 'mdadm.8.in')) |
168 | bitbake('mdadm -c package') | 168 | bitbake('mdadm -c package') |
169 | pkgd = get_bb_var('PKGD', 'mdadm') | 169 | pkgd = get_bb_var('PKGD', 'mdadm') |
170 | self.assertTrue(pkgd) | 170 | self.assertTrue(pkgd, 'Could not query PKGD variable') |
171 | mandir = get_bb_var('mandir', 'mdadm') | 171 | mandir = get_bb_var('mandir', 'mdadm') |
172 | self.assertTrue(mandir) | 172 | self.assertTrue(mandir, 'Could not query mandir variable') |
173 | if mandir[0] == '/': | 173 | if mandir[0] == '/': |
174 | mandir = mandir[1:] | 174 | mandir = mandir[1:] |
175 | with open(os.path.join(pkgd, mandir, 'man8', 'mdadm.8'), 'r') as f: | 175 | with open(os.path.join(pkgd, mandir, 'man8', 'mdadm.8'), 'r') as f: |
@@ -223,7 +223,7 @@ class DevtoolTests(oeSelfTest): | |||
223 | elif re.search('minicom_[^_]*.bb$', line): | 223 | elif re.search('minicom_[^_]*.bb$', line): |
224 | self.assertEqual(line[:3], ' M ', 'Unexpected status in line: %s' % line) | 224 | self.assertEqual(line[:3], ' M ', 'Unexpected status in line: %s' % line) |
225 | else: | 225 | else: |
226 | self.assertTrue(False, 'Unexpected modified file in status: %s' % line) | 226 | raise AssertionError('Unexpected modified file in status: %s' % line) |
227 | 227 | ||
228 | def test_devtool_extract(self): | 228 | def test_devtool_extract(self): |
229 | # Check preconditions | 229 | # Check preconditions |