summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2014-12-23 15:19:03 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-12-25 08:26:01 +0000
commit0e0dd2575bb2a1b6f6c5eba1f8cfb0d81cc1b091 (patch)
tree0b82deb44550fe008e666e60a5338db6c2599b24
parente920c1a62705524be71dc5f9e4527b396ca83dca (diff)
downloadopenembedded-core-contrib-0e0dd2575bb2a1b6f6c5eba1f8cfb0d81cc1b091.tar.gz
openembedded-core-contrib-0e0dd2575bb2a1b6f6c5eba1f8cfb0d81cc1b091.tar.bz2
openembedded-core-contrib-0e0dd2575bb2a1b6f6c5eba1f8cfb0d81cc1b091.zip
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. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-rw-r--r--meta/lib/oeqa/selftest/devtool.py20
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):
result = runCmd('devtool create-workspace %s' % tempdir)
self.assertTrue(os.path.isfile(os.path.join(tempdir, 'conf', 'layer.conf')))
result = runCmd('bitbake-layers show-layers')
- self.assertTrue(tempdir in result.output)
+ self.assertIn(tempdir, result.output)
# Try creating a workspace layer with the default path
self.track_for_cleanup(workspacedir)
self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
result = runCmd('devtool create-workspace')
self.assertTrue(os.path.isfile(os.path.join(workspacedir, 'conf', 'layer.conf')))
result = runCmd('bitbake-layers show-layers')
- self.assertTrue(tempdir not in result.output)
- self.assertTrue(workspacedir in result.output)
+ self.assertNotIn(tempdir, result.output)
+ self.assertIn(workspacedir, result.output)
def test_recipetool_create(self):
# Try adding a recipe
@@ -74,7 +74,7 @@ class DevtoolTests(oeSelfTest):
recipefile = os.path.join(tempdir, 'libmatchbox.bb')
srcuri = 'git://git.yoctoproject.org/libmatchbox'
result = runCmd('recipetool create -o %s %s -x %s' % (recipefile, srcuri, tempsrc))
- self.assertTrue(os.path.isfile(recipefile))
+ self.assertTrue(os.path.isfile(recipefile), 'recipetool did not create recipe file; output:\n%s' % result.output)
checkvars = {}
checkvars['LICENSE'] = 'LGPLv2.1'
checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=7fbc338309ac38fefcd64b04bb903e34'
@@ -111,7 +111,7 @@ class DevtoolTests(oeSelfTest):
result = runCmd('wget %s' % url, cwd=tempdir)
result = runCmd('tar xfv pv-1.5.3.tar.bz2', cwd=tempdir)
srcdir = os.path.join(tempdir, 'pv-1.5.3')
- self.assertTrue(os.path.isfile(os.path.join(srcdir, 'configure')))
+ self.assertTrue(os.path.isfile(os.path.join(srcdir, 'configure')), 'Unable to find configure script in source directory')
# Test devtool add
self.track_for_cleanup(workspacedir)
self.add_command_to_tearDown('bitbake -c cleansstate pv')
@@ -127,9 +127,9 @@ class DevtoolTests(oeSelfTest):
# Test devtool build
result = runCmd('devtool build pv')
installdir = get_bb_var('D', 'pv')
- self.assertTrue(installdir)
+ self.assertTrue(installdir, 'Could not query installdir variable')
bindir = get_bb_var('bindir', 'pv')
- self.assertTrue(bindir)
+ self.assertTrue(bindir, 'Could not query bindir variable')
if bindir[0] == '/':
bindir = bindir[1:]
self.assertTrue(os.path.isfile(os.path.join(installdir, bindir, 'pv')), 'pv binary not found in D')
@@ -167,9 +167,9 @@ class DevtoolTests(oeSelfTest):
result = runCmd("sed -i 's!^\.TH.*!.TH MDADM 8 \"\" v9.999-custom!' %s" % os.path.join(tempdir, 'mdadm.8.in'))
bitbake('mdadm -c package')
pkgd = get_bb_var('PKGD', 'mdadm')
- self.assertTrue(pkgd)
+ self.assertTrue(pkgd, 'Could not query PKGD variable')
mandir = get_bb_var('mandir', 'mdadm')
- self.assertTrue(mandir)
+ self.assertTrue(mandir, 'Could not query mandir variable')
if mandir[0] == '/':
mandir = mandir[1:]
with open(os.path.join(pkgd, mandir, 'man8', 'mdadm.8'), 'r') as f:
@@ -223,7 +223,7 @@ class DevtoolTests(oeSelfTest):
elif re.search('minicom_[^_]*.bb$', line):
self.assertEqual(line[:3], ' M ', 'Unexpected status in line: %s' % line)
else:
- self.assertTrue(False, 'Unexpected modified file in status: %s' % line)
+ raise AssertionError('Unexpected modified file in status: %s' % line)
def test_devtool_extract(self):
# Check preconditions