diff options
| author | Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> | 2017-08-08 09:57:17 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-08-13 09:27:38 +0100 |
| commit | d6823e947bd7447f960219f7a84ca3d0d04a021d (patch) | |
| tree | 916c696c7ca41b479b0df44d96c8922d8631b246 /meta/lib/oeqa | |
| parent | 6309590b39731a9c58bc2da5e0b25e2b027c2b9f (diff) | |
| download | poky-d6823e947bd7447f960219f7a84ca3d0d04a021d.tar.gz | |
sstatetests: limit the number of signature comparisons when differ
For perfomance reasons, limit the number of signature comparisons when
stamps differ. The limit set is hardcoded to 20.
[YOCTO #11651]
(From OE-Core rev: a2e2f434cd8d68b69e1ccdb7d7c17c0c73289866)
Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/sstatetests.py | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/meta/lib/oeqa/selftest/cases/sstatetests.py b/meta/lib/oeqa/selftest/cases/sstatetests.py index 0b36027918..47900886a3 100644 --- a/meta/lib/oeqa/selftest/cases/sstatetests.py +++ b/meta/lib/oeqa/selftest/cases/sstatetests.py | |||
| @@ -458,6 +458,24 @@ http_proxy = "http://example.com/" | |||
| 458 | base = os.sep.join(root.rsplit(os.sep, 2)[-2:] + [name]) | 458 | base = os.sep.join(root.rsplit(os.sep, 2)[-2:] + [name]) |
| 459 | f[base] = shash | 459 | f[base] = shash |
| 460 | return f | 460 | return f |
| 461 | |||
| 462 | def compare_sigfiles(files, files1, files2, compare=False): | ||
| 463 | for k in files: | ||
| 464 | if k in files1 and k in files2: | ||
| 465 | print("%s differs:" % k) | ||
| 466 | if compare: | ||
| 467 | sigdatafile1 = self.topdir + "/tmp-sstatesamehash/stamps/" + k + "." + files1[k] | ||
| 468 | sigdatafile2 = self.topdir + "/tmp-sstatesamehash2/stamps/" + k + "." + files2[k] | ||
| 469 | output = bb.siggen.compare_sigfiles(sigdatafile1, sigdatafile2) | ||
| 470 | if output: | ||
| 471 | print('\n'.join(output)) | ||
| 472 | elif k in files1 and k not in files2: | ||
| 473 | print("%s in files1" % k) | ||
| 474 | elif k not in files1 and k in files2: | ||
| 475 | print("%s in files2" % k) | ||
| 476 | else: | ||
| 477 | assert "shouldn't reach here" | ||
| 478 | |||
| 461 | files1 = get_files(self.topdir + "/tmp-sstatesamehash/stamps/") | 479 | files1 = get_files(self.topdir + "/tmp-sstatesamehash/stamps/") |
| 462 | files2 = get_files(self.topdir + "/tmp-sstatesamehash2/stamps/") | 480 | files2 = get_files(self.topdir + "/tmp-sstatesamehash2/stamps/") |
| 463 | # Remove items that are identical in both sets | 481 | # Remove items that are identical in both sets |
| @@ -468,18 +486,11 @@ http_proxy = "http://example.com/" | |||
| 468 | # No changes, so we're done | 486 | # No changes, so we're done |
| 469 | return | 487 | return |
| 470 | 488 | ||
| 471 | for k in files1.keys() | files2.keys(): | 489 | files = list(files1.keys() | files2.keys()) |
| 472 | if k in files1 and k in files2: | 490 | # this is an expensive computation, thus just compare the first 'max_sigfiles_to_compare' k files |
| 473 | print("%s differs:" % k) | 491 | max_sigfiles_to_compare = 20 |
| 474 | sigdatafile1 = self.topdir + "/tmp-sstatesamehash/stamps/" + k + "." + files1[k] | 492 | first, rest = files[:max_sigfiles_to_compare], files[max_sigfiles_to_compare:] |
| 475 | sigdatafile2 = self.topdir + "/tmp-sstatesamehash2/stamps/" + k + "." + files2[k] | 493 | compare_sigfiles(first, files1.keys(), files2.keys(), compare=True) |
| 476 | output = bb.siggen.compare_sigfiles(sigdatafile1, sigdatafile2) | 494 | compare_sigfiles(rest, files1.keys(), files2.keys(), compare=False) |
| 477 | if output: | 495 | |
| 478 | print('\n'.join(output)) | ||
| 479 | elif k in files1 and k not in files2: | ||
| 480 | print("%s in files1" % k) | ||
| 481 | elif k not in files1 and k in files2: | ||
| 482 | print("%s in files2" % k) | ||
| 483 | else: | ||
| 484 | assert "shouldn't reach here" | ||
| 485 | self.fail("sstate hashes not identical.") | 496 | self.fail("sstate hashes not identical.") |
