diff options
| author | Yoann Congal <yoann.congal@smile.fr> | 2025-05-23 21:24:29 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-05-27 09:01:16 +0100 |
| commit | aa48208d573900106f8f478f9278450c202d9456 (patch) | |
| tree | 29a3873a77d9976b92fed8a0a2aa1b230ccb567c /meta | |
| parent | 77b7006d7700e413ca363631fbd652fb88e46c20 (diff) | |
| download | poky-aa48208d573900106f8f478f9278450c202d9456.tar.gz | |
selftest/reproducible: Limit memory used by diffoscope
When working on large diffs (eg in meta-oe's repro test) diffoscope may
use a huge amount of memory and trigger OOM kills on parallel builds.
Use the max_diff_block_lines_saved option to limit to 1024 the number of
diff lines saved in a block. Also, limit the number of line in the
report to generate a report even when the limit is reached.
The chosen default 1024 comes from diffoscope default for a diff block.
For a random 10MB binary (packaged in ipk, deb and rpm), this does
decrease the "Maximum resident set size" of diffoscope from 1.3GB to
400MB.
As an added bonus, this also make diffoscope bail out earlier, on the
same example: execution time goes from 30 minutes down to 7.
Fixes [YOCTO #15876]
(From OE-Core rev: 04cbcfc7e09d19b0ba50e7940fc82d10e222fdbe)
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/reproducible.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/meta/lib/oeqa/selftest/cases/reproducible.py b/meta/lib/oeqa/selftest/cases/reproducible.py index 1e094892e9..f06027cb03 100644 --- a/meta/lib/oeqa/selftest/cases/reproducible.py +++ b/meta/lib/oeqa/selftest/cases/reproducible.py | |||
| @@ -97,8 +97,10 @@ def compare_file(reference, test, diffutils_sysroot): | |||
| 97 | result.status = SAME | 97 | result.status = SAME |
| 98 | return result | 98 | return result |
| 99 | 99 | ||
| 100 | def run_diffoscope(a_dir, b_dir, html_dir, max_report_size=0, **kwargs): | 100 | def run_diffoscope(a_dir, b_dir, html_dir, max_report_size=0, max_diff_block_lines=1024, max_diff_block_lines_saved=0, **kwargs): |
| 101 | return runCmd(['diffoscope', '--no-default-limits', '--max-report-size', str(max_report_size), | 101 | return runCmd(['diffoscope', '--no-default-limits', '--max-report-size', str(max_report_size), |
| 102 | '--max-diff-block-lines-saved', str(max_diff_block_lines_saved), | ||
| 103 | '--max-diff-block-lines', str(max_diff_block_lines), | ||
| 102 | '--exclude-directory-metadata', 'yes', '--html-dir', html_dir, a_dir, b_dir], | 104 | '--exclude-directory-metadata', 'yes', '--html-dir', html_dir, a_dir, b_dir], |
| 103 | **kwargs) | 105 | **kwargs) |
| 104 | 106 | ||
| @@ -132,6 +134,11 @@ class ReproducibleTests(OESelftestTestCase): | |||
| 132 | # Maximum report size, in bytes | 134 | # Maximum report size, in bytes |
| 133 | max_report_size = 250 * 1024 * 1024 | 135 | max_report_size = 250 * 1024 * 1024 |
| 134 | 136 | ||
| 137 | # Maximum diff blocks size, in lines | ||
| 138 | max_diff_block_lines = 1024 | ||
| 139 | # Maximum diff blocks size (saved in memory), in lines | ||
| 140 | max_diff_block_lines_saved = max_diff_block_lines | ||
| 141 | |||
| 135 | # targets are the things we want to test the reproducibility of | 142 | # targets are the things we want to test the reproducibility of |
| 136 | # Have to add the virtual targets manually for now as builds may or may not include them as they're exclude from world | 143 | # Have to add the virtual targets manually for now as builds may or may not include them as they're exclude from world |
| 137 | targets = ['core-image-minimal', 'core-image-sato', 'core-image-full-cmdline', 'core-image-weston', 'world', 'virtual/librpc', 'virtual/libsdl2', 'virtual/crypt'] | 144 | targets = ['core-image-minimal', 'core-image-sato', 'core-image-full-cmdline', 'core-image-weston', 'world', 'virtual/librpc', 'virtual/libsdl2', 'virtual/crypt'] |
| @@ -391,6 +398,8 @@ class ReproducibleTests(OESelftestTestCase): | |||
| 391 | self.copy_file(os.path.join(jquery_sysroot, 'usr/share/javascript/jquery/jquery.min.js'), os.path.join(package_html_dir, 'jquery.js')) | 398 | self.copy_file(os.path.join(jquery_sysroot, 'usr/share/javascript/jquery/jquery.min.js'), os.path.join(package_html_dir, 'jquery.js')) |
| 392 | 399 | ||
| 393 | run_diffoscope('reproducibleA', 'reproducibleB-extended', package_html_dir, max_report_size=self.max_report_size, | 400 | run_diffoscope('reproducibleA', 'reproducibleB-extended', package_html_dir, max_report_size=self.max_report_size, |
| 401 | max_diff_block_lines_saved=self.max_diff_block_lines_saved, | ||
| 402 | max_diff_block_lines=self.max_diff_block_lines, | ||
| 394 | native_sysroot=diffoscope_sysroot, ignore_status=True, cwd=package_dir) | 403 | native_sysroot=diffoscope_sysroot, ignore_status=True, cwd=package_dir) |
| 395 | 404 | ||
| 396 | if fails: | 405 | if fails: |
