]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/selftest: support sets in devtool comparisons
authorRoss Burton <ross.burton@intel.com>
Wed, 23 Dec 2015 13:45:23 +0000 (13:45 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 28 Dec 2015 09:24:54 +0000 (09:24 +0000)
The devtool and recipetool tests do literal string comparisons, but for some
fields the ordering could be irrelevant and potentially non-deterministic.  For
example, the recipetool_create_simple test started failing with:

AssertionError: 'GPLv2 Unknown' != 'Unknown GPLv2' : values for LICENSE do not match

The ordering of the LICENSE field isn't relevant.  So, if the expected value is
a set(), split the string into a set too and compare those.

Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/lib/oeqa/selftest/devtool.py
meta/lib/oeqa/selftest/recipetool.py

index 6f76ce7b848d1b8f9da0be37a9dc4a99b4554688..1eadd6b371a5e09510bf2e4e7530427ec6b4a690 100644 (file)
@@ -44,6 +44,8 @@ class DevtoolBase(oeSelfTest):
                     needvalue = checkvars.pop(var)
                     if needvalue is None:
                         self.fail('Variable %s should not appear in recipe')
+                    if isinstance(needvalue, set):
+                        value = set(value.split())
                     self.assertEqual(value, needvalue, 'values for %s do not match' % var)
 
 
index 34e383f7724102b58ba514a87db2d8748b809ff9..00f415b2c6358a885889b83f217a6effcf4a467b 100644 (file)
@@ -413,8 +413,8 @@ class RecipetoolTests(RecipetoolBase):
             self.fail('recipetool did not create recipe file; output:\n%s' % result.output)
         self.assertEqual(dirlist[0], 'socat_%s.bb' % pv, 'Recipe file incorrectly named')
         checkvars = {}
-        checkvars['LICENSE'] = 'Unknown GPLv2'
-        checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING.OpenSSL;md5=5c9bccc77f67a8328ef4ebaf468116f4 file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263'
+        checkvars['LICENSE'] = set(['Unknown', 'GPLv2'])
+        checkvars['LIC_FILES_CHKSUM'] = set(['file://COPYING.OpenSSL;md5=5c9bccc77f67a8328ef4ebaf468116f4', 'file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263'])
         # We don't check DEPENDS since they are variable for this recipe depending on what's in the sysroot
         checkvars['S'] = None
         checkvars['SRC_URI'] = srcuri.replace(pv, '${PV}')