diff options
author | Joshua Watt <JPEWhacker@gmail.com> | 2019-11-24 08:25:16 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-11-25 21:34:50 +0000 |
commit | f1098122e178a9ef651ea3acca4a19b4e5f02a5f (patch) | |
tree | 60c6263aef340b6a2fb07c82f57fbdbb5f8b1795 /meta | |
parent | c84b0dbcd8a36a216a5c7719b462f4d813baa6bc (diff) | |
download | poky-f1098122e178a9ef651ea3acca4a19b4e5f02a5f.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: 91d657a0c4cbb273e1e74d38bfd6b4b05d9b372e)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-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)))) |