summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/recipetool.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/selftest/recipetool.py')
-rw-r--r--meta/lib/oeqa/selftest/recipetool.py55
1 files changed, 55 insertions, 0 deletions
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 @@
1import unittest
2import os
3import logging
4import re
5import tempfile
6
7import oeqa.utils.ftools as ftools
8from oeqa.selftest.base import oeSelfTest
9from oeqa.utils.commands import runCmd, bitbake, get_bb_var
10from oeqa.utils.decorators import testcase
11from oeqa.selftest.devtool import DevtoolBase
12
13
14class RecipetoolTests(DevtoolBase):
15
16 def setUpLocal(self):
17 self.tempdir = tempfile.mkdtemp(prefix='recipetoolqa')
18 self.track_for_cleanup(self.tempdir)
19
20 def test_recipetool_create(self):
21 # Try adding a recipe
22 tempsrc = os.path.join(self.tempdir, 'srctree')
23 os.makedirs(tempsrc)
24 recipefile = os.path.join(self.tempdir, 'logrotate_3.8.7.bb')
25 srcuri = 'https://fedorahosted.org/releases/l/o/logrotate/logrotate-3.8.7.tar.gz'
26 result = runCmd('recipetool create -o %s %s -x %s' % (recipefile, srcuri, tempsrc))
27 self.assertTrue(os.path.isfile(recipefile))
28 checkvars = {}
29 checkvars['LICENSE'] = 'GPLv2'
30 checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=18810669f13b87348459e611d31ab760'
31 checkvars['SRC_URI'] = 'https://fedorahosted.org/releases/l/o/logrotate/logrotate-${PV}.tar.gz'
32 checkvars['SRC_URI[md5sum]'] = '99e08503ef24c3e2e3ff74cc5f3be213'
33 checkvars['SRC_URI[sha256sum]'] = 'f6ba691f40e30e640efa2752c1f9499a3f9738257660994de70a45fe00d12b64'
34 self._test_recipe_contents(recipefile, checkvars, [])
35
36 def test_recipetool_create_git(self):
37 # Ensure we have the right data in shlibs/pkgdata
38 bitbake('libpng pango libx11 libxext jpeg')
39 # Try adding a recipe
40 tempsrc = os.path.join(self.tempdir, 'srctree')
41 os.makedirs(tempsrc)
42 recipefile = os.path.join(self.tempdir, 'libmatchbox.bb')
43 srcuri = 'git://git.yoctoproject.org/libmatchbox'
44 result = runCmd('recipetool create -o %s %s -x %s' % (recipefile, srcuri, tempsrc))
45 self.assertTrue(os.path.isfile(recipefile), 'recipetool did not create recipe file; output:\n%s' % result.output)
46 checkvars = {}
47 checkvars['LICENSE'] = 'LGPLv2.1'
48 checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=7fbc338309ac38fefcd64b04bb903e34'
49 checkvars['S'] = '${WORKDIR}/git'
50 checkvars['PV'] = '1.0+git${SRCPV}'
51 checkvars['SRC_URI'] = srcuri
52 checkvars['DEPENDS'] = 'libpng pango libx11 libxext jpeg'
53 inherits = ['autotools', 'pkgconfig']
54 self._test_recipe_contents(recipefile, checkvars, inherits)
55