summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/selftest/runtime-test.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/runtime-test.py b/meta/lib/oeqa/selftest/runtime-test.py
index c2d5b45a4b..1dbfae1106 100644
--- a/meta/lib/oeqa/selftest/runtime-test.py
+++ b/meta/lib/oeqa/selftest/runtime-test.py
@@ -2,6 +2,7 @@ from oeqa.selftest.base import oeSelfTest
2from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu 2from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu
3from oeqa.utils.decorators import testcase 3from oeqa.utils.decorators import testcase
4import os 4import os
5import re
5 6
6class TestExport(oeSelfTest): 7class TestExport(oeSelfTest):
7 8
@@ -103,3 +104,54 @@ class TestImage(oeSelfTest):
103 # Build core-image-sato and testimage 104 # Build core-image-sato and testimage
104 bitbake('core-image-full-cmdline socat') 105 bitbake('core-image-full-cmdline socat')
105 bitbake('-c testimage core-image-full-cmdline') 106 bitbake('-c testimage core-image-full-cmdline')
107
108class Postinst(oeSelfTest):
109 @testcase(1540)
110 def test_verify_postinst(self):
111 """
112 Summary: The purpose of this test is to verify the execution order of postinst Bugzilla ID: [5319]
113 Expected :
114 1. Compile a minimal image.
115 2. The compiled image will add the created layer with the recipes postinst[ abdpt]
116 3. Run qemux86
117 4. Validate the task execution order
118 Author: Francisco Pedraza <francisco.j.pedraza.gonzalez@intel.com>
119 """
120 features = 'INHERIT += "testimage"\n'
121 features += 'CORE_IMAGE_EXTRA_INSTALL += "postinst-at-rootfs \
122postinst-delayed-a \
123postinst-delayed-b \
124postinst-delayed-d \
125postinst-delayed-p \
126postinst-delayed-t \
127"\n'
128 self.write_config(features)
129
130 bitbake('core-image-minimal -f ')
131
132 postinst_list = ['100-postinst-at-rootfs',
133 '101-postinst-delayed-a',
134 '102-postinst-delayed-b',
135 '103-postinst-delayed-d',
136 '104-postinst-delayed-p',
137 '105-postinst-delayed-t']
138 path_workdir = get_bb_var('WORKDIR','core-image-minimal')
139 workspacedir = 'testimage/qemu_boot_log'
140 workspacedir = os.path.join(path_workdir, workspacedir)
141 rexp = re.compile("^Running postinst .*/(?P<postinst>.*)\.\.\.$")
142 with runqemu('core-image-minimal') as qemu:
143 with open(workspacedir) as f:
144 found = False
145 idx = 0
146 for line in f.readlines():
147 line = line.strip().replace("^M","")
148 if not line: # To avoid empty lines
149 continue
150 m = rexp.search(line)
151 if m:
152 self.assertEqual(postinst_list[idx], m.group('postinst'), "Fail")
153 idx = idx+1
154 found = True
155 elif found:
156 self.assertEqual(idx, len(postinst_list), "Not found all postinsts")
157 break