afdo: Implement kernel afdo verification builders.
As a part of PUpr project, we need to move the publish of new
kernel profiles out of PFQ. This patch implements the builder that
performs the publish. More importantly, this builder adds a new
functionality that old PFQ doesn't have: we will take the latest
kernel profile, try to patch the ebuild, and build kernel to see
if there's any problem with profile, before publishing it.
The patch mainly generalized the functions for
orderfile-verify-toolchain builder to support both orderfile and
kernel AFDO profiles. And also uses new build API for future
transitions.
BUG=chromium:990855,chromium:984153
TEST=https://ci.chromium.org/p/chromeos/builders/general/Try/b8903406507089410256
Change-Id: I5695c4258420ead180943d22a8d1bfa207a3095e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1763922
Tested-by: Tiancong Wang <tcwang@google.com>
Commit-Queue: Tiancong Wang <tcwang@google.com>
Reviewed-by: Evan Hernandez <evanhernandez@chromium.org>
diff --git a/api/controller/artifacts_unittest.py b/api/controller/artifacts_unittest.py
index ab8f558..f34bb48 100644
--- a/api/controller/artifacts_unittest.py
+++ b/api/controller/artifacts_unittest.py
@@ -14,6 +14,7 @@
from chromite.api import api_config
from chromite.api.controller import artifacts
from chromite.api.gen.chromite.api import artifacts_pb2
+from chromite.api.gen.chromite.api import toolchain_pb2
from chromite.cbuildbot import commands
from chromite.lib import chroot_lib
from chromite.lib import constants
@@ -735,8 +736,8 @@
self.output_dir = os.path.join(self.tempdir, 'output_dir')
osutils.SafeMakedirs(self.output_dir)
self.build_target = 'board'
- self.valid_artifact_type = artifacts_pb2.ORDERFILE
- self.invalid_artifact_type = artifacts_pb2.NONE_TYPE
+ self.valid_artifact_type = toolchain_pb2.ORDERFILE
+ self.invalid_artifact_type = toolchain_pb2.NONE_TYPE
self.does_not_exist = os.path.join(self.tempdir, 'does_not_exist')
self.PatchObject(cros_build_lib, 'Die', new=self.mock_die)
@@ -827,14 +828,11 @@
with self.assertRaises(cros_build_lib.DieSystemExit) as context:
artifacts.BundleAFDOGenerationArtifacts(request, self.response,
self.api_config)
- # FIXME(tcwang): The error message here should print the error message
- # of the artifact_type not in valid list. But instead, it reports
- # no artifact_type specified.
- self.assertIn('artifact_type (0) must be in',
+ self.assertIn('artifact_type (%d) must be in' % self.invalid_artifact_type,
str(context.exception))
def testOutputHandlingOnOrderfile(self,
- artifact_type=artifacts_pb2.ORDERFILE):
+ artifact_type=toolchain_pb2.ORDERFILE):
"""Test response output for orderfile."""
files = ['artifact1', 'artifact2', 'artifact3']
expected_files = [os.path.join(self.output_dir, f) for f in files]
@@ -856,7 +854,7 @@
def testOutputHandlingOnAFDO(self):
"""Test response output for AFDO."""
self.testOutputHandlingOnOrderfile(
- artifact_type=artifacts_pb2.BENCHMARK_AFDO)
+ artifact_type=toolchain_pb2.BENCHMARK_AFDO)
class ExportCpeReportTest(cros_test_lib.MockTempDirTestCase,