summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/selftest/cases/reproducible.py20
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
6from oeqa.selftest.case import OESelftestTestCase 6from oeqa.selftest.case import OESelftestTestCase
7from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars 7from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars
8import bb.utils
8import functools 9import functools
9import multiprocessing 10import multiprocessing
10import textwrap 11import textwrap
11import json 12import json
12import unittest 13import unittest
14import tempfile
15import shutil
16import stat
17import os
13 18
14MISSING = 'MISSING' 19MISSING = 'MISSING'
15DIFFERENT = 'DIFFERENT' 20DIFFERENT = 'DIFFERENT'
@@ -74,6 +79,7 @@ def compare_file(reference, test, diffutils_sysroot):
74class ReproducibleTests(OESelftestTestCase): 79class 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))))