diff options
| -rw-r--r-- | meta/lib/oeqa/selftest/sstatetests.py | 80 |
1 files changed, 68 insertions, 12 deletions
diff --git a/meta/lib/oeqa/selftest/sstatetests.py b/meta/lib/oeqa/selftest/sstatetests.py index c02d16dbc9..d41b1d3a76 100644 --- a/meta/lib/oeqa/selftest/sstatetests.py +++ b/meta/lib/oeqa/selftest/sstatetests.py | |||
| @@ -4,6 +4,7 @@ import os | |||
| 4 | import re | 4 | import re |
| 5 | import shutil | 5 | import shutil |
| 6 | import glob | 6 | import glob |
| 7 | import subprocess | ||
| 7 | 8 | ||
| 8 | import oeqa.utils.ftools as ftools | 9 | import oeqa.utils.ftools as ftools |
| 9 | from oeqa.selftest.base import oeSelfTest | 10 | from oeqa.selftest.base import oeSelfTest |
| @@ -226,9 +227,6 @@ class SStateTests(SStateBase): | |||
| 226 | they're built on a 32 or 64 bit system. Rather than requiring two different | 227 | they're built on a 32 or 64 bit system. Rather than requiring two different |
| 227 | build machines and running a builds, override the variables calling uname() | 228 | build machines and running a builds, override the variables calling uname() |
| 228 | manually and check using bitbake -S. | 229 | manually and check using bitbake -S. |
| 229 | |||
| 230 | Also check that SDKMACHINE and PARALLEL_MAKE changing doesn't change any | ||
| 231 | of these stamps. | ||
| 232 | """ | 230 | """ |
| 233 | 231 | ||
| 234 | topdir = get_bb_var('TOPDIR') | 232 | topdir = get_bb_var('TOPDIR') |
| @@ -239,9 +237,6 @@ TMPDIR = "${TOPDIR}/tmp-sstatesamehash" | |||
| 239 | BUILD_ARCH = "x86_64" | 237 | BUILD_ARCH = "x86_64" |
| 240 | BUILD_OS = "linux" | 238 | BUILD_OS = "linux" |
| 241 | SDKMACHINE = "x86_64" | 239 | SDKMACHINE = "x86_64" |
| 242 | PARALLEL_MAKE = "-j 1" | ||
| 243 | DL_DIR = "${TOPDIR}/download1" | ||
| 244 | TIME = "111111" | ||
| 245 | """) | 240 | """) |
| 246 | self.track_for_cleanup(topdir + "/tmp-sstatesamehash") | 241 | self.track_for_cleanup(topdir + "/tmp-sstatesamehash") |
| 247 | bitbake("core-image-sato -S none") | 242 | bitbake("core-image-sato -S none") |
| @@ -251,9 +246,6 @@ TMPDIR = "${TOPDIR}/tmp-sstatesamehash2" | |||
| 251 | BUILD_ARCH = "i686" | 246 | BUILD_ARCH = "i686" |
| 252 | BUILD_OS = "linux" | 247 | BUILD_OS = "linux" |
| 253 | SDKMACHINE = "i686" | 248 | SDKMACHINE = "i686" |
| 254 | PARALLEL_MAKE = "-j 2" | ||
| 255 | DL_DIR = "${TOPDIR}/download2" | ||
| 256 | TIME = "222222" | ||
| 257 | """) | 249 | """) |
| 258 | self.track_for_cleanup(topdir + "/tmp-sstatesamehash2") | 250 | self.track_for_cleanup(topdir + "/tmp-sstatesamehash2") |
| 259 | bitbake("core-image-sato -S none") | 251 | bitbake("core-image-sato -S none") |
| @@ -279,7 +271,7 @@ TIME = "222222" | |||
| 279 | def test_sstate_nativelsbstring_same_hash(self): | 271 | def test_sstate_nativelsbstring_same_hash(self): |
| 280 | """ | 272 | """ |
| 281 | The sstate checksums should be independent of whichever NATIVELSBSTRING is | 273 | The sstate checksums should be independent of whichever NATIVELSBSTRING is |
| 282 | detected. Rather than requiring two different build machines and running | 274 | detected. Rather than requiring two different build machines and running |
| 283 | builds, override the variables manually and check using bitbake -S. | 275 | builds, override the variables manually and check using bitbake -S. |
| 284 | """ | 276 | """ |
| 285 | 277 | ||
| @@ -311,7 +303,7 @@ NATIVELSBSTRING = \"DistroB\" | |||
| 311 | @testcase(1368) | 303 | @testcase(1368) |
| 312 | def test_sstate_allarch_samesigs(self): | 304 | def test_sstate_allarch_samesigs(self): |
| 313 | """ | 305 | """ |
| 314 | The sstate checksums of allarch packages should be independent of whichever | 306 | The sstate checksums of allarch packages should be independent of whichever |
| 315 | MACHINE is set. Check this using bitbake -S. | 307 | MACHINE is set. Check this using bitbake -S. |
| 316 | Also, rather than duplicate the test, check nativesdk stamps are the same between | 308 | Also, rather than duplicate the test, check nativesdk stamps are the same between |
| 317 | the two MACHINE values. | 309 | the two MACHINE values. |
| @@ -359,7 +351,7 @@ MACHINE = \"qemuarm\" | |||
| 359 | @testcase(1369) | 351 | @testcase(1369) |
| 360 | def test_sstate_sametune_samesigs(self): | 352 | def test_sstate_sametune_samesigs(self): |
| 361 | """ | 353 | """ |
| 362 | The sstate checksums of two identical machines (using the same tune) should be the | 354 | The sstate checksums of two identical machines (using the same tune) should be the |
| 363 | same, apart from changes within the machine specific stamps directory. We use the | 355 | same, apart from changes within the machine specific stamps directory. We use the |
| 364 | qemux86copy machine to test this. Also include multilibs in the test. | 356 | qemux86copy machine to test this. Also include multilibs in the test. |
| 365 | """ | 357 | """ |
| @@ -402,3 +394,67 @@ DEFAULTTUNE_virtclass-multilib-lib32 = "x86" | |||
| 402 | files2 = [x.replace("tmp-sstatesamehash2", "tmp-sstatesamehash") for x in files2] | 394 | files2 = [x.replace("tmp-sstatesamehash2", "tmp-sstatesamehash") for x in files2] |
| 403 | self.maxDiff = None | 395 | self.maxDiff = None |
| 404 | self.assertItemsEqual(files1, files2) | 396 | self.assertItemsEqual(files1, files2) |
| 397 | |||
| 398 | |||
| 399 | def test_sstate_noop_samesigs(self): | ||
| 400 | """ | ||
| 401 | The sstate checksums of two builds with these variables changed or | ||
| 402 | classes inherits should be the same. | ||
| 403 | """ | ||
| 404 | |||
| 405 | topdir = get_bb_var('TOPDIR') | ||
| 406 | targetvendor = get_bb_var('TARGET_VENDOR') | ||
| 407 | self.write_config(""" | ||
| 408 | TMPDIR = "${TOPDIR}/tmp-sstatesamehash" | ||
| 409 | BB_NUMBER_THREADS = "1" | ||
| 410 | PARALLEL_MAKE = "-j 1" | ||
| 411 | DL_DIR = "${TOPDIR}/download1" | ||
| 412 | TIME = "111111" | ||
| 413 | DATE = "20161111" | ||
| 414 | """) | ||
| 415 | self.track_for_cleanup(topdir + "/tmp-sstatesamehash") | ||
| 416 | bitbake("world meta-toolchain -S none") | ||
| 417 | self.write_config(""" | ||
| 418 | TMPDIR = "${TOPDIR}/tmp-sstatesamehash2" | ||
| 419 | BB_NUMBER_THREADS = "2" | ||
| 420 | PARALLEL_MAKE = "-j 2" | ||
| 421 | DL_DIR = "${TOPDIR}/download2" | ||
| 422 | TIME = "222222" | ||
| 423 | DATE = "20161212" | ||
| 424 | INHERIT += "buildstats-summary buildhistory" | ||
| 425 | """) | ||
| 426 | self.track_for_cleanup(topdir + "/tmp-sstatesamehash2") | ||
| 427 | bitbake("world meta-toolchain -S none") | ||
| 428 | |||
| 429 | def get_files(d): | ||
| 430 | f = {} | ||
| 431 | for root, dirs, files in os.walk(d): | ||
| 432 | for name in files: | ||
| 433 | name, shash = name.rsplit('.', 1) | ||
| 434 | # Extract just the machine and recipe name | ||
| 435 | base = os.sep.join(root.rsplit(os.sep, 2)[-2:] + [name]) | ||
| 436 | f[base] = shash | ||
| 437 | return f | ||
| 438 | files1 = get_files(topdir + "/tmp-sstatesamehash/stamps/") | ||
| 439 | files2 = get_files(topdir + "/tmp-sstatesamehash2/stamps/") | ||
| 440 | # Remove items that are identical in both sets | ||
| 441 | for k,v in files1.viewitems() & files2.viewitems(): | ||
| 442 | del files1[k] | ||
| 443 | del files2[k] | ||
| 444 | if not files1 and not files2: | ||
| 445 | # No changes, so we're done | ||
| 446 | return | ||
| 447 | |||
| 448 | for k in files1.viewkeys() | files2.viewkeys(): | ||
| 449 | if k in files1 and k in files2: | ||
| 450 | print "%s differs:" % k | ||
| 451 | print subprocess.check_output(("bitbake-diffsigs", | ||
| 452 | topdir + "/tmp-sstatesamehash/stamps/" + k + "." + files1[k], | ||
| 453 | topdir + "/tmp-sstatesamehash2/stamps/" + k + "." + files2[k])) | ||
| 454 | elif k in files1 and k not in files2: | ||
| 455 | print "%s in files1" % k | ||
| 456 | elif k not in files1 and k in files2: | ||
| 457 | print "%s in files2" % k | ||
| 458 | else: | ||
| 459 | assert "shouldn't reach here" | ||
| 460 | self.fail("sstate hashes not identical.") | ||
