diff options
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/buildhistory.py | 61 | ||||
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/buildoptions.py | 38 | ||||
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/oescripts.py | 24 |
3 files changed, 57 insertions, 66 deletions
diff --git a/meta/lib/oeqa/selftest/cases/buildhistory.py b/meta/lib/oeqa/selftest/cases/buildhistory.py index 2d55994916..511c666554 100644 --- a/meta/lib/oeqa/selftest/cases/buildhistory.py +++ b/meta/lib/oeqa/selftest/cases/buildhistory.py | |||
| @@ -9,10 +9,10 @@ import re | |||
| 9 | import datetime | 9 | import datetime |
| 10 | 10 | ||
| 11 | from oeqa.selftest.case import OESelftestTestCase | 11 | from oeqa.selftest.case import OESelftestTestCase |
| 12 | from oeqa.utils.commands import bitbake, get_bb_vars | 12 | from oeqa.utils.commands import bitbake, get_bb_vars, get_bb_var, runCmd |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | class BuildhistoryBase(OESelftestTestCase): | 15 | class BuildhistoryTests(OESelftestTestCase): |
| 16 | 16 | ||
| 17 | def config_buildhistory(self, tmp_bh_location=False): | 17 | def config_buildhistory(self, tmp_bh_location=False): |
| 18 | bb_vars = get_bb_vars(['USER_CLASSES', 'INHERIT']) | 18 | bb_vars = get_bb_vars(['USER_CLASSES', 'INHERIT']) |
| @@ -48,5 +48,58 @@ class BuildhistoryBase(OESelftestTestCase): | |||
| 48 | else: | 48 | else: |
| 49 | self.assertEqual(result.status, 0, msg="Command 'bitbake %s' has failed unexpectedly: %s" % (target, result.output)) | 49 | self.assertEqual(result.status, 0, msg="Command 'bitbake %s' has failed unexpectedly: %s" % (target, result.output)) |
| 50 | 50 | ||
| 51 | # No tests should be added to the base class. | 51 | |
| 52 | # Please create a new class that inherit this one, or use one of those already available for adding tests. | 52 | def test_buildhistory_basic(self): |
| 53 | self.run_buildhistory_operation('xcursor-transparent-theme') | ||
| 54 | self.assertTrue(os.path.isdir(get_bb_var('BUILDHISTORY_DIR')), "buildhistory dir was not created.") | ||
| 55 | |||
| 56 | def test_buildhistory_buildtime_pr_backwards(self): | ||
| 57 | target = 'xcursor-transparent-theme' | ||
| 58 | error = "ERROR:.*QA Issue: Package version for package %s went backwards which would break package feeds \(from .*-r1.* to .*-r0.*\)" % target | ||
| 59 | self.run_buildhistory_operation(target, target_config="PR = \"r1\"", change_bh_location=True) | ||
| 60 | self.run_buildhistory_operation(target, target_config="PR = \"r0\"", change_bh_location=False, expect_error=True, error_regex=error) | ||
| 61 | |||
| 62 | def test_fileinfo(self): | ||
| 63 | self.config_buildhistory() | ||
| 64 | bitbake('hicolor-icon-theme') | ||
| 65 | history_dir = get_bb_var('BUILDHISTORY_DIR_PACKAGE', 'hicolor-icon-theme') | ||
| 66 | self.assertTrue(os.path.isdir(history_dir), 'buildhistory dir was not created.') | ||
| 67 | |||
| 68 | def load_bh(f): | ||
| 69 | d = {} | ||
| 70 | for line in open(f): | ||
| 71 | split = [s.strip() for s in line.split('=', 1)] | ||
| 72 | if len(split) > 1: | ||
| 73 | d[split[0]] = split[1] | ||
| 74 | return d | ||
| 75 | |||
| 76 | data = load_bh(os.path.join(history_dir, 'hicolor-icon-theme', 'latest')) | ||
| 77 | self.assertIn('FILELIST', data) | ||
| 78 | self.assertEqual(data['FILELIST'], '/usr/share/icons/hicolor/index.theme') | ||
| 79 | self.assertGreater(int(data['PKGSIZE']), 0) | ||
| 80 | |||
| 81 | data = load_bh(os.path.join(history_dir, 'hicolor-icon-theme-dev', 'latest')) | ||
| 82 | if 'FILELIST' in data: | ||
| 83 | self.assertEqual(data['FILELIST'], '/usr/share/pkgconfig/default-icon-theme.pc') | ||
| 84 | self.assertGreater(int(data['PKGSIZE']), 0) | ||
| 85 | |||
| 86 | def test_buildhistory_diff(self): | ||
| 87 | target = 'xcursor-transparent-theme' | ||
| 88 | self.run_buildhistory_operation(target, target_config="PR = \"r1\"", change_bh_location=True) | ||
| 89 | self.run_buildhistory_operation(target, target_config="PR = \"r0\"", change_bh_location=False, expect_error=True) | ||
| 90 | result = runCmd("oe-pkgdata-util read-value PKGV %s" % target) | ||
| 91 | pkgv = result.output.rstrip() | ||
| 92 | result = runCmd("buildhistory-diff -p %s" % get_bb_var('BUILDHISTORY_DIR')) | ||
| 93 | expected_endlines = [ | ||
| 94 | "xcursor-transparent-theme-dev: RRECOMMENDS: removed \"xcursor-transparent-theme (['= %s-r1'])\", added \"xcursor-transparent-theme (['= %s-r0'])\"" % (pkgv, pkgv), | ||
| 95 | "xcursor-transparent-theme-staticdev: RDEPENDS: removed \"xcursor-transparent-theme-dev (['= %s-r1'])\", added \"xcursor-transparent-theme-dev (['= %s-r0'])\"" % (pkgv, pkgv) | ||
| 96 | ] | ||
| 97 | for line in result.output.splitlines(): | ||
| 98 | for el in expected_endlines: | ||
| 99 | if line.endswith(el): | ||
| 100 | expected_endlines.remove(el) | ||
| 101 | break | ||
| 102 | else: | ||
| 103 | self.fail('Unexpected line:\n%s\nExpected line endings:\n %s' % (line, '\n '.join(expected_endlines))) | ||
| 104 | if expected_endlines: | ||
| 105 | self.fail('Missing expected line endings:\n %s' % '\n '.join(expected_endlines)) \ No newline at end of file | ||
diff --git a/meta/lib/oeqa/selftest/cases/buildoptions.py b/meta/lib/oeqa/selftest/cases/buildoptions.py index b509bcf951..767e19bd88 100644 --- a/meta/lib/oeqa/selftest/cases/buildoptions.py +++ b/meta/lib/oeqa/selftest/cases/buildoptions.py | |||
| @@ -10,7 +10,6 @@ import glob as g | |||
| 10 | import shutil | 10 | import shutil |
| 11 | import tempfile | 11 | import tempfile |
| 12 | from oeqa.selftest.case import OESelftestTestCase | 12 | from oeqa.selftest.case import OESelftestTestCase |
| 13 | from oeqa.selftest.cases.buildhistory import BuildhistoryBase | ||
| 14 | from oeqa.core.decorator.data import skipIfMachine | 13 | from oeqa.core.decorator.data import skipIfMachine |
| 15 | from oeqa.utils.commands import bitbake, get_bb_var, get_bb_vars | 14 | from oeqa.utils.commands import bitbake, get_bb_var, get_bb_vars |
| 16 | import oeqa.utils.ftools as ftools | 15 | import oeqa.utils.ftools as ftools |
| @@ -139,43 +138,6 @@ class SanityOptionsTest(OESelftestTestCase): | |||
| 139 | 138 | ||
| 140 | self.assertNotIn(err, ret.output) | 139 | self.assertNotIn(err, ret.output) |
| 141 | 140 | ||
| 142 | |||
| 143 | class BuildhistoryTests(BuildhistoryBase): | ||
| 144 | |||
| 145 | def test_buildhistory_basic(self): | ||
| 146 | self.run_buildhistory_operation('xcursor-transparent-theme') | ||
| 147 | self.assertTrue(os.path.isdir(get_bb_var('BUILDHISTORY_DIR')), "buildhistory dir was not created.") | ||
| 148 | |||
| 149 | def test_buildhistory_buildtime_pr_backwards(self): | ||
| 150 | target = 'xcursor-transparent-theme' | ||
| 151 | error = "ERROR:.*QA Issue: Package version for package %s went backwards which would break package feeds \(from .*-r1.* to .*-r0.*\)" % target | ||
| 152 | self.run_buildhistory_operation(target, target_config="PR = \"r1\"", change_bh_location=True) | ||
| 153 | self.run_buildhistory_operation(target, target_config="PR = \"r0\"", change_bh_location=False, expect_error=True, error_regex=error) | ||
| 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'], '/usr/share/pkgconfig/default-icon-theme.pc') | ||
| 177 | self.assertGreater(int(data['PKGSIZE']), 0) | ||
| 178 | |||
| 179 | class ArchiverTest(OESelftestTestCase): | 141 | class ArchiverTest(OESelftestTestCase): |
| 180 | def test_arch_work_dir_and_export_source(self): | 142 | def test_arch_work_dir_and_export_source(self): |
| 181 | """ | 143 | """ |
diff --git a/meta/lib/oeqa/selftest/cases/oescripts.py b/meta/lib/oeqa/selftest/cases/oescripts.py index bfbc33b08d..3f9899b289 100644 --- a/meta/lib/oeqa/selftest/cases/oescripts.py +++ b/meta/lib/oeqa/selftest/cases/oescripts.py | |||
| @@ -9,33 +9,9 @@ import shutil | |||
| 9 | import importlib | 9 | import importlib |
| 10 | import unittest | 10 | import unittest |
| 11 | from oeqa.selftest.case import OESelftestTestCase | 11 | from oeqa.selftest.case import OESelftestTestCase |
| 12 | from oeqa.selftest.cases.buildhistory import BuildhistoryBase | ||
| 13 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var | 12 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var |
| 14 | from oeqa.utils import CommandError | 13 | from oeqa.utils import CommandError |
| 15 | 14 | ||
| 16 | class BuildhistoryDiffTests(BuildhistoryBase): | ||
| 17 | |||
| 18 | def test_buildhistory_diff(self): | ||
| 19 | target = 'xcursor-transparent-theme' | ||
| 20 | self.run_buildhistory_operation(target, target_config="PR = \"r1\"", change_bh_location=True) | ||
| 21 | self.run_buildhistory_operation(target, target_config="PR = \"r0\"", change_bh_location=False, expect_error=True) | ||
| 22 | result = runCmd("oe-pkgdata-util read-value PKGV %s" % target) | ||
| 23 | pkgv = result.output.rstrip() | ||
| 24 | result = runCmd("buildhistory-diff -p %s" % get_bb_var('BUILDHISTORY_DIR')) | ||
| 25 | expected_endlines = [ | ||
| 26 | "xcursor-transparent-theme-dev: RRECOMMENDS: removed \"xcursor-transparent-theme (['= %s-r1'])\", added \"xcursor-transparent-theme (['= %s-r0'])\"" % (pkgv, pkgv), | ||
| 27 | "xcursor-transparent-theme-staticdev: RDEPENDS: removed \"xcursor-transparent-theme-dev (['= %s-r1'])\", added \"xcursor-transparent-theme-dev (['= %s-r0'])\"" % (pkgv, pkgv) | ||
| 28 | ] | ||
| 29 | for line in result.output.splitlines(): | ||
| 30 | for el in expected_endlines: | ||
| 31 | if line.endswith(el): | ||
| 32 | expected_endlines.remove(el) | ||
| 33 | break | ||
| 34 | else: | ||
| 35 | self.fail('Unexpected line:\n%s\nExpected line endings:\n %s' % (line, '\n '.join(expected_endlines))) | ||
| 36 | if expected_endlines: | ||
| 37 | self.fail('Missing expected line endings:\n %s' % '\n '.join(expected_endlines)) | ||
| 38 | |||
| 39 | @unittest.skipUnless(importlib.util.find_spec("cairo"), "Python cairo module is not present") | 15 | @unittest.skipUnless(importlib.util.find_spec("cairo"), "Python cairo module is not present") |
| 40 | class OEPybootchartguyTests(OESelftestTestCase): | 16 | class OEPybootchartguyTests(OESelftestTestCase): |
| 41 | 17 | ||
