summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/layerappend.py
diff options
context:
space:
mode:
authorLeonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>2017-05-12 14:40:21 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-06-06 19:02:43 +0100
commit157c3be2ca93f076033f725ec1ee912df91f7488 (patch)
tree8ef896ff7adf78d63b34059cd5b017a4f0a3419a /meta/lib/oeqa/selftest/layerappend.py
parent10c512b60d1167122b5fe778b93838dca3def717 (diff)
downloadpoky-157c3be2ca93f076033f725ec1ee912df91f7488.tar.gz
oeqa/selftest/cases: Migrate test cases into the new oe-qa framework
New framework has different classes/decorators so adapt current test cases to support these. Changes include changes on base classes and decorators. Also include paths in selftest/__init__.py isn't needed because the loader is the standard unittest one. (From OE-Core rev: ddbbefdd124604d10bd47dd0266b55a764fcc0ab) Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/layerappend.py')
-rw-r--r--meta/lib/oeqa/selftest/layerappend.py100
1 files changed, 0 insertions, 100 deletions
diff --git a/meta/lib/oeqa/selftest/layerappend.py b/meta/lib/oeqa/selftest/layerappend.py
deleted file mode 100644
index 37bb32cd1d..0000000000
--- a/meta/lib/oeqa/selftest/layerappend.py
+++ /dev/null
@@ -1,100 +0,0 @@
1import unittest
2import os
3import logging
4import re
5
6from oeqa.selftest.base import oeSelfTest
7from oeqa.selftest.buildhistory import BuildhistoryBase
8from oeqa.utils.commands import runCmd, bitbake, get_bb_var
9import oeqa.utils.ftools as ftools
10from oeqa.utils.decorators import testcase
11
12class LayerAppendTests(oeSelfTest):
13 layerconf = """
14# We have a conf and classes directory, append to BBPATH
15BBPATH .= ":${LAYERDIR}"
16
17# We have a recipes directory, add to BBFILES
18BBFILES += "${LAYERDIR}/recipes*/*.bb ${LAYERDIR}/recipes*/*.bbappend"
19
20BBFILE_COLLECTIONS += "meta-layerINT"
21BBFILE_PATTERN_meta-layerINT := "^${LAYERDIR}/"
22BBFILE_PRIORITY_meta-layerINT = "6"
23"""
24 recipe = """
25LICENSE="CLOSED"
26INHIBIT_DEFAULT_DEPS = "1"
27
28python do_build() {
29 bb.plain('Building ...')
30}
31addtask build
32"""
33 append = """
34FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
35
36SRC_URI_append = " file://appendtest.txt"
37
38sysroot_stage_all_append() {
39 install -m 644 ${WORKDIR}/appendtest.txt ${SYSROOT_DESTDIR}/
40}
41
42"""
43
44 append2 = """
45FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
46
47SRC_URI_append += "file://appendtest.txt"
48"""
49 layerappend = ''
50
51 def tearDownLocal(self):
52 if self.layerappend:
53 ftools.remove_from_file(self.builddir + "/conf/bblayers.conf", self.layerappend)
54
55 @testcase(1196)
56 def test_layer_appends(self):
57 corebase = get_bb_var("COREBASE")
58
59 for l in ["0", "1", "2"]:
60 layer = os.path.join(corebase, "meta-layertest" + l)
61 self.assertFalse(os.path.exists(layer))
62 os.mkdir(layer)
63 os.mkdir(layer + "/conf")
64 with open(layer + "/conf/layer.conf", "w") as f:
65 f.write(self.layerconf.replace("INT", l))
66 os.mkdir(layer + "/recipes-test")
67 if l == "0":
68 with open(layer + "/recipes-test/layerappendtest.bb", "w") as f:
69 f.write(self.recipe)
70 elif l == "1":
71 with open(layer + "/recipes-test/layerappendtest.bbappend", "w") as f:
72 f.write(self.append)
73 os.mkdir(layer + "/recipes-test/layerappendtest")
74 with open(layer + "/recipes-test/layerappendtest/appendtest.txt", "w") as f:
75 f.write("Layer 1 test")
76 elif l == "2":
77 with open(layer + "/recipes-test/layerappendtest.bbappend", "w") as f:
78 f.write(self.append2)
79 os.mkdir(layer + "/recipes-test/layerappendtest")
80 with open(layer + "/recipes-test/layerappendtest/appendtest.txt", "w") as f:
81 f.write("Layer 2 test")
82 self.track_for_cleanup(layer)
83
84 self.layerappend = "BBLAYERS += \"{0}/meta-layertest0 {0}/meta-layertest1 {0}/meta-layertest2\"".format(corebase)
85 ftools.append_file(self.builddir + "/conf/bblayers.conf", self.layerappend)
86 stagingdir = get_bb_var("SYSROOT_DESTDIR", "layerappendtest")
87 bitbake("layerappendtest")
88 data = ftools.read_file(stagingdir + "/appendtest.txt")
89 self.assertEqual(data, "Layer 2 test")
90 os.remove(corebase + "/meta-layertest2/recipes-test/layerappendtest/appendtest.txt")
91 bitbake("layerappendtest")
92 data = ftools.read_file(stagingdir + "/appendtest.txt")
93 self.assertEqual(data, "Layer 1 test")
94 with open(corebase + "/meta-layertest2/recipes-test/layerappendtest/appendtest.txt", "w") as f:
95 f.write("Layer 2 test")
96 bitbake("layerappendtest")
97 data = ftools.read_file(stagingdir + "/appendtest.txt")
98 self.assertEqual(data, "Layer 2 test")
99
100