Add structured test id experiment for presubmit tests

Presubmit tests need a module scheme and module name arg added
for the new structured test id format.

Support for the structured test ids was added in:

https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7173696

The experiment will be enabled on presubmit builders in:

https://chromium-review.googlesource.com/c/chromium/src/+/7230947

This is similar to the change adding the module scheme and name in: https://source.corp.google.com/h/chromium/chromium/tools/build/+/main:recipes/recipe_modules/chromium_tests/resultdb.py;drc=c4623988e11815a8111f7cea4fbaeb3e63712f25;l=221

Bug: 418015486
Change-Id: Iaf42e5cf173754302648ab7e27fc39b8b8c8732b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7231163
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Benjamin Joyce (Ben) <bjoyce@google.com>
This commit is contained in:
Ben Joyce
2025-12-09 13:38:00 -08:00
committed by LUCI CQ
parent b48cbb3e60
commit 0861b0e55c
3 changed files with 18 additions and 3 deletions

View File

@@ -847,7 +847,7 @@ Raises:
Returns a presubmit step.
&mdash; **def [execute](/recipes/recipe_modules/presubmit/api.py#115)(self, bot_update_step, skip_owners=False, run_all=False):**
&mdash; **def [execute](/recipes/recipe_modules/presubmit/api.py#120)(self, bot_update_step, skip_owners=False, run_all=False):**
Runs presubmit and sets summary markdown if applicable.
@@ -861,7 +861,7 @@ Args:
Returns:
a RawResult object, suitable for being returned from RunSteps.
&mdash; **def [prepare](/recipes/recipe_modules/presubmit/api.py#48)(self, root_solution_revision=None):**
&mdash; **def [prepare](/recipes/recipe_modules/presubmit/api.py#53)(self, root_solution_revision=None):**
Sets up a presubmit run.
@@ -880,7 +880,7 @@ Returns:
&emsp; **@property**<br>&mdash; **def [presubmit\_support\_path](/recipes/recipe_modules/presubmit/api.py#25)(self):**
&mdash; **def [upload\_findings\_from\_result](/recipes/recipe_modules/presubmit/api.py#219)(self, result_json):**
&mdash; **def [upload\_findings\_from\_result](/recipes/recipe_modules/presubmit/api.py#224)(self, result_json):**
Parse code findings from presubmit results and then upload them.

View File

@@ -36,6 +36,11 @@ class PresubmitApi(recipe_api.RecipeApi):
cmd.extend(['--json_output', self.m.json.output()])
if self.m.resultdb.enabled:
kwargs['wrapper'] = ('rdb', 'stream', '--')
if ('presubmit.resultdb_module'
in self.m.buildbucket.build.input.experiments):
kwargs['wrapper'] = ('rdb', 'stream', '-module-scheme', 'flat',
'-module-name', '//:presubmit', '--')
return self.m.step(name, cmd, **kwargs)
@property

View File

@@ -61,6 +61,16 @@ def GenTests(api):
post_process.StepCommandContains, 'presubmit', ['--dry_run']) +
api.post_process(post_process.DropExpectation))
yield (api.test('module_scheme_experiment') +
api.runtime(is_experimental=False) + api.buildbucket.try_build(
experiments={'presubmit.resultdb_module': 100}) +
api.cq(run_mode=api.cq.DRY_RUN) +
api.post_process(post_process.StatusSuccess) +
api.post_process(post_process.StepCommandContains, 'presubmit', [
'rdb', 'stream', '-module-scheme', 'flat', '-module-name',
'//:presubmit', '--'
]) + api.post_process(post_process.DropExpectation))
yield (api.test('skip_owners') + api.runtime(is_experimental=False) +
api.buildbucket.try_build(project='infra') +
api.properties(skip_owners=True) +