diff options
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/buildoptions.py')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/buildoptions.py | 70 |
1 files changed, 55 insertions, 15 deletions
diff --git a/meta/lib/oeqa/selftest/cases/buildoptions.py b/meta/lib/oeqa/selftest/cases/buildoptions.py index 3495bee986..31dafaa9c5 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 | ||
@@ -9,8 +11,10 @@ import shutil | |||
9 | import tempfile | 11 | import tempfile |
10 | from oeqa.selftest.case import OESelftestTestCase | 12 | from oeqa.selftest.case import OESelftestTestCase |
11 | from oeqa.selftest.cases.buildhistory import BuildhistoryBase | 13 | from oeqa.selftest.cases.buildhistory import BuildhistoryBase |
12 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars | 14 | from oeqa.core.decorator.data import skipIfMachine |
15 | from oeqa.utils.commands import bitbake, get_bb_var, get_bb_vars | ||
13 | import oeqa.utils.ftools as ftools | 16 | import oeqa.utils.ftools as ftools |
17 | from oeqa.core.decorator import OETestTag | ||
14 | 18 | ||
15 | class ImageOptionsTests(OESelftestTestCase): | 19 | class ImageOptionsTests(OESelftestTestCase): |
16 | 20 | ||
@@ -50,23 +54,23 @@ class ImageOptionsTests(OESelftestTestCase): | |||
50 | def test_read_only_image(self): | 54 | def test_read_only_image(self): |
51 | distro_features = get_bb_var('DISTRO_FEATURES') | 55 | distro_features = get_bb_var('DISTRO_FEATURES') |
52 | if not ('x11' in distro_features and 'opengl' in distro_features): | 56 | if not ('x11' in distro_features and 'opengl' in distro_features): |
53 | self.skipTest('core-image-sato requires x11 and opengl in distro features') | 57 | self.skipTest('core-image-sato/weston requires x11 and opengl in distro features') |
54 | self.write_config('IMAGE_FEATURES += "read-only-rootfs"') | 58 | self.write_config('IMAGE_FEATURES += "read-only-rootfs"') |
55 | bitbake("core-image-sato") | 59 | bitbake("core-image-sato core-image-weston") |
56 | # do_image will fail if there are any pending postinsts | 60 | # do_image will fail if there are any pending postinsts |
57 | 61 | ||
58 | class DiskMonTest(OESelftestTestCase): | 62 | class DiskMonTest(OESelftestTestCase): |
59 | 63 | ||
60 | def test_stoptask_behavior(self): | 64 | def test_stoptask_behavior(self): |
61 | self.write_config('BB_DISKMON_DIRS = "STOPTASKS,${TMPDIR},100000G,100K"') | 65 | self.write_config('BB_DISKMON_DIRS = "STOPTASKS,${TMPDIR},100000G,100K"\nBB_HEARTBEAT_EVENT = "1"') |
62 | res = bitbake("delay -c delay", ignore_status = True) | 66 | 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) | 67 | 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)) | 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)) |
65 | self.write_config('BB_DISKMON_DIRS = "ABORT,${TMPDIR},100000G,100K"') | 69 | self.write_config('BB_DISKMON_DIRS = "HALT,${TMPDIR},100000G,100K"\nBB_HEARTBEAT_EVENT = "1"') |
66 | res = bitbake("delay -c delay", ignore_status = True) | 70 | 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) | 71 | 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)) | 72 | 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"') | 73 | self.write_config('BB_DISKMON_DIRS = "WARN,${TMPDIR},100000G,100K"\nBB_HEARTBEAT_EVENT = "1"') |
70 | res = bitbake("delay -c delay") | 74 | 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) | 75 | 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 | 76 | ||
@@ -78,9 +82,9 @@ class SanityOptionsTest(OESelftestTestCase): | |||
78 | 82 | ||
79 | def test_options_warnqa_errorqa_switch(self): | 83 | def test_options_warnqa_errorqa_switch(self): |
80 | 84 | ||
81 | self.write_config("INHERIT_remove = \"report-error\"") | 85 | self.write_config("INHERIT:remove = \"report-error\"") |
82 | if "packages-list" not in get_bb_var("ERROR_QA"): | 86 | if "packages-list" not in get_bb_var("ERROR_QA"): |
83 | self.append_config("ERROR_QA_append = \" packages-list\"") | 87 | self.append_config("ERROR_QA:append = \" packages-list\"") |
84 | 88 | ||
85 | self.write_recipeinc('xcursor-transparent-theme', 'PACKAGES += \"${PN}-dbg\"') | 89 | self.write_recipeinc('xcursor-transparent-theme', 'PACKAGES += \"${PN}-dbg\"') |
86 | self.add_command_to_tearDown('bitbake -c clean xcursor-transparent-theme') | 90 | self.add_command_to_tearDown('bitbake -c clean xcursor-transparent-theme') |
@@ -90,8 +94,8 @@ class SanityOptionsTest(OESelftestTestCase): | |||
90 | self.assertTrue(line and line.startswith("ERROR:"), msg=res.output) | 94 | 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)) | 95 | 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\"') | 96 | self.write_recipeinc('xcursor-transparent-theme', 'PACKAGES += \"${PN}-dbg\"') |
93 | self.append_config('ERROR_QA_remove = "packages-list"') | 97 | self.append_config('ERROR_QA:remove = "packages-list"') |
94 | self.append_config('WARN_QA_append = " packages-list"') | 98 | self.append_config('WARN_QA:append = " packages-list"') |
95 | res = bitbake("xcursor-transparent-theme -f -c package") | 99 | res = bitbake("xcursor-transparent-theme -f -c package") |
96 | self.delete_recipeinc('xcursor-transparent-theme') | 100 | 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.") | 101 | line = self.getline(res, "QA Issue: xcursor-transparent-theme-dbg is listed in PACKAGES multiple times, this leads to packaging errors.") |
@@ -148,19 +152,48 @@ class BuildhistoryTests(BuildhistoryBase): | |||
148 | self.run_buildhistory_operation(target, target_config="PR = \"r1\"", change_bh_location=True) | 152 | 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) | 153 | self.run_buildhistory_operation(target, target_config="PR = \"r0\"", change_bh_location=False, expect_error=True, error_regex=error) |
150 | 154 | ||
155 | def test_fileinfo(self): | ||
156 | self.config_buildhistory() | ||
157 | bitbake('hicolor-icon-theme') | ||
158 | history_dir = get_bb_var('BUILDHISTORY_DIR_PACKAGE', 'hicolor-icon-theme') | ||
159 | self.assertTrue(os.path.isdir(history_dir), 'buildhistory dir was not created.') | ||
160 | |||
161 | def load_bh(f): | ||
162 | d = {} | ||
163 | for line in open(f): | ||
164 | split = [s.strip() for s in line.split('=', 1)] | ||
165 | if len(split) > 1: | ||
166 | d[split[0]] = split[1] | ||
167 | return d | ||
168 | |||
169 | data = load_bh(os.path.join(history_dir, 'hicolor-icon-theme', 'latest')) | ||
170 | self.assertIn('FILELIST', data) | ||
171 | self.assertEqual(data['FILELIST'], '/usr/share/icons/hicolor/index.theme') | ||
172 | self.assertGreater(int(data['PKGSIZE']), 0) | ||
173 | |||
174 | data = load_bh(os.path.join(history_dir, 'hicolor-icon-theme-dev', 'latest')) | ||
175 | if 'FILELIST' in data: | ||
176 | self.assertEqual(data['FILELIST'], '') | ||
177 | self.assertEqual(int(data['PKGSIZE']), 0) | ||
178 | |||
151 | class ArchiverTest(OESelftestTestCase): | 179 | class ArchiverTest(OESelftestTestCase): |
152 | def test_arch_work_dir_and_export_source(self): | 180 | def test_arch_work_dir_and_export_source(self): |
153 | """ | 181 | """ |
154 | Test for archiving the work directory and exporting the source files. | 182 | Test for archiving the work directory and exporting the source files. |
155 | """ | 183 | """ |
156 | self.write_config("INHERIT += \"archiver\"\nARCHIVER_MODE[src] = \"original\"\nARCHIVER_MODE[srpm] = \"1\"") | 184 | self.write_config(""" |
185 | INHERIT += "archiver" | ||
186 | PACKAGE_CLASSES = "package_rpm" | ||
187 | ARCHIVER_MODE[src] = "original" | ||
188 | ARCHIVER_MODE[srpm] = "1" | ||
189 | """) | ||
157 | res = bitbake("xcursor-transparent-theme", ignore_status=True) | 190 | res = bitbake("xcursor-transparent-theme", ignore_status=True) |
158 | self.assertEqual(res.status, 0, "\nCouldn't build xcursortransparenttheme.\nbitbake output %s" % res.output) | 191 | self.assertEqual(res.status, 0, "\nCouldn't build xcursortransparenttheme.\nbitbake output %s" % res.output) |
159 | deploy_dir_src = get_bb_var('DEPLOY_DIR_SRC') | 192 | deploy_dir_src = get_bb_var('DEPLOY_DIR_SRC') |
160 | pkgs_path = g.glob(str(deploy_dir_src) + "/allarch*/xcurs*") | 193 | pkgs_path = g.glob(str(deploy_dir_src) + "/allarch*/xcurs*") |
161 | src_file_glob = str(pkgs_path[0]) + "/xcursor*.src.rpm" | 194 | src_file_glob = str(pkgs_path[0]) + "/xcursor*.src.rpm" |
162 | tar_file_glob = str(pkgs_path[0]) + "/xcursor*.tar.gz" | 195 | 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) | 196 | 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 | 197 | ||
165 | class ToolchainOptions(OESelftestTestCase): | 198 | class ToolchainOptions(OESelftestTestCase): |
166 | def test_toolchain_fortran(self): | 199 | def test_toolchain_fortran(self): |
@@ -168,10 +201,11 @@ class ToolchainOptions(OESelftestTestCase): | |||
168 | Test that Fortran works by building a Hello, World binary. | 201 | Test that Fortran works by building a Hello, World binary. |
169 | """ | 202 | """ |
170 | 203 | ||
171 | features = 'FORTRAN_forcevariable = ",fortran"\n' | 204 | features = 'FORTRAN:forcevariable = ",fortran"\n' |
172 | self.write_config(features) | 205 | self.write_config(features) |
173 | bitbake('fortran-helloworld') | 206 | bitbake('fortran-helloworld') |
174 | 207 | ||
208 | @OETestTag("yocto-mirrors") | ||
175 | class SourceMirroring(OESelftestTestCase): | 209 | class SourceMirroring(OESelftestTestCase): |
176 | # Can we download everything from the Yocto Sources Mirror over http only | 210 | # Can we download everything from the Yocto Sources Mirror over http only |
177 | def test_yocto_source_mirror(self): | 211 | def test_yocto_source_mirror(self): |
@@ -197,3 +231,9 @@ PREMIRRORS = "\\ | |||
197 | 231 | ||
198 | bitbake("world --runall fetch") | 232 | bitbake("world --runall fetch") |
199 | 233 | ||
234 | |||
235 | class Poisoning(OESelftestTestCase): | ||
236 | def test_poisoning(self): | ||
237 | res = bitbake("poison", ignore_status=True) | ||
238 | self.assertNotEqual(res.status, 0) | ||
239 | self.assertTrue("is unsafe for cross-compilation" in res.output) | ||