aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/lib/oeqa/selftest/devtool.py81
-rw-r--r--meta/lib/oeqa/selftest/recipetool.py55
2 files changed, 77 insertions, 59 deletions
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py
index 1d16113343..f4571c4ef1 100644
--- a/meta/lib/oeqa/selftest/devtool.py
+++ b/meta/lib/oeqa/selftest/devtool.py
@@ -11,29 +11,7 @@ from oeqa.selftest.base import oeSelfTest
from oeqa.utils.commands import runCmd, bitbake, get_bb_var
from oeqa.utils.decorators import testcase
-class DevtoolTests(oeSelfTest):
-
- def test_create_workspace(self):
- # Check preconditions
- workspacedir = os.path.join(self.builddir, 'workspace')
- self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory')
- result = runCmd('bitbake-layers show-layers')
- self.assertTrue('/workspace' not in result.output, 'This test cannot be run with a workspace layer in bblayers.conf')
- # Try creating a workspace layer with a specific path
- tempdir = tempfile.mkdtemp(prefix='devtoolqa')
- self.track_for_cleanup(tempdir)
- 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.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.assertNotIn(tempdir, result.output)
- self.assertIn(workspacedir, result.output)
+class DevtoolBase(oeSelfTest):
def _test_recipe_contents(self, recipefile, checkvars, checkinherits):
with open(recipefile, 'r') as f:
@@ -53,45 +31,30 @@ class DevtoolTests(oeSelfTest):
for inherit in checkinherits:
self.assertIn(inherit, inherits, 'Missing inherit of %s' % inherit)
- def test_recipetool_create(self):
- # Try adding a recipe
- tempdir = tempfile.mkdtemp(prefix='devtoolqa')
- self.track_for_cleanup(tempdir)
- tempsrc = os.path.join(tempdir, 'srctree')
- os.makedirs(tempsrc)
- recipefile = os.path.join(tempdir, 'logrotate_3.8.7.bb')
- srcuri = 'https://fedorahosted.org/releases/l/o/logrotate/logrotate-3.8.7.tar.gz'
- result = runCmd('recipetool create -o %s %s -x %s' % (recipefile, srcuri, tempsrc))
- self.assertTrue(os.path.isfile(recipefile))
- checkvars = {}
- checkvars['LICENSE'] = 'GPLv2'
- checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=18810669f13b87348459e611d31ab760'
- checkvars['SRC_URI'] = 'https://fedorahosted.org/releases/l/o/logrotate/logrotate-${PV}.tar.gz'
- checkvars['SRC_URI[md5sum]'] = '99e08503ef24c3e2e3ff74cc5f3be213'
- checkvars['SRC_URI[sha256sum]'] = 'f6ba691f40e30e640efa2752c1f9499a3f9738257660994de70a45fe00d12b64'
- self._test_recipe_contents(recipefile, checkvars, [])
- def test_recipetool_create_git(self):
- # Ensure we have the right data in shlibs/pkgdata
- bitbake('libpng pango libx11 libxext jpeg')
- # Try adding a recipe
+class DevtoolTests(DevtoolBase):
+
+ def test_create_workspace(self):
+ # Check preconditions
+ workspacedir = os.path.join(self.builddir, 'workspace')
+ self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory')
+ result = runCmd('bitbake-layers show-layers')
+ self.assertTrue('/workspace' not in result.output, 'This test cannot be run with a workspace layer in bblayers.conf')
+ # Try creating a workspace layer with a specific path
tempdir = tempfile.mkdtemp(prefix='devtoolqa')
self.track_for_cleanup(tempdir)
- tempsrc = os.path.join(tempdir, 'srctree')
- os.makedirs(tempsrc)
- 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), 'recipetool did not create recipe file; output:\n%s' % result.output)
- checkvars = {}
- checkvars['LICENSE'] = 'LGPLv2.1'
- checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=7fbc338309ac38fefcd64b04bb903e34'
- checkvars['S'] = '${WORKDIR}/git'
- checkvars['PV'] = '1.0+git${SRCPV}'
- checkvars['SRC_URI'] = srcuri
- checkvars['DEPENDS'] = 'libpng pango libx11 libxext jpeg'
- inherits = ['autotools', 'pkgconfig']
- self._test_recipe_contents(recipefile, checkvars, inherits)
+ 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.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.assertNotIn(tempdir, result.output)
+ self.assertIn(workspacedir, result.output)
def test_devtool_add(self):
# Check preconditions
diff --git a/meta/lib/oeqa/selftest/recipetool.py b/meta/lib/oeqa/selftest/recipetool.py
new file mode 100644
index 0000000000..832fb7b16a
--- /dev/null
+++ b/meta/lib/oeqa/selftest/recipetool.py
@@ -0,0 +1,55 @@
+import unittest
+import os
+import logging
+import re
+import tempfile
+
+import oeqa.utils.ftools as ftools
+from oeqa.selftest.base import oeSelfTest
+from oeqa.utils.commands import runCmd, bitbake, get_bb_var
+from oeqa.utils.decorators import testcase
+from oeqa.selftest.devtool import DevtoolBase
+
+
+class RecipetoolTests(DevtoolBase):
+
+ def setUpLocal(self):
+ self.tempdir = tempfile.mkdtemp(prefix='recipetoolqa')
+ self.track_for_cleanup(self.tempdir)
+
+ def test_recipetool_create(self):
+ # Try adding a recipe
+ tempsrc = os.path.join(self.tempdir, 'srctree')
+ os.makedirs(tempsrc)
+ recipefile = os.path.join(self.tempdir, 'logrotate_3.8.7.bb')
+ srcuri = 'https://fedorahosted.org/releases/l/o/logrotate/logrotate-3.8.7.tar.gz'
+ result = runCmd('recipetool create -o %s %s -x %s' % (recipefile, srcuri, tempsrc))
+ self.assertTrue(os.path.isfile(recipefile))
+ checkvars = {}
+ checkvars['LICENSE'] = 'GPLv2'
+ checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=18810669f13b87348459e611d31ab760'
+ checkvars['SRC_URI'] = 'https://fedorahosted.org/releases/l/o/logrotate/logrotate-${PV}.tar.gz'
+ checkvars['SRC_URI[md5sum]'] = '99e08503ef24c3e2e3ff74cc5f3be213'
+ checkvars['SRC_URI[sha256sum]'] = 'f6ba691f40e30e640efa2752c1f9499a3f9738257660994de70a45fe00d12b64'
+ self._test_recipe_contents(recipefile, checkvars, [])
+
+ def test_recipetool_create_git(self):
+ # Ensure we have the right data in shlibs/pkgdata
+ bitbake('libpng pango libx11 libxext jpeg')
+ # Try adding a recipe
+ tempsrc = os.path.join(self.tempdir, 'srctree')
+ os.makedirs(tempsrc)
+ recipefile = os.path.join(self.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), 'recipetool did not create recipe file; output:\n%s' % result.output)
+ checkvars = {}
+ checkvars['LICENSE'] = 'LGPLv2.1'
+ checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=7fbc338309ac38fefcd64b04bb903e34'
+ checkvars['S'] = '${WORKDIR}/git'
+ checkvars['PV'] = '1.0+git${SRCPV}'
+ checkvars['SRC_URI'] = srcuri
+ checkvars['DEPENDS'] = 'libpng pango libx11 libxext jpeg'
+ inherits = ['autotools', 'pkgconfig']
+ self._test_recipe_contents(recipefile, checkvars, inherits)
+