diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2023-12-14 14:45:20 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-12-17 19:07:21 +0000 |
commit | 6e6bb93fda590ddb9e27eb8886a6a67645e35c82 (patch) | |
tree | 2b1697b6662728e2bd0911b44f8f52218b6e8c26 /meta | |
parent | 69a4180c88ddd231c99baf76d5b606e6fd2b4875 (diff) | |
download | poky-6e6bb93fda590ddb9e27eb8886a6a67645e35c82.tar.gz |
oeqa/selftest/sstatetests: re-work CDN tests, add local cache tests
With the rework of printdiff, it is not longer useful for checking
absence of sstate objects in a remote http cache, as it would only
report the top level missing signatures, and leave the recursive
investigation to diffsigs (which relies on ability to list cache
files - not available over http).
The CDN check can be performed by simply running 'bitbake -DD -n'
which is very verbose, but neverthless reports the amount
of missing sstate objects and what they are in a way that can
be programmatically extracted and checked (as suggested by RP).
This also adds local sstate tests, as they can be useful to
determine whether the missing cdn objects were never created or
erroneously cleaned up, or if they were created but didn't propagate
to cdn.
[YOCTO #15303]
(From OE-Core rev: 2a7c653a2eee85e5791a8fdc15857367f0ed0bd9)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/sstatetests.py | 99 |
1 files changed, 67 insertions, 32 deletions
diff --git a/meta/lib/oeqa/selftest/cases/sstatetests.py b/meta/lib/oeqa/selftest/cases/sstatetests.py index e6f3b03c82..f827615ba1 100644 --- a/meta/lib/oeqa/selftest/cases/sstatetests.py +++ b/meta/lib/oeqa/selftest/cases/sstatetests.py | |||
@@ -884,47 +884,82 @@ expected_sametmp_output, expected_difftmp_output) | |||
884 | 884 | ||
885 | @OETestTag("yocto-mirrors") | 885 | @OETestTag("yocto-mirrors") |
886 | class SStateMirrors(SStateBase): | 886 | class SStateMirrors(SStateBase): |
887 | def check_bb_output(self, output, exceptions): | 887 | def check_bb_output(self, output, exceptions, check_cdn): |
888 | in_tasks = False | 888 | def is_exception(object, exceptions): |
889 | missing_objects = [] | 889 | for e in exceptions: |
890 | checked_urls = [] | 890 | if re.search(e, object): |
891 | for l in output.splitlines(): | 891 | return True |
892 | if "Testing URL" in l: | 892 | return False |
893 | checked_urls.append(l.split()[3]) | 893 | |
894 | if "The differences between the current build and any cached tasks start at the following tasks" in l: | 894 | output_l = output.splitlines() |
895 | in_tasks = True | 895 | for l in output_l: |
896 | continue | 896 | if l.startswith("Sstate summary"): |
897 | if "Writing task signature files" in l: | 897 | for idx, item in enumerate(l.split()): |
898 | in_tasks = False | 898 | if item == 'Missed': |
899 | continue | 899 | missing_objects = int(l.split()[idx+1]) |
900 | if in_tasks: | ||
901 | recipe_task = l.split("/")[-1] | ||
902 | recipe, task = recipe_task.split(":") | ||
903 | for e in exceptions: | ||
904 | if e[0] in recipe and task == e[1]: | ||
905 | break | 900 | break |
906 | else: | 901 | else: |
907 | missing_objects.append(recipe_task) | 902 | self.fail("Did not find missing objects amount in sstate summary: {}".format(l)) |
908 | self.assertTrue(len(missing_objects) == 0, "URLs checked:\n{}\nMissing objects in the cache:\n{}".format("\n".join(checked_urls), "\n".join(missing_objects))) | 903 | break |
909 | 904 | else: | |
910 | def run_test_cdn_mirror(self, machine, targets, exceptions): | 905 | self.fail("Did not find 'Sstate summary' line in bitbake output") |
911 | exceptions = exceptions + [[t, "do_deploy_source_date_epoch"] for t in targets.split()] | 906 | |
912 | exceptions = exceptions + [[t, "do_image_qa"] for t in targets.split()] | 907 | failed_urls = [] |
913 | self.config_sstate(True) | 908 | for l in output_l: |
914 | self.append_config(""" | 909 | if "SState: Unsuccessful fetch test for" in l and check_cdn: |
910 | missing_object = l.split()[6] | ||
911 | elif "SState: Looked for but didn't find file" in l and not check_cdn: | ||
912 | missing_object = l.split()[8] | ||
913 | else: | ||
914 | missing_object = None | ||
915 | if missing_object: | ||
916 | if not is_exception(missing_object, exceptions): | ||
917 | failed_urls.append(missing_object) | ||
918 | else: | ||
919 | missing_objects -= 1 | ||
920 | |||
921 | self.assertEqual(len(failed_urls), missing_objects, "Amount of reported missing objects does not match failed URLs: {}\nFailed URLs:\n{}".format(missing_objects, "\n".join(failed_urls))) | ||
922 | self.assertEqual(len(failed_urls), 0, "Missing objects in the cache:\n{}".format("\n".join(failed_urls))) | ||
923 | |||
924 | def run_test(self, machine, targets, exceptions, check_cdn = True): | ||
925 | # sstate is checked for existence of these, but they never get written out to begin with | ||
926 | exceptions += ["{}.*image_qa".format(t) for t in targets.split()] | ||
927 | exceptions += ["{}.*deploy_source_date_epoch".format(t) for t in targets.split()] | ||
928 | exceptions += ["{}.*image_complete".format(t) for t in targets.split()] | ||
929 | exceptions += ["linux-yocto.*shared_workdir"] | ||
930 | # these get influnced by IMAGE_FSTYPES tweaks in yocto-autobuilder-helper's config.json (on x86-64) | ||
931 | # additionally, they depend on noexec (thus, absent stamps) package, install, etc. image tasks, | ||
932 | # which makes tracing other changes difficult | ||
933 | exceptions += ["{}.*create_spdx".format(t) for t in targets.split()] | ||
934 | exceptions += ["{}.*create_runtime_spdx".format(t) for t in targets.split()] | ||
935 | |||
936 | if check_cdn: | ||
937 | self.config_sstate(True) | ||
938 | self.append_config(""" | ||
915 | MACHINE = "{}" | 939 | MACHINE = "{}" |
916 | BB_HASHSERVE_UPSTREAM = "hashserv.yocto.io:8687" | 940 | BB_HASHSERVE_UPSTREAM = "hashserv.yocto.io:8687" |
917 | SSTATE_MIRRORS ?= "file://.* http://cdn.jsdelivr.net/yocto/sstate/all/PATH;downloadfilename=PATH" | 941 | SSTATE_MIRRORS ?= "file://.* http://cdn.jsdelivr.net/yocto/sstate/all/PATH;downloadfilename=PATH" |
918 | """.format(machine)) | 942 | """.format(machine)) |
919 | result = bitbake("-D -S printdiff {}".format(targets)) | 943 | else: |
920 | self.check_bb_output(result.output, exceptions) | 944 | self.append_config(""" |
945 | MACHINE = "{}" | ||
946 | """.format(machine)) | ||
947 | result = bitbake("-DD -n {}".format(targets)) | ||
948 | bitbake("-S none {}".format(targets)) | ||
949 | self.check_bb_output(result.output, exceptions, check_cdn) | ||
921 | 950 | ||
922 | def test_cdn_mirror_qemux86_64(self): | 951 | def test_cdn_mirror_qemux86_64(self): |
923 | # Example: | ||
924 | # exceptions = [ ["packagegroup-core-sdk","do_package"] ] | ||
925 | exceptions = [] | 952 | exceptions = [] |
926 | self.run_test_cdn_mirror("qemux86-64", "core-image-minimal core-image-full-cmdline core-image-sato-sdk", exceptions) | 953 | self.run_test("qemux86-64", "core-image-minimal core-image-full-cmdline core-image-sato-sdk", exceptions) |
927 | 954 | ||
928 | def test_cdn_mirror_qemuarm64(self): | 955 | def test_cdn_mirror_qemuarm64(self): |
929 | exceptions = [] | 956 | exceptions = [] |
930 | self.run_test_cdn_mirror("qemuarm64", "core-image-minimal core-image-full-cmdline core-image-sato-sdk", exceptions) | 957 | self.run_test("qemuarm64", "core-image-minimal core-image-full-cmdline core-image-sato-sdk", exceptions) |
958 | |||
959 | def test_local_cache_qemux86_64(self): | ||
960 | exceptions = [] | ||
961 | self.run_test("qemux86-64", "core-image-minimal core-image-full-cmdline core-image-sato-sdk", exceptions, check_cdn = False) | ||
962 | |||
963 | def test_local_cache_qemuarm64(self): | ||
964 | exceptions = [] | ||
965 | self.run_test("qemuarm64", "core-image-minimal core-image-full-cmdline core-image-sato-sdk", exceptions, check_cdn = False) | ||