diff options
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/sstatetests.py')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/sstatetests.py | 174 |
1 files changed, 78 insertions, 96 deletions
diff --git a/meta/lib/oeqa/selftest/cases/sstatetests.py b/meta/lib/oeqa/selftest/cases/sstatetests.py index 86d6cd7464..08f94b168a 100644 --- a/meta/lib/oeqa/selftest/cases/sstatetests.py +++ b/meta/lib/oeqa/selftest/cases/sstatetests.py | |||
@@ -27,17 +27,15 @@ class SStateBase(OESelftestTestCase): | |||
27 | def setUpLocal(self): | 27 | def setUpLocal(self): |
28 | super(SStateBase, self).setUpLocal() | 28 | super(SStateBase, self).setUpLocal() |
29 | self.temp_sstate_location = None | 29 | self.temp_sstate_location = None |
30 | needed_vars = ['SSTATE_DIR', 'NATIVELSBSTRING', 'TCLIBC', 'TUNE_ARCH', | 30 | needed_vars = ['SSTATE_DIR', 'TCLIBC', 'TUNE_ARCH', |
31 | 'TOPDIR', 'TARGET_VENDOR', 'TARGET_OS'] | 31 | 'TOPDIR', 'TARGET_VENDOR', 'TARGET_OS'] |
32 | bb_vars = get_bb_vars(needed_vars) | 32 | bb_vars = get_bb_vars(needed_vars) |
33 | self.sstate_path = bb_vars['SSTATE_DIR'] | 33 | self.sstate_path = bb_vars['SSTATE_DIR'] |
34 | self.hostdistro = bb_vars['NATIVELSBSTRING'] | ||
35 | self.tclibc = bb_vars['TCLIBC'] | 34 | self.tclibc = bb_vars['TCLIBC'] |
36 | self.tune_arch = bb_vars['TUNE_ARCH'] | 35 | self.tune_arch = bb_vars['TUNE_ARCH'] |
37 | self.topdir = bb_vars['TOPDIR'] | 36 | self.topdir = bb_vars['TOPDIR'] |
38 | self.target_vendor = bb_vars['TARGET_VENDOR'] | 37 | self.target_vendor = bb_vars['TARGET_VENDOR'] |
39 | self.target_os = bb_vars['TARGET_OS'] | 38 | self.target_os = bb_vars['TARGET_OS'] |
40 | self.distro_specific_sstate = os.path.join(self.sstate_path, self.hostdistro) | ||
41 | 39 | ||
42 | def track_for_cleanup(self, path): | 40 | def track_for_cleanup(self, path): |
43 | if not keep_temp_files: | 41 | if not keep_temp_files: |
@@ -52,10 +50,7 @@ class SStateBase(OESelftestTestCase): | |||
52 | config_temp_sstate = "SSTATE_DIR = \"%s\"" % temp_sstate_path | 50 | config_temp_sstate = "SSTATE_DIR = \"%s\"" % temp_sstate_path |
53 | self.append_config(config_temp_sstate) | 51 | self.append_config(config_temp_sstate) |
54 | self.track_for_cleanup(temp_sstate_path) | 52 | self.track_for_cleanup(temp_sstate_path) |
55 | bb_vars = get_bb_vars(['SSTATE_DIR', 'NATIVELSBSTRING']) | 53 | self.sstate_path = get_bb_var('SSTATE_DIR') |
56 | self.sstate_path = bb_vars['SSTATE_DIR'] | ||
57 | self.hostdistro = bb_vars['NATIVELSBSTRING'] | ||
58 | self.distro_specific_sstate = os.path.join(self.sstate_path, self.hostdistro) | ||
59 | 54 | ||
60 | if add_local_mirrors: | 55 | if add_local_mirrors: |
61 | config_set_sstate_if_not_set = 'SSTATE_MIRRORS ?= ""' | 56 | config_set_sstate_if_not_set = 'SSTATE_MIRRORS ?= ""' |
@@ -65,8 +60,16 @@ class SStateBase(OESelftestTestCase): | |||
65 | config_sstate_mirror = "SSTATE_MIRRORS += \"file://.* file:///%s/PATH\"" % local_mirror | 60 | config_sstate_mirror = "SSTATE_MIRRORS += \"file://.* file:///%s/PATH\"" % local_mirror |
66 | self.append_config(config_sstate_mirror) | 61 | self.append_config(config_sstate_mirror) |
67 | 62 | ||
63 | def set_hostdistro(self): | ||
64 | # This needs to be read after a BuildStarted event in case it gets changed by event | ||
65 | # handling in uninative.bbclass | ||
66 | self.hostdistro = get_bb_var('NATIVELSBSTRING') | ||
67 | self.distro_specific_sstate = os.path.join(self.sstate_path, self.hostdistro) | ||
68 | |||
68 | # Returns a list containing sstate files | 69 | # Returns a list containing sstate files |
69 | def search_sstate(self, filename_regex, distro_specific=True, distro_nonspecific=True): | 70 | def search_sstate(self, filename_regex, distro_specific=True, distro_nonspecific=True): |
71 | self.set_hostdistro() | ||
72 | |||
70 | result = [] | 73 | result = [] |
71 | for root, dirs, files in os.walk(self.sstate_path): | 74 | for root, dirs, files in os.walk(self.sstate_path): |
72 | if distro_specific and re.search(r"%s/%s/[a-z0-9]{2}/[a-z0-9]{2}$" % (self.sstate_path, self.hostdistro), root): | 75 | if distro_specific and re.search(r"%s/%s/[a-z0-9]{2}/[a-z0-9]{2}$" % (self.sstate_path, self.hostdistro), root): |
@@ -80,55 +83,43 @@ class SStateBase(OESelftestTestCase): | |||
80 | return result | 83 | return result |
81 | 84 | ||
82 | # Test sstate files creation and their location and directory perms | 85 | # Test sstate files creation and their location and directory perms |
83 | def run_test_sstate_creation(self, targets, distro_specific=True, distro_nonspecific=True, temp_sstate_location=True, should_pass=True): | 86 | def run_test_sstate_creation(self, targets, hostdistro_specific): |
84 | self.config_sstate(temp_sstate_location, [self.sstate_path]) | 87 | self.config_sstate(True, [self.sstate_path]) |
88 | |||
89 | bitbake(['-cclean'] + targets) | ||
85 | 90 | ||
86 | if self.temp_sstate_location: | ||
87 | bitbake(['-cclean'] + targets) | ||
88 | else: | ||
89 | bitbake(['-ccleansstate'] + targets) | ||
90 | |||
91 | # We need to test that the env umask have does not effect sstate directory creation | ||
92 | # So, first, we'll get the current umask and set it to something we know incorrect | ||
93 | # See: sstate_task_postfunc for correct umask of os.umask(0o002) | ||
94 | import os | ||
95 | def current_umask(): | ||
96 | current_umask = os.umask(0) | ||
97 | os.umask(current_umask) | ||
98 | return current_umask | ||
99 | |||
100 | orig_umask = current_umask() | ||
101 | # Set it to a umask we know will be 'wrong' | 91 | # Set it to a umask we know will be 'wrong' |
102 | os.umask(0o022) | 92 | with bb.utils.umask(0o022): |
93 | bitbake(targets) | ||
103 | 94 | ||
104 | bitbake(targets) | 95 | # Distro specific files |
105 | file_tracker = [] | 96 | distro_specific_files = self.search_sstate('|'.join(map(str, targets)), True, False) |
106 | results = self.search_sstate('|'.join(map(str, targets)), distro_specific, distro_nonspecific) | ||
107 | if distro_nonspecific: | ||
108 | for r in results: | ||
109 | if r.endswith(("_populate_lic.tar.zst", "_populate_lic.tar.zst.siginfo", "_fetch.tar.zst.siginfo", "_unpack.tar.zst.siginfo", "_patch.tar.zst.siginfo")): | ||
110 | continue | ||
111 | file_tracker.append(r) | ||
112 | else: | ||
113 | file_tracker = results | ||
114 | 97 | ||
115 | if should_pass: | 98 | # Distro non-specific |
116 | self.assertTrue(file_tracker , msg="Could not find sstate files for: %s" % ', '.join(map(str, targets))) | 99 | distro_non_specific_files = [] |
100 | results = self.search_sstate('|'.join(map(str, targets)), False, True) | ||
101 | for r in results: | ||
102 | if r.endswith(("_populate_lic.tar.zst", "_populate_lic.tar.zst.siginfo", "_fetch.tar.zst.siginfo", "_unpack.tar.zst.siginfo", "_patch.tar.zst.siginfo")): | ||
103 | continue | ||
104 | distro_non_specific_files.append(r) | ||
105 | |||
106 | if hostdistro_specific: | ||
107 | self.assertTrue(distro_specific_files , msg="Could not find sstate files for: %s" % ', '.join(map(str, targets))) | ||
108 | self.assertFalse(distro_non_specific_files, msg="Found sstate files in the wrong place for: %s (found %s)" % (', '.join(map(str, targets)), str(distro_non_specific_files))) | ||
117 | else: | 109 | else: |
118 | self.assertTrue(not file_tracker , msg="Found sstate files in the wrong place for: %s (found %s)" % (', '.join(map(str, targets)), str(file_tracker))) | 110 | self.assertTrue(distro_non_specific_files , msg="Could not find sstate files for: %s" % ', '.join(map(str, targets))) |
111 | self.assertFalse(distro_specific_files, msg="Found sstate files in the wrong place for: %s (found %s)" % (', '.join(map(str, targets)), str(distro_specific_files))) | ||
119 | 112 | ||
120 | # Now we'll walk the tree to check the mode and see if things are incorrect. | 113 | # Now we'll walk the tree to check the mode and see if things are incorrect. |
121 | badperms = [] | 114 | badperms = [] |
122 | for root, dirs, files in os.walk(self.sstate_path): | 115 | for root, dirs, files in os.walk(self.sstate_path): |
123 | for directory in dirs: | 116 | for directory in dirs: |
124 | if (os.stat(os.path.join(root, directory)).st_mode & 0o777) != 0o775: | 117 | mode = os.stat(os.path.join(root, directory)).st_mode & 0o777 |
125 | badperms.append(os.path.join(root, directory)) | 118 | if mode != 0o775: |
126 | 119 | badperms.append("%s: %s vs %s" % (os.path.join(root, directory), mode, 0o775)) | |
127 | # Return to original umask | ||
128 | os.umask(orig_umask) | ||
129 | 120 | ||
130 | if should_pass: | 121 | # Check badperms is empty |
131 | self.assertTrue(badperms , msg="Found sstate directories with the wrong permissions: %s (found %s)" % (', '.join(map(str, targets)), str(badperms))) | 122 | self.assertFalse(badperms , msg="Found sstate directories with the wrong permissions: %s (found %s)" % (', '.join(map(str, targets)), str(badperms))) |
132 | 123 | ||
133 | # Test the sstate files deletion part of the do_cleansstate task | 124 | # Test the sstate files deletion part of the do_cleansstate task |
134 | def run_test_cleansstate_task(self, targets, distro_specific=True, distro_nonspecific=True, temp_sstate_location=True): | 125 | def run_test_cleansstate_task(self, targets, distro_specific=True, distro_nonspecific=True, temp_sstate_location=True): |
@@ -153,6 +144,8 @@ class SStateBase(OESelftestTestCase): | |||
153 | 144 | ||
154 | bitbake(['-ccleansstate'] + targets) | 145 | bitbake(['-ccleansstate'] + targets) |
155 | 146 | ||
147 | self.set_hostdistro() | ||
148 | |||
156 | bitbake(targets) | 149 | bitbake(targets) |
157 | results = self.search_sstate('|'.join(map(str, [s + r'.*?\.tar.zst$' for s in targets])), distro_specific=False, distro_nonspecific=True) | 150 | results = self.search_sstate('|'.join(map(str, [s + r'.*?\.tar.zst$' for s in targets])), distro_specific=False, distro_nonspecific=True) |
158 | filtered_results = [] | 151 | filtered_results = [] |
@@ -251,17 +244,11 @@ class SStateTests(SStateBase): | |||
251 | bitbake("dbus-wait-test -c unpack") | 244 | bitbake("dbus-wait-test -c unpack") |
252 | 245 | ||
253 | class SStateCreation(SStateBase): | 246 | class SStateCreation(SStateBase): |
254 | def test_sstate_creation_distro_specific_pass(self): | 247 | def test_sstate_creation_distro_specific(self): |
255 | self.run_test_sstate_creation(['binutils-cross-'+ self.tune_arch, 'binutils-native'], distro_specific=True, distro_nonspecific=False, temp_sstate_location=True) | 248 | self.run_test_sstate_creation(['binutils-cross-'+ self.tune_arch, 'binutils-native'], hostdistro_specific=True) |
256 | |||
257 | def test_sstate_creation_distro_specific_fail(self): | ||
258 | self.run_test_sstate_creation(['binutils-cross-'+ self.tune_arch, 'binutils-native'], distro_specific=False, distro_nonspecific=True, temp_sstate_location=True, should_pass=False) | ||
259 | 249 | ||
260 | def test_sstate_creation_distro_nonspecific_pass(self): | 250 | def test_sstate_creation_distro_nonspecific(self): |
261 | self.run_test_sstate_creation(['linux-libc-headers'], distro_specific=False, distro_nonspecific=True, temp_sstate_location=True) | 251 | self.run_test_sstate_creation(['linux-libc-headers'], hostdistro_specific=False) |
262 | |||
263 | def test_sstate_creation_distro_nonspecific_fail(self): | ||
264 | self.run_test_sstate_creation(['linux-libc-headers'], distro_specific=True, distro_nonspecific=False, temp_sstate_location=True, should_pass=False) | ||
265 | 252 | ||
266 | class SStateCleanup(SStateBase): | 253 | class SStateCleanup(SStateBase): |
267 | def test_cleansstate_task_distro_specific_nonspecific(self): | 254 | def test_cleansstate_task_distro_specific_nonspecific(self): |
@@ -367,18 +354,11 @@ class SStateCacheManagement(SStateBase): | |||
367 | self.run_test_sstate_cache_management_script('m4', global_config, target_config, ignore_patterns=['populate_lic']) | 354 | self.run_test_sstate_cache_management_script('m4', global_config, target_config, ignore_patterns=['populate_lic']) |
368 | 355 | ||
369 | class SStateHashSameSigs(SStateBase): | 356 | class SStateHashSameSigs(SStateBase): |
370 | def test_sstate_32_64_same_hash(self): | 357 | def sstate_hashtest(self, sdkmachine): |
371 | """ | ||
372 | The sstate checksums for both native and target should not vary whether | ||
373 | they're built on a 32 or 64 bit system. Rather than requiring two different | ||
374 | build machines and running a builds, override the variables calling uname() | ||
375 | manually and check using bitbake -S. | ||
376 | """ | ||
377 | 358 | ||
378 | self.write_config(""" | 359 | self.write_config(""" |
379 | MACHINE = "qemux86" | 360 | MACHINE = "qemux86" |
380 | TMPDIR = "${TOPDIR}/tmp-sstatesamehash" | 361 | TMPDIR = "${TOPDIR}/tmp-sstatesamehash" |
381 | TCLIBCAPPEND = "" | ||
382 | BUILD_ARCH = "x86_64" | 362 | BUILD_ARCH = "x86_64" |
383 | BUILD_OS = "linux" | 363 | BUILD_OS = "linux" |
384 | SDKMACHINE = "x86_64" | 364 | SDKMACHINE = "x86_64" |
@@ -390,13 +370,12 @@ BB_SIGNATURE_HANDLER = "OEBasicHash" | |||
390 | self.write_config(""" | 370 | self.write_config(""" |
391 | MACHINE = "qemux86" | 371 | MACHINE = "qemux86" |
392 | TMPDIR = "${TOPDIR}/tmp-sstatesamehash2" | 372 | TMPDIR = "${TOPDIR}/tmp-sstatesamehash2" |
393 | TCLIBCAPPEND = "" | ||
394 | BUILD_ARCH = "i686" | 373 | BUILD_ARCH = "i686" |
395 | BUILD_OS = "linux" | 374 | BUILD_OS = "linux" |
396 | SDKMACHINE = "i686" | 375 | SDKMACHINE = "%s" |
397 | PACKAGE_CLASSES = "package_rpm package_ipk package_deb" | 376 | PACKAGE_CLASSES = "package_rpm package_ipk package_deb" |
398 | BB_SIGNATURE_HANDLER = "OEBasicHash" | 377 | BB_SIGNATURE_HANDLER = "OEBasicHash" |
399 | """) | 378 | """ % sdkmachine) |
400 | self.track_for_cleanup(self.topdir + "/tmp-sstatesamehash2") | 379 | self.track_for_cleanup(self.topdir + "/tmp-sstatesamehash2") |
401 | bitbake("core-image-weston -S none") | 380 | bitbake("core-image-weston -S none") |
402 | 381 | ||
@@ -416,6 +395,20 @@ BB_SIGNATURE_HANDLER = "OEBasicHash" | |||
416 | self.maxDiff = None | 395 | self.maxDiff = None |
417 | self.assertCountEqual(files1, files2) | 396 | self.assertCountEqual(files1, files2) |
418 | 397 | ||
398 | def test_sstate_32_64_same_hash(self): | ||
399 | """ | ||
400 | The sstate checksums for both native and target should not vary whether | ||
401 | they're built on a 32 or 64 bit system. Rather than requiring two different | ||
402 | build machines and running a builds, override the variables calling uname() | ||
403 | manually and check using bitbake -S. | ||
404 | """ | ||
405 | self.sstate_hashtest("i686") | ||
406 | |||
407 | def test_sstate_sdk_arch_same_hash(self): | ||
408 | """ | ||
409 | Similarly, test an arm SDK has the same hashes | ||
410 | """ | ||
411 | self.sstate_hashtest("aarch64") | ||
419 | 412 | ||
420 | def test_sstate_nativelsbstring_same_hash(self): | 413 | def test_sstate_nativelsbstring_same_hash(self): |
421 | """ | 414 | """ |
@@ -426,7 +419,6 @@ BB_SIGNATURE_HANDLER = "OEBasicHash" | |||
426 | 419 | ||
427 | self.write_config(""" | 420 | self.write_config(""" |
428 | TMPDIR = \"${TOPDIR}/tmp-sstatesamehash\" | 421 | TMPDIR = \"${TOPDIR}/tmp-sstatesamehash\" |
429 | TCLIBCAPPEND = \"\" | ||
430 | NATIVELSBSTRING = \"DistroA\" | 422 | NATIVELSBSTRING = \"DistroA\" |
431 | BB_SIGNATURE_HANDLER = "OEBasicHash" | 423 | BB_SIGNATURE_HANDLER = "OEBasicHash" |
432 | """) | 424 | """) |
@@ -434,7 +426,6 @@ BB_SIGNATURE_HANDLER = "OEBasicHash" | |||
434 | bitbake("core-image-weston -S none") | 426 | bitbake("core-image-weston -S none") |
435 | self.write_config(""" | 427 | self.write_config(""" |
436 | TMPDIR = \"${TOPDIR}/tmp-sstatesamehash2\" | 428 | TMPDIR = \"${TOPDIR}/tmp-sstatesamehash2\" |
437 | TCLIBCAPPEND = \"\" | ||
438 | NATIVELSBSTRING = \"DistroB\" | 429 | NATIVELSBSTRING = \"DistroB\" |
439 | BB_SIGNATURE_HANDLER = "OEBasicHash" | 430 | BB_SIGNATURE_HANDLER = "OEBasicHash" |
440 | """) | 431 | """) |
@@ -463,17 +454,17 @@ class SStateHashSameSigs2(SStateBase): | |||
463 | 454 | ||
464 | configA = """ | 455 | configA = """ |
465 | TMPDIR = \"${TOPDIR}/tmp-sstatesamehash\" | 456 | TMPDIR = \"${TOPDIR}/tmp-sstatesamehash\" |
466 | TCLIBCAPPEND = \"\" | ||
467 | MACHINE = \"qemux86-64\" | 457 | MACHINE = \"qemux86-64\" |
468 | BB_SIGNATURE_HANDLER = "OEBasicHash" | 458 | BB_SIGNATURE_HANDLER = "OEBasicHash" |
469 | """ | 459 | """ |
470 | #OLDEST_KERNEL is arch specific so set to a different value here for testing | 460 | #OLDEST_KERNEL is arch specific so set to a different value here for testing |
471 | configB = """ | 461 | configB = """ |
472 | TMPDIR = \"${TOPDIR}/tmp-sstatesamehash2\" | 462 | TMPDIR = \"${TOPDIR}/tmp-sstatesamehash2\" |
473 | TCLIBCAPPEND = \"\" | ||
474 | MACHINE = \"qemuarm\" | 463 | MACHINE = \"qemuarm\" |
475 | OLDEST_KERNEL = \"3.3.0\" | 464 | OLDEST_KERNEL = \"3.3.0\" |
476 | BB_SIGNATURE_HANDLER = "OEBasicHash" | 465 | BB_SIGNATURE_HANDLER = "OEBasicHash" |
466 | ERROR_QA:append = " somenewoption" | ||
467 | WARN_QA:append = " someotheroption" | ||
477 | """ | 468 | """ |
478 | self.sstate_common_samesigs(configA, configB, allarch=True) | 469 | self.sstate_common_samesigs(configA, configB, allarch=True) |
479 | 470 | ||
@@ -484,7 +475,6 @@ BB_SIGNATURE_HANDLER = "OEBasicHash" | |||
484 | 475 | ||
485 | configA = """ | 476 | configA = """ |
486 | TMPDIR = \"${TOPDIR}/tmp-sstatesamehash\" | 477 | TMPDIR = \"${TOPDIR}/tmp-sstatesamehash\" |
487 | TCLIBCAPPEND = \"\" | ||
488 | MACHINE = \"qemux86-64\" | 478 | MACHINE = \"qemux86-64\" |
489 | require conf/multilib.conf | 479 | require conf/multilib.conf |
490 | MULTILIBS = \"multilib:lib32\" | 480 | MULTILIBS = \"multilib:lib32\" |
@@ -493,7 +483,6 @@ BB_SIGNATURE_HANDLER = "OEBasicHash" | |||
493 | """ | 483 | """ |
494 | configB = """ | 484 | configB = """ |
495 | TMPDIR = \"${TOPDIR}/tmp-sstatesamehash2\" | 485 | TMPDIR = \"${TOPDIR}/tmp-sstatesamehash2\" |
496 | TCLIBCAPPEND = \"\" | ||
497 | MACHINE = \"qemuarm\" | 486 | MACHINE = \"qemuarm\" |
498 | require conf/multilib.conf | 487 | require conf/multilib.conf |
499 | MULTILIBS = \"\" | 488 | MULTILIBS = \"\" |
@@ -511,7 +500,6 @@ class SStateHashSameSigs3(SStateBase): | |||
511 | 500 | ||
512 | self.write_config(""" | 501 | self.write_config(""" |
513 | TMPDIR = \"${TOPDIR}/tmp-sstatesamehash\" | 502 | TMPDIR = \"${TOPDIR}/tmp-sstatesamehash\" |
514 | TCLIBCAPPEND = \"\" | ||
515 | MACHINE = \"qemux86\" | 503 | MACHINE = \"qemux86\" |
516 | require conf/multilib.conf | 504 | require conf/multilib.conf |
517 | MULTILIBS = "multilib:lib32" | 505 | MULTILIBS = "multilib:lib32" |
@@ -522,7 +510,6 @@ BB_SIGNATURE_HANDLER = "OEBasicHash" | |||
522 | bitbake("world meta-toolchain -S none") | 510 | bitbake("world meta-toolchain -S none") |
523 | self.write_config(""" | 511 | self.write_config(""" |
524 | TMPDIR = \"${TOPDIR}/tmp-sstatesamehash2\" | 512 | TMPDIR = \"${TOPDIR}/tmp-sstatesamehash2\" |
525 | TCLIBCAPPEND = \"\" | ||
526 | MACHINE = \"qemux86copy\" | 513 | MACHINE = \"qemux86copy\" |
527 | require conf/multilib.conf | 514 | require conf/multilib.conf |
528 | MULTILIBS = "multilib:lib32" | 515 | MULTILIBS = "multilib:lib32" |
@@ -559,7 +546,6 @@ BB_SIGNATURE_HANDLER = "OEBasicHash" | |||
559 | 546 | ||
560 | self.write_config(""" | 547 | self.write_config(""" |
561 | TMPDIR = \"${TOPDIR}/tmp-sstatesamehash\" | 548 | TMPDIR = \"${TOPDIR}/tmp-sstatesamehash\" |
562 | TCLIBCAPPEND = \"\" | ||
563 | MACHINE = \"qemux86\" | 549 | MACHINE = \"qemux86\" |
564 | require conf/multilib.conf | 550 | require conf/multilib.conf |
565 | MULTILIBS = "multilib:lib32" | 551 | MULTILIBS = "multilib:lib32" |
@@ -570,7 +556,6 @@ BB_SIGNATURE_HANDLER = "OEBasicHash" | |||
570 | bitbake("binutils-native -S none") | 556 | bitbake("binutils-native -S none") |
571 | self.write_config(""" | 557 | self.write_config(""" |
572 | TMPDIR = \"${TOPDIR}/tmp-sstatesamehash2\" | 558 | TMPDIR = \"${TOPDIR}/tmp-sstatesamehash2\" |
573 | TCLIBCAPPEND = \"\" | ||
574 | MACHINE = \"qemux86copy\" | 559 | MACHINE = \"qemux86copy\" |
575 | BB_SIGNATURE_HANDLER = "OEBasicHash" | 560 | BB_SIGNATURE_HANDLER = "OEBasicHash" |
576 | """) | 561 | """) |
@@ -598,7 +583,6 @@ class SStateHashSameSigs4(SStateBase): | |||
598 | 583 | ||
599 | self.write_config(""" | 584 | self.write_config(""" |
600 | TMPDIR = "${TOPDIR}/tmp-sstatesamehash" | 585 | TMPDIR = "${TOPDIR}/tmp-sstatesamehash" |
601 | TCLIBCAPPEND = "" | ||
602 | BB_NUMBER_THREADS = "${@oe.utils.cpu_count()}" | 586 | BB_NUMBER_THREADS = "${@oe.utils.cpu_count()}" |
603 | PARALLEL_MAKE = "-j 1" | 587 | PARALLEL_MAKE = "-j 1" |
604 | DL_DIR = "${TOPDIR}/download1" | 588 | DL_DIR = "${TOPDIR}/download1" |
@@ -613,7 +597,6 @@ BB_SIGNATURE_HANDLER = "OEBasicHash" | |||
613 | bitbake("world meta-toolchain -S none") | 597 | bitbake("world meta-toolchain -S none") |
614 | self.write_config(""" | 598 | self.write_config(""" |
615 | TMPDIR = "${TOPDIR}/tmp-sstatesamehash2" | 599 | TMPDIR = "${TOPDIR}/tmp-sstatesamehash2" |
616 | TCLIBCAPPEND = "" | ||
617 | BB_NUMBER_THREADS = "${@oe.utils.cpu_count()+1}" | 600 | BB_NUMBER_THREADS = "${@oe.utils.cpu_count()+1}" |
618 | PARALLEL_MAKE = "-j 2" | 601 | PARALLEL_MAKE = "-j 2" |
619 | DL_DIR = "${TOPDIR}/download2" | 602 | DL_DIR = "${TOPDIR}/download2" |
@@ -724,7 +707,6 @@ class SStateFindSiginfo(SStateBase): | |||
724 | """ | 707 | """ |
725 | self.write_config(""" | 708 | self.write_config(""" |
726 | TMPDIR = \"${TOPDIR}/tmp-sstates-findsiginfo\" | 709 | TMPDIR = \"${TOPDIR}/tmp-sstates-findsiginfo\" |
727 | TCLIBCAPPEND = \"\" | ||
728 | MACHINE = \"qemux86-64\" | 710 | MACHINE = \"qemux86-64\" |
729 | require conf/multilib.conf | 711 | require conf/multilib.conf |
730 | MULTILIBS = "multilib:lib32" | 712 | MULTILIBS = "multilib:lib32" |
@@ -917,15 +899,24 @@ INHERIT += "base-do-configure-modified" | |||
917 | """, | 899 | """, |
918 | expected_sametmp_output, expected_difftmp_output) | 900 | expected_sametmp_output, expected_difftmp_output) |
919 | 901 | ||
920 | @OETestTag("yocto-mirrors") | 902 | class SStateCheckObjectPresence(SStateBase): |
921 | class SStateMirrors(SStateBase): | 903 | def check_bb_output(self, output, targets, exceptions, check_cdn): |
922 | def check_bb_output(self, output, exceptions, check_cdn): | ||
923 | def is_exception(object, exceptions): | 904 | def is_exception(object, exceptions): |
924 | for e in exceptions: | 905 | for e in exceptions: |
925 | if re.search(e, object): | 906 | if re.search(e, object): |
926 | return True | 907 | return True |
927 | return False | 908 | return False |
928 | 909 | ||
910 | # sstate is checked for existence of these, but they never get written out to begin with | ||
911 | exceptions += ["{}.*image_qa".format(t) for t in targets.split()] | ||
912 | exceptions += ["{}.*deploy_source_date_epoch".format(t) for t in targets.split()] | ||
913 | exceptions += ["{}.*image_complete".format(t) for t in targets.split()] | ||
914 | exceptions += ["linux-yocto.*shared_workdir"] | ||
915 | # these get influnced by IMAGE_FSTYPES tweaks in yocto-autobuilder-helper's config.json (on x86-64) | ||
916 | # additionally, they depend on noexec (thus, absent stamps) package, install, etc. image tasks, | ||
917 | # which makes tracing other changes difficult | ||
918 | exceptions += ["{}.*create_.*spdx".format(t) for t in targets.split()] | ||
919 | |||
929 | output_l = output.splitlines() | 920 | output_l = output.splitlines() |
930 | for l in output_l: | 921 | for l in output_l: |
931 | if l.startswith("Sstate summary"): | 922 | if l.startswith("Sstate summary"): |
@@ -960,24 +951,15 @@ class SStateMirrors(SStateBase): | |||
960 | self.assertEqual(len(failed_urls), missing_objects, "Amount of reported missing objects does not match failed URLs: {}\nFailed URLs:\n{}\nFetcher diagnostics:\n{}".format(missing_objects, "\n".join(failed_urls), "\n".join(failed_urls_extrainfo))) | 951 | self.assertEqual(len(failed_urls), missing_objects, "Amount of reported missing objects does not match failed URLs: {}\nFailed URLs:\n{}\nFetcher diagnostics:\n{}".format(missing_objects, "\n".join(failed_urls), "\n".join(failed_urls_extrainfo))) |
961 | self.assertEqual(len(failed_urls), 0, "Missing objects in the cache:\n{}\nFetcher diagnostics:\n{}".format("\n".join(failed_urls), "\n".join(failed_urls_extrainfo))) | 952 | self.assertEqual(len(failed_urls), 0, "Missing objects in the cache:\n{}\nFetcher diagnostics:\n{}".format("\n".join(failed_urls), "\n".join(failed_urls_extrainfo))) |
962 | 953 | ||
954 | @OETestTag("yocto-mirrors") | ||
955 | class SStateMirrors(SStateCheckObjectPresence): | ||
963 | def run_test(self, machine, targets, exceptions, check_cdn = True, ignore_errors = False): | 956 | def run_test(self, machine, targets, exceptions, check_cdn = True, ignore_errors = False): |
964 | # sstate is checked for existence of these, but they never get written out to begin with | ||
965 | exceptions += ["{}.*image_qa".format(t) for t in targets.split()] | ||
966 | exceptions += ["{}.*deploy_source_date_epoch".format(t) for t in targets.split()] | ||
967 | exceptions += ["{}.*image_complete".format(t) for t in targets.split()] | ||
968 | exceptions += ["linux-yocto.*shared_workdir"] | ||
969 | # these get influnced by IMAGE_FSTYPES tweaks in yocto-autobuilder-helper's config.json (on x86-64) | ||
970 | # additionally, they depend on noexec (thus, absent stamps) package, install, etc. image tasks, | ||
971 | # which makes tracing other changes difficult | ||
972 | exceptions += ["{}.*create_spdx".format(t) for t in targets.split()] | ||
973 | exceptions += ["{}.*create_runtime_spdx".format(t) for t in targets.split()] | ||
974 | |||
975 | if check_cdn: | 957 | if check_cdn: |
976 | self.config_sstate(True) | 958 | self.config_sstate(True) |
977 | self.append_config(""" | 959 | self.append_config(""" |
978 | MACHINE = "{}" | 960 | MACHINE = "{}" |
979 | BB_HASHSERVE_UPSTREAM = "hashserv.yocto.io:8687" | 961 | BB_HASHSERVE_UPSTREAM = "hashserv.yoctoproject.org:8686" |
980 | SSTATE_MIRRORS ?= "file://.* http://cdn.jsdelivr.net/yocto/sstate/all/PATH;downloadfilename=PATH" | 962 | SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/all/PATH;downloadfilename=PATH" |
981 | """.format(machine)) | 963 | """.format(machine)) |
982 | else: | 964 | else: |
983 | self.append_config(""" | 965 | self.append_config(""" |
@@ -987,7 +969,7 @@ MACHINE = "{}" | |||
987 | bitbake("-S none {}".format(targets)) | 969 | bitbake("-S none {}".format(targets)) |
988 | if ignore_errors: | 970 | if ignore_errors: |
989 | return | 971 | return |
990 | self.check_bb_output(result.output, exceptions, check_cdn) | 972 | self.check_bb_output(result.output, targets, exceptions, check_cdn) |
991 | 973 | ||
992 | def test_cdn_mirror_qemux86_64(self): | 974 | def test_cdn_mirror_qemux86_64(self): |
993 | exceptions = [] | 975 | exceptions = [] |