summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/buildoptions.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/buildoptions.py')
-rw-r--r--meta/lib/oeqa/selftest/cases/buildoptions.py61
1 files changed, 31 insertions, 30 deletions
diff --git a/meta/lib/oeqa/selftest/cases/buildoptions.py b/meta/lib/oeqa/selftest/cases/buildoptions.py
index 3495bee986..767e19bd88 100644
--- a/meta/lib/oeqa/selftest/cases/buildoptions.py
+++ b/meta/lib/oeqa/selftest/cases/buildoptions.py
@@ -1,4 +1,6 @@
1# 1#
2# Copyright OpenEmbedded Contributors
3#
2# SPDX-License-Identifier: MIT 4# SPDX-License-Identifier: MIT
3# 5#
4 6
@@ -8,9 +10,10 @@ import glob as g
8import shutil 10import shutil
9import tempfile 11import tempfile
10from oeqa.selftest.case import OESelftestTestCase 12from oeqa.selftest.case import OESelftestTestCase
11from oeqa.selftest.cases.buildhistory import BuildhistoryBase 13from oeqa.core.decorator.data import skipIfMachine
12from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars 14from oeqa.utils.commands import bitbake, get_bb_var, get_bb_vars
13import oeqa.utils.ftools as ftools 15import oeqa.utils.ftools as ftools
16from oeqa.core.decorator import OETestTag
14 17
15class ImageOptionsTests(OESelftestTestCase): 18class ImageOptionsTests(OESelftestTestCase):
16 19
@@ -50,23 +53,23 @@ class ImageOptionsTests(OESelftestTestCase):
50 def test_read_only_image(self): 53 def test_read_only_image(self):
51 distro_features = get_bb_var('DISTRO_FEATURES') 54 distro_features = get_bb_var('DISTRO_FEATURES')
52 if not ('x11' in distro_features and 'opengl' in distro_features): 55 if not ('x11' in distro_features and 'opengl' in distro_features):
53 self.skipTest('core-image-sato requires x11 and opengl in distro features') 56 self.skipTest('core-image-sato/weston requires x11 and opengl in distro features')
54 self.write_config('IMAGE_FEATURES += "read-only-rootfs"') 57 self.write_config('IMAGE_FEATURES += "read-only-rootfs"')
55 bitbake("core-image-sato") 58 bitbake("core-image-sato core-image-weston")
56 # do_image will fail if there are any pending postinsts 59 # do_image will fail if there are any pending postinsts
57 60
58class DiskMonTest(OESelftestTestCase): 61class DiskMonTest(OESelftestTestCase):
59 62
60 def test_stoptask_behavior(self): 63 def test_stoptask_behavior(self):
61 self.write_config('BB_DISKMON_DIRS = "STOPTASKS,${TMPDIR},100000G,100K"') 64 self.write_config('BB_DISKMON_DIRS = "STOPTASKS,${TMPDIR},100000G,100K"\nBB_HEARTBEAT_EVENT = "1"')
62 res = bitbake("delay -c delay", ignore_status = True) 65 res = bitbake("delay -c delay", ignore_status = True)
63 self.assertTrue('ERROR: No new tasks can be executed since the disk space monitor action is "STOPTASKS"!' in res.output, msg = "Tasks should have stopped. Disk monitor is set to STOPTASK: %s" % res.output) 66 self.assertTrue('ERROR: No new tasks can be executed since the disk space monitor action is "STOPTASKS"!' in res.output, msg = "Tasks should have stopped. Disk monitor is set to STOPTASK: %s" % res.output)
64 self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.output)) 67 self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.output))
65 self.write_config('BB_DISKMON_DIRS = "ABORT,${TMPDIR},100000G,100K"') 68 self.write_config('BB_DISKMON_DIRS = "HALT,${TMPDIR},100000G,100K"\nBB_HEARTBEAT_EVENT = "1"')
66 res = bitbake("delay -c delay", ignore_status = True) 69 res = bitbake("delay -c delay", ignore_status = True)
67 self.assertTrue('ERROR: Immediately abort since the disk space monitor action is "ABORT"!' in res.output, "Tasks should have been aborted immediatelly. Disk monitor is set to ABORT: %s" % res.output) 70 self.assertTrue('ERROR: Immediately halt since the disk space monitor action is "HALT"!' in res.output, "Tasks should have been halted immediately. Disk monitor is set to HALT: %s" % res.output)
68 self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.output)) 71 self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.output))
69 self.write_config('BB_DISKMON_DIRS = "WARN,${TMPDIR},100000G,100K"') 72 self.write_config('BB_DISKMON_DIRS = "WARN,${TMPDIR},100000G,100K"\nBB_HEARTBEAT_EVENT = "1"')
70 res = bitbake("delay -c delay") 73 res = bitbake("delay -c delay")
71 self.assertTrue('WARNING: The free space' in res.output, msg = "A warning should have been displayed for disk monitor is set to WARN: %s" %res.output) 74 self.assertTrue('WARNING: The free space' in res.output, msg = "A warning should have been displayed for disk monitor is set to WARN: %s" %res.output)
72 75
@@ -78,9 +81,9 @@ class SanityOptionsTest(OESelftestTestCase):
78 81
79 def test_options_warnqa_errorqa_switch(self): 82 def test_options_warnqa_errorqa_switch(self):
80 83
81 self.write_config("INHERIT_remove = \"report-error\"") 84 self.write_config("INHERIT:remove = \"report-error\"")
82 if "packages-list" not in get_bb_var("ERROR_QA"): 85 if "packages-list" not in get_bb_var("ERROR_QA"):
83 self.append_config("ERROR_QA_append = \" packages-list\"") 86 self.append_config("ERROR_QA:append:pn-xcursor-transparent-theme = \" packages-list\"")
84 87
85 self.write_recipeinc('xcursor-transparent-theme', 'PACKAGES += \"${PN}-dbg\"') 88 self.write_recipeinc('xcursor-transparent-theme', 'PACKAGES += \"${PN}-dbg\"')
86 self.add_command_to_tearDown('bitbake -c clean xcursor-transparent-theme') 89 self.add_command_to_tearDown('bitbake -c clean xcursor-transparent-theme')
@@ -90,8 +93,8 @@ class SanityOptionsTest(OESelftestTestCase):
90 self.assertTrue(line and line.startswith("ERROR:"), msg=res.output) 93 self.assertTrue(line and line.startswith("ERROR:"), msg=res.output)
91 self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.output)) 94 self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.output))
92 self.write_recipeinc('xcursor-transparent-theme', 'PACKAGES += \"${PN}-dbg\"') 95 self.write_recipeinc('xcursor-transparent-theme', 'PACKAGES += \"${PN}-dbg\"')
93 self.append_config('ERROR_QA_remove = "packages-list"') 96 self.append_config('ERROR_QA:remove:pn-xcursor-transparent-theme = "packages-list"')
94 self.append_config('WARN_QA_append = " packages-list"') 97 self.append_config('WARN_QA:append:pn-xcursor-transparent-theme = " packages-list"')
95 res = bitbake("xcursor-transparent-theme -f -c package") 98 res = bitbake("xcursor-transparent-theme -f -c package")
96 self.delete_recipeinc('xcursor-transparent-theme') 99 self.delete_recipeinc('xcursor-transparent-theme')
97 line = self.getline(res, "QA Issue: xcursor-transparent-theme-dbg is listed in PACKAGES multiple times, this leads to packaging errors.") 100 line = self.getline(res, "QA Issue: xcursor-transparent-theme-dbg is listed in PACKAGES multiple times, this leads to packaging errors.")
@@ -135,32 +138,24 @@ class SanityOptionsTest(OESelftestTestCase):
135 138
136 self.assertNotIn(err, ret.output) 139 self.assertNotIn(err, ret.output)
137 140
138
139class BuildhistoryTests(BuildhistoryBase):
140
141 def test_buildhistory_basic(self):
142 self.run_buildhistory_operation('xcursor-transparent-theme')
143 self.assertTrue(os.path.isdir(get_bb_var('BUILDHISTORY_DIR')), "buildhistory dir was not created.")
144
145 def test_buildhistory_buildtime_pr_backwards(self):
146 target = 'xcursor-transparent-theme'
147 error = "ERROR:.*QA Issue: Package version for package %s went backwards which would break package feeds \(from .*-r1.* to .*-r0.*\)" % target
148 self.run_buildhistory_operation(target, target_config="PR = \"r1\"", change_bh_location=True)
149 self.run_buildhistory_operation(target, target_config="PR = \"r0\"", change_bh_location=False, expect_error=True, error_regex=error)
150
151class ArchiverTest(OESelftestTestCase): 141class ArchiverTest(OESelftestTestCase):
152 def test_arch_work_dir_and_export_source(self): 142 def test_arch_work_dir_and_export_source(self):
153 """ 143 """
154 Test for archiving the work directory and exporting the source files. 144 Test for archiving the work directory and exporting the source files.
155 """ 145 """
156 self.write_config("INHERIT += \"archiver\"\nARCHIVER_MODE[src] = \"original\"\nARCHIVER_MODE[srpm] = \"1\"") 146 self.write_config("""
147INHERIT += "archiver"
148PACKAGE_CLASSES = "package_rpm"
149ARCHIVER_MODE[src] = "original"
150ARCHIVER_MODE[srpm] = "1"
151""")
157 res = bitbake("xcursor-transparent-theme", ignore_status=True) 152 res = bitbake("xcursor-transparent-theme", ignore_status=True)
158 self.assertEqual(res.status, 0, "\nCouldn't build xcursortransparenttheme.\nbitbake output %s" % res.output) 153 self.assertEqual(res.status, 0, "\nCouldn't build xcursortransparenttheme.\nbitbake output %s" % res.output)
159 deploy_dir_src = get_bb_var('DEPLOY_DIR_SRC') 154 deploy_dir_src = get_bb_var('DEPLOY_DIR_SRC')
160 pkgs_path = g.glob(str(deploy_dir_src) + "/allarch*/xcurs*") 155 pkgs_path = g.glob(str(deploy_dir_src) + "/allarch*/xcurs*")
161 src_file_glob = str(pkgs_path[0]) + "/xcursor*.src.rpm" 156 src_file_glob = str(pkgs_path[0]) + "/xcursor*.src.rpm"
162 tar_file_glob = str(pkgs_path[0]) + "/xcursor*.tar.gz" 157 tar_file_glob = str(pkgs_path[0]) + "/xcursor*.tar.xz"
163 self.assertTrue((g.glob(src_file_glob) and g.glob(tar_file_glob)), "Couldn't find .src.rpm and .tar.gz files under %s/allarch*/xcursor*" % deploy_dir_src) 158 self.assertTrue((g.glob(src_file_glob) and g.glob(tar_file_glob)), "Couldn't find .src.rpm and .tar.xz files under %s/allarch*/xcursor*" % deploy_dir_src)
164 159
165class ToolchainOptions(OESelftestTestCase): 160class ToolchainOptions(OESelftestTestCase):
166 def test_toolchain_fortran(self): 161 def test_toolchain_fortran(self):
@@ -168,10 +163,11 @@ class ToolchainOptions(OESelftestTestCase):
168 Test that Fortran works by building a Hello, World binary. 163 Test that Fortran works by building a Hello, World binary.
169 """ 164 """
170 165
171 features = 'FORTRAN_forcevariable = ",fortran"\n' 166 features = 'FORTRAN:forcevariable = ",fortran"\n'
172 self.write_config(features) 167 self.write_config(features)
173 bitbake('fortran-helloworld') 168 bitbake('fortran-helloworld')
174 169
170@OETestTag("yocto-mirrors")
175class SourceMirroring(OESelftestTestCase): 171class SourceMirroring(OESelftestTestCase):
176 # Can we download everything from the Yocto Sources Mirror over http only 172 # Can we download everything from the Yocto Sources Mirror over http only
177 def test_yocto_source_mirror(self): 173 def test_yocto_source_mirror(self):
@@ -195,5 +191,10 @@ PREMIRRORS = "\\
195 https://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \\n" 191 https://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \\n"
196""") 192""")
197 193
198 bitbake("world --runall fetch") 194 bitbake("world --runall fetch --continue")
195
199 196
197class Poisoning(OESelftestTestCase):
198 def test_poisoning(self):
199 # The poison recipe fails if the poisoning didn't work
200 bitbake("poison")