summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorJoshua Watt <jpewhacker@gmail.com>2020-02-11 21:14:35 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-02-14 13:07:23 +0000
commitd59bfa1334bd635bc1537ca20e58e624693167f1 (patch)
treefdd2fdb5a4ccb38938eceef02010af83531832e9 /meta
parent2c3b751a1277797a7ab1cd5fee44486b596fa8de (diff)
downloadpoky-d59bfa1334bd635bc1537ca20e58e624693167f1.tar.gz
oeqa: reproducible: Run diffoscope on saved output
If there are differing packages and they are being saved for review, automatically run diffoscope on them and include the output in the saved output. The output is currently done in HTML format since these are typically published on a webpage by the autobuilder. (From OE-Core rev: 6e1d5e8b58f0940ba6dfd99536159dd974e6f24c) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/selftest/cases/reproducible.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/meta/lib/oeqa/selftest/cases/reproducible.py b/meta/lib/oeqa/selftest/cases/reproducible.py
index f6433c9a02..d3fd8c392b 100644
--- a/meta/lib/oeqa/selftest/cases/reproducible.py
+++ b/meta/lib/oeqa/selftest/cases/reproducible.py
@@ -1,7 +1,7 @@
1# 1#
2# SPDX-License-Identifier: MIT 2# SPDX-License-Identifier: MIT
3# 3#
4# Copyright 2019 by Garmin Ltd. or its subsidiaries 4# Copyright 2019-2020 by Garmin Ltd. or its subsidiaries
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
@@ -167,10 +167,16 @@ class ReproducibleTests(OESelftestTestCase):
167 return d 167 return d
168 168
169 def test_reproducible_builds(self): 169 def test_reproducible_builds(self):
170 def strip_topdir(s):
171 if s.startswith(self.topdir):
172 return s[len(self.topdir):]
173 return s
174
170 # Build native utilities 175 # Build native utilities
171 self.write_config('') 176 self.write_config('')
172 bitbake("diffutils-native -c addto_recipe_sysroot") 177 bitbake("diffoscope-native diffutils-native -c addto_recipe_sysroot")
173 diffutils_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "diffutils-native") 178 diffutils_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "diffutils-native")
179 diffoscope_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "diffoscope-native")
174 180
175 if self.save_results: 181 if self.save_results:
176 os.makedirs(self.save_results, exist_ok=True) 182 os.makedirs(self.save_results, exist_ok=True)
@@ -206,18 +212,22 @@ class ReproducibleTests(OESelftestTestCase):
206 212
207 if self.save_results: 213 if self.save_results:
208 for d in result.different: 214 for d in result.different:
209 self.copy_file(d.reference, '/'.join([save_dir, d.reference])) 215 self.copy_file(d.reference, '/'.join([save_dir, 'packages', strip_topdir(d.reference)]))
210 self.copy_file(d.test, '/'.join([save_dir, d.test])) 216 self.copy_file(d.test, '/'.join([save_dir, 'packages', strip_topdir(d.test)]))
211 217
212 if result.missing or result.different: 218 if result.missing or result.different:
213 fails.append("The following %s packages are missing or different: %s" % 219 fails.append("The following %s packages are missing or different: %s" %
214 (c, '\n'.join(r.test for r in (result.missing + result.different)))) 220 (c, '\n'.join(r.test for r in (result.missing + result.different))))
215 221
216 if fails:
217 self.fail('\n'.join(fails))
218
219 # Clean up empty directories 222 # Clean up empty directories
220 if self.save_results: 223 if self.save_results:
221 if not os.listdir(save_dir): 224 if not os.listdir(save_dir):
222 os.rmdir(save_dir) 225 os.rmdir(save_dir)
226 else:
227 self.logger.info('Running diffoscope')
228 runCmd(['diffoscope', '--no-default-limits', '--exclude-directory-metadata', '--html-dir', 'diff-html', 'reproducibleA', 'reproducibleB'],
229 native_sysroot=diffoscope_sysroot, ignore_status=True, cwd=os.path.join(save_dir, 'packages'))
230
231 if fails:
232 self.fail('\n'.join(fails))
223 233