1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-01 13:09:50 +00:00

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>
This commit is contained in:
Joshua Watt
2019-11-24 08:25:16 -08:00
committed by Richard Purdie
parent c84b0dbcd8
commit f1098122e1
@@ -5,11 +5,16 @@
from oeqa.selftest.case import OESelftestTestCase from oeqa.selftest.case import OESelftestTestCase
from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars
import bb.utils
import functools import functools
import multiprocessing import multiprocessing
import textwrap import textwrap
import json import json
import unittest import unittest
import tempfile
import shutil
import stat
import os
MISSING = 'MISSING' MISSING = 'MISSING'
DIFFERENT = 'DIFFERENT' DIFFERENT = 'DIFFERENT'
@@ -74,6 +79,7 @@ def compare_file(reference, test, diffutils_sysroot):
class ReproducibleTests(OESelftestTestCase): class ReproducibleTests(OESelftestTestCase):
package_classes = ['deb', 'ipk'] package_classes = ['deb', 'ipk']
images = ['core-image-minimal'] images = ['core-image-minimal']
save_results = False
def setUpLocal(self): def setUpLocal(self):
super().setUpLocal() super().setUpLocal()
@@ -117,9 +123,18 @@ class ReproducibleTests(OESelftestTestCase):
self.extrasresults['reproducible']['files'].setdefault(package_class, {})[name] = [ self.extrasresults['reproducible']['files'].setdefault(package_class, {})[name] = [
{'reference': p.reference, 'test': p.test} for p in packages] {'reference': p.reference, 'test': p.test} for p in packages]
def copy_file(self, source, dest):
bb.utils.mkdirhier(os.path.dirname(dest))
shutil.copyfile(source, dest)
def test_reproducible_builds(self): def test_reproducible_builds(self):
capture_vars = ['DEPLOY_DIR_' + c.upper() for c in self.package_classes] capture_vars = ['DEPLOY_DIR_' + c.upper() for c in self.package_classes]
if self.save_results:
save_dir = tempfile.mkdtemp(prefix='oe-reproducible-')
os.chmod(save_dir, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH)
self.logger.info('Non-reproducible packages will be copied to %s', save_dir)
# Build native utilities # Build native utilities
self.write_config('') self.write_config('')
bitbake("diffutils-native -c addto_recipe_sysroot") bitbake("diffutils-native -c addto_recipe_sysroot")
@@ -176,6 +191,11 @@ class ReproducibleTests(OESelftestTestCase):
self.write_package_list(package_class, 'different', result.different) self.write_package_list(package_class, 'different', result.different)
self.write_package_list(package_class, 'same', result.same) self.write_package_list(package_class, 'same', result.same)
if self.save_results:
for d in result.different:
self.copy_file(d.reference, '/'.join([save_dir, d.reference]))
self.copy_file(d.test, '/'.join([save_dir, d.test]))
if result.missing or result.different: if result.missing or result.different:
self.fail("The following %s packages are missing or different: %s" % self.fail("The following %s packages are missing or different: %s" %
(c, ' '.join(r.test for r in (result.missing + result.different)))) (c, ' '.join(r.test for r in (result.missing + result.different))))