1# Copyright 2022 The ChromiumOS Authors 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5from recipe_engine.post_process import Filter 6 7DEPS = [ 8 "crosvm", 9 "recipe_engine/raw_io", 10 "recipe_engine/buildbucket", 11 "recipe_engine/context", 12 "recipe_engine/properties", 13 "recipe_engine/step", 14] 15 16 17def RunSteps(api): 18 with api.crosvm.container_build_context(): 19 api.step( 20 "Self-test dev-container", 21 [ 22 "vpython3", 23 api.crosvm.source_dir / "tools/dev_container", 24 "--verbose", 25 "--self-test", 26 ], 27 ) 28 result = api.step( 29 "List checks to run", 30 [ 31 "vpython3", 32 api.crosvm.source_dir / "tools/presubmit", 33 "--list-checks", 34 "health_checks", 35 ], 36 stdout=api.raw_io.output_text(), 37 ) 38 check_list = result.stdout.strip().split("\n") 39 for check in check_list: 40 api.crosvm.step_in_container( 41 "tools/presubmit %s" % check, ["tools/presubmit", "--no-delta", check] 42 ) 43 44 45def GenTests(api): 46 yield ( 47 api.test( 48 "basic", 49 api.buildbucket.ci_build(project="crosvm/crosvm"), 50 # Provide a fake response to --list-checks 51 api.step_data( 52 "List checks to run", 53 stdout=api.raw_io.output_text("check_a\ncheck_b"), 54 ), 55 ) 56 + api.post_process(Filter("List checks to run").include_re(r"tools/presubmit .*")) 57 ) 58