diff options
| author | Joshua Watt <JPEWhacker@gmail.com> | 2019-10-24 13:07:19 -0500 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-11-07 22:30:39 +0000 |
| commit | 57ea3e78bd0e4ba68e47001d8b261854749c29fa (patch) | |
| tree | b6462f93dcd35938695a3ad71d8a5b7572010fcf | |
| parent | cad52f5eb7c50d88ad8c612f52beead15c860e71 (diff) | |
| download | poky-57ea3e78bd0e4ba68e47001d8b261854749c29fa.tar.gz | |
oeqa: reproducible: Add option to capture bad packages
Adds an option that can be used to copy the offending packages to a temp
directory for later evaluation. This is useful on the Autobuilder to
investigate failures.
(From OE-Core rev: 54b29bae78d1711074fbd18f0350ef0b83b555d1)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/reproducible.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/reproducible.py b/meta/lib/oeqa/selftest/cases/reproducible.py index c235c139ed..a9110565a9 100644 --- a/meta/lib/oeqa/selftest/cases/reproducible.py +++ b/meta/lib/oeqa/selftest/cases/reproducible.py | |||
| @@ -5,11 +5,16 @@ | |||
| 5 | 5 | ||
| 6 | from oeqa.selftest.case import OESelftestTestCase | 6 | from oeqa.selftest.case import OESelftestTestCase |
| 7 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars | 7 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars |
| 8 | import bb.utils | ||
| 8 | import functools | 9 | import functools |
| 9 | import multiprocessing | 10 | import multiprocessing |
| 10 | import textwrap | 11 | import textwrap |
| 11 | import json | 12 | import json |
| 12 | import unittest | 13 | import unittest |
| 14 | import tempfile | ||
| 15 | import shutil | ||
| 16 | import stat | ||
| 17 | import os | ||
| 13 | 18 | ||
| 14 | MISSING = 'MISSING' | 19 | MISSING = 'MISSING' |
| 15 | DIFFERENT = 'DIFFERENT' | 20 | DIFFERENT = 'DIFFERENT' |
| @@ -74,6 +79,7 @@ def compare_file(reference, test, diffutils_sysroot): | |||
| 74 | class ReproducibleTests(OESelftestTestCase): | 79 | class ReproducibleTests(OESelftestTestCase): |
| 75 | package_classes = ['deb', 'ipk'] | 80 | package_classes = ['deb', 'ipk'] |
| 76 | images = ['core-image-minimal'] | 81 | images = ['core-image-minimal'] |
| 82 | save_results = False | ||
| 77 | 83 | ||
| 78 | def setUpLocal(self): | 84 | def setUpLocal(self): |
| 79 | super().setUpLocal() | 85 | super().setUpLocal() |
| @@ -117,9 +123,18 @@ class ReproducibleTests(OESelftestTestCase): | |||
| 117 | self.extrasresults['reproducible']['files'].setdefault(package_class, {})[name] = [ | 123 | self.extrasresults['reproducible']['files'].setdefault(package_class, {})[name] = [ |
| 118 | {'reference': p.reference, 'test': p.test} for p in packages] | 124 | {'reference': p.reference, 'test': p.test} for p in packages] |
| 119 | 125 | ||
| 126 | def copy_file(self, source, dest): | ||
| 127 | bb.utils.mkdirhier(os.path.dirname(dest)) | ||
| 128 | shutil.copyfile(source, dest) | ||
| 129 | |||
| 120 | def test_reproducible_builds(self): | 130 | def test_reproducible_builds(self): |
| 121 | capture_vars = ['DEPLOY_DIR_' + c.upper() for c in self.package_classes] | 131 | capture_vars = ['DEPLOY_DIR_' + c.upper() for c in self.package_classes] |
| 122 | 132 | ||
| 133 | if self.save_results: | ||
| 134 | save_dir = tempfile.mkdtemp(prefix='oe-reproducible-') | ||
| 135 | os.chmod(save_dir, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH) | ||
| 136 | self.logger.info('Non-reproducible packages will be copied to %s', save_dir) | ||
| 137 | |||
| 123 | # Build native utilities | 138 | # Build native utilities |
| 124 | self.write_config('') | 139 | self.write_config('') |
| 125 | bitbake("diffutils-native -c addto_recipe_sysroot") | 140 | bitbake("diffutils-native -c addto_recipe_sysroot") |
| @@ -176,6 +191,11 @@ class ReproducibleTests(OESelftestTestCase): | |||
| 176 | self.write_package_list(package_class, 'different', result.different) | 191 | self.write_package_list(package_class, 'different', result.different) |
| 177 | self.write_package_list(package_class, 'same', result.same) | 192 | self.write_package_list(package_class, 'same', result.same) |
| 178 | 193 | ||
| 194 | if self.save_results: | ||
| 195 | for d in result.different: | ||
| 196 | self.copy_file(d.reference, '/'.join([save_dir, d.reference])) | ||
| 197 | self.copy_file(d.test, '/'.join([save_dir, d.test])) | ||
| 198 | |||
| 179 | if result.missing or result.different: | 199 | if result.missing or result.different: |
| 180 | self.fail("The following %s packages are missing or different: %s" % | 200 | self.fail("The following %s packages are missing or different: %s" % |
| 181 | (c, ' '.join(r.test for r in (result.missing + result.different)))) | 201 | (c, ' '.join(r.test for r in (result.missing + result.different)))) |
