summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-selftest/recipes-devtools/python/python-async-test.inc16
-rw-r--r--meta-selftest/recipes-devtools/python/python3-async-test_0.6.2.bb2
-rw-r--r--meta-selftest/recipes-test/recipeutils/recipeutils-test.inc5
-rw-r--r--meta-selftest/recipes-test/recipeutils/recipeutils-test/anotherfile0
-rw-r--r--meta-selftest/recipes-test/recipeutils/recipeutils-test/somefile0
-rw-r--r--meta-selftest/recipes-test/recipeutils/recipeutils-test_1.2.bb13
-rw-r--r--meta/lib/oeqa/selftest/cases/recipeutils.py137
7 files changed, 173 insertions, 0 deletions
diff --git a/meta-selftest/recipes-devtools/python/python-async-test.inc b/meta-selftest/recipes-devtools/python/python-async-test.inc
new file mode 100644
index 0000000000..c9602e8e52
--- /dev/null
+++ b/meta-selftest/recipes-devtools/python/python-async-test.inc
@@ -0,0 +1,16 @@
1SUMMARY = "Python framework to process interdependent tasks in a pool of workers"
2HOMEPAGE = "http://github.com/gitpython-developers/async"
3SECTION = "devel/python"
4LICENSE = "BSD"
5LIC_FILES_CHKSUM = "file://PKG-INFO;beginline=8;endline=8;md5=88df8e78b9edfd744953862179f2d14e"
6
7inherit pypi
8
9PYPI_PACKAGE = "async"
10
11SRC_URI[md5sum] = "9b06b5997de2154f3bc0273f80bcef6b"
12SRC_URI[sha256sum] = "ac6894d876e45878faae493b0cf61d0e28ec417334448ac0a6ea2229d8343051"
13
14RDEPENDS_${PN} += "${PYTHON_PN}-threading"
15
16BBCLASSEXTEND = "nativesdk"
diff --git a/meta-selftest/recipes-devtools/python/python3-async-test_0.6.2.bb b/meta-selftest/recipes-devtools/python/python3-async-test_0.6.2.bb
new file mode 100644
index 0000000000..22e241afb3
--- /dev/null
+++ b/meta-selftest/recipes-devtools/python/python3-async-test_0.6.2.bb
@@ -0,0 +1,2 @@
1inherit setuptools3
2require python-async-test.inc
diff --git a/meta-selftest/recipes-test/recipeutils/recipeutils-test.inc b/meta-selftest/recipes-test/recipeutils/recipeutils-test.inc
new file mode 100644
index 0000000000..8490b902d7
--- /dev/null
+++ b/meta-selftest/recipes-test/recipeutils/recipeutils-test.inc
@@ -0,0 +1,5 @@
1SRC_URI = "http://xorg.freedesktop.org/releases/individual/lib/libxshmfence-${PV}.tar.bz2"
2
3SRC_URI[md5sum] = "66662e76899112c0f99e22f2fc775a7e"
4SRC_URI[sha256sum] = "d21b2d1fd78c1efbe1f2c16dae1cb23f8fd231dcf891465b8debe636a9054b0c"
5
diff --git a/meta-selftest/recipes-test/recipeutils/recipeutils-test/anotherfile b/meta-selftest/recipes-test/recipeutils/recipeutils-test/anotherfile
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/meta-selftest/recipes-test/recipeutils/recipeutils-test/anotherfile
diff --git a/meta-selftest/recipes-test/recipeutils/recipeutils-test/somefile b/meta-selftest/recipes-test/recipeutils/recipeutils-test/somefile
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/meta-selftest/recipes-test/recipeutils/recipeutils-test/somefile
diff --git a/meta-selftest/recipes-test/recipeutils/recipeutils-test_1.2.bb b/meta-selftest/recipes-test/recipeutils/recipeutils-test_1.2.bb
new file mode 100644
index 0000000000..f6da97b2d4
--- /dev/null
+++ b/meta-selftest/recipes-test/recipeutils/recipeutils-test_1.2.bb
@@ -0,0 +1,13 @@
1SUMMARY = "Test recipe for recipeutils.patch_recipe()"
2
3require recipeutils-test.inc
4
5LICENSE = "Proprietary"
6
7DEPENDS += "virtual/libx11"
8
9BBCLASSEXTEND = "native nativesdk"
10
11SRC_URI += "file://somefile"
12
13SRC_URI_append = " file://anotherfile"
diff --git a/meta/lib/oeqa/selftest/cases/recipeutils.py b/meta/lib/oeqa/selftest/cases/recipeutils.py
new file mode 100644
index 0000000000..dd2f55839a
--- /dev/null
+++ b/meta/lib/oeqa/selftest/cases/recipeutils.py
@@ -0,0 +1,137 @@
1import os
2import re
3import time
4import logging
5import bb.tinfoil
6
7from oeqa.selftest.case import OESelftestTestCase
8from oeqa.utils.commands import runCmd, get_test_layer
9from oeqa.core.decorator.oeid import OETestID
10
11
12def setUpModule():
13 global tinfoil
14 global metaselftestpath
15 metaselftestpath = get_test_layer()
16 tinfoil = bb.tinfoil.Tinfoil(tracking=True)
17 tinfoil.prepare(config_only=False, quiet=2)
18
19
20def tearDownModule():
21 tinfoil.shutdown()
22
23
24class RecipeUtilsTests(OESelftestTestCase):
25 """ Tests for the recipeutils module functions """
26
27 def test_patch_recipe_varflag(self):
28 import oe.recipeutils
29 rd = tinfoil.parse_recipe('python3-async-test')
30 vals = {'SRC_URI[md5sum]': 'aaaaaa', 'LICENSE': 'something'}
31 patches = oe.recipeutils.patch_recipe(rd, rd.getVar('FILE'), vals, patch=True, relpath=metaselftestpath)
32
33 expected_patch = """
34--- a/recipes-devtools/python/python-async-test.inc
35+++ b/recipes-devtools/python/python-async-test.inc
36@@ -1,14 +1,14 @@
37 SUMMARY = "Python framework to process interdependent tasks in a pool of workers"
38 HOMEPAGE = "http://github.com/gitpython-developers/async"
39 SECTION = "devel/python"
40-LICENSE = "BSD"
41+LICENSE = "something"
42 LIC_FILES_CHKSUM = "file://PKG-INFO;beginline=8;endline=8;md5=88df8e78b9edfd744953862179f2d14e"
43
44 inherit pypi
45
46 PYPI_PACKAGE = "async"
47
48-SRC_URI[md5sum] = "9b06b5997de2154f3bc0273f80bcef6b"
49+SRC_URI[md5sum] = "aaaaaa"
50 SRC_URI[sha256sum] = "ac6894d876e45878faae493b0cf61d0e28ec417334448ac0a6ea2229d8343051"
51
52 RDEPENDS_${PN} += "${PYTHON_PN}-threading"
53"""
54 patchlines = []
55 for f in patches:
56 for line in f:
57 patchlines.append(line)
58 self.maxDiff = None
59 self.assertEqual(''.join(patchlines).strip(), expected_patch.strip())
60
61
62 def test_patch_recipe_singleappend(self):
63 import oe.recipeutils
64 rd = tinfoil.parse_recipe('recipeutils-test')
65 val = rd.getVar('SRC_URI', False).split()
66 del val[1]
67 val = ' '.join(val)
68 vals = {'SRC_URI': val}
69 patches = oe.recipeutils.patch_recipe(rd, rd.getVar('FILE'), vals, patch=True, relpath=metaselftestpath)
70
71 expected_patch = """
72--- a/recipes-test/recipeutils/recipeutils-test_1.2.bb
73+++ b/recipes-test/recipeutils/recipeutils-test_1.2.bb
74@@ -8,6 +8,4 @@
75
76 BBCLASSEXTEND = "native nativesdk"
77
78-SRC_URI += "file://somefile"
79-
80 SRC_URI_append = " file://anotherfile"
81"""
82 patchlines = []
83 for f in patches:
84 for line in f:
85 patchlines.append(line)
86 self.assertEqual(''.join(patchlines).strip(), expected_patch.strip())
87
88
89 def test_patch_recipe_appends(self):
90 import oe.recipeutils
91 rd = tinfoil.parse_recipe('recipeutils-test')
92 val = rd.getVar('SRC_URI', False).split()
93 vals = {'SRC_URI': val[0]}
94 patches = oe.recipeutils.patch_recipe(rd, rd.getVar('FILE'), vals, patch=True, relpath=metaselftestpath)
95
96 expected_patch = """
97--- a/recipes-test/recipeutils/recipeutils-test_1.2.bb
98+++ b/recipes-test/recipeutils/recipeutils-test_1.2.bb
99@@ -8,6 +8,3 @@
100
101 BBCLASSEXTEND = "native nativesdk"
102
103-SRC_URI += "file://somefile"
104-
105-SRC_URI_append = " file://anotherfile"
106"""
107 patchlines = []
108 for f in patches:
109 for line in f:
110 patchlines.append(line)
111 self.assertEqual(''.join(patchlines).strip(), expected_patch.strip())
112
113
114 def test_validate_pn(self):
115 import oe.recipeutils
116 expected_results = {
117 'test': '',
118 'glib-2.0': '',
119 'gtk+': '',
120 'forcevariable': 'reserved',
121 'pn-something': 'reserved',
122 'test.bb': 'file',
123 'test_one': 'character',
124 'test!': 'character',
125 }
126
127 for pn, expected in expected_results.items():
128 result = oe.recipeutils.validate_pn(pn)
129 if expected:
130 self.assertIn(expected, result)
131 else:
132 self.assertEqual(result, '')
133
134 def test_split_var_value(self):
135 import oe.recipeutils
136 res = oe.recipeutils.split_var_value('test.1 test.2 ${@call_function("hi there world", false)} test.4')
137 self.assertEqual(res, ['test.1', 'test.2', '${@call_function("hi there world", false)}', 'test.4'])