Change the build test suites script to be noop

In preparation of switching over the git_main test suites target to
using this script change it to a no-op first to insure there's no
initial impact.

Test: ./build/make/ci/build_test_suites-trunk_staging --target_product aosp_x86_64 --target_release trunk_staging --with_dexpreopt_boot_img_and_system_server_only
Bug: 314171817
Change-Id: I7afab933143e4b617866b1975b1cbc71107f5b2f
This commit is contained in:
Luca Farsi
2024-03-07 13:33:57 -08:00
parent afac5b33ac
commit 11767d5dca
2 changed files with 36 additions and 23 deletions

View File

@@ -36,16 +36,15 @@ REQUIRED_MODULES = frozenset(
) )
def build_test_suites(argv): def build_test_suites(argv, extra_targets: set[str]):
args = parse_args(argv) args = parse_args(argv)
if not os.environ.get('BUILD_NUMBER')[0] == 'P': if is_optimization_enabled():
build_everything(args)
return
# Call the class to map changed files to modules to build. # Call the class to map changed files to modules to build.
# TODO(lucafarsi): Move this into a replaceable class. # TODO(lucafarsi): Move this into a replaceable class.
build_affected_modules(args) build_affected_modules(args, extra_targets)
else:
build_everything(args, extra_targets)
def parse_args(argv): def parse_args(argv):
@@ -60,25 +59,32 @@ def parse_args(argv):
) )
argparser.add_argument('--dist_dir') argparser.add_argument('--dist_dir')
argparser.add_argument('--change_info', nargs='?') argparser.add_argument('--change_info', nargs='?')
argparser.add_argument('--extra_required_modules', nargs='*')
return argparser.parse_args() return argparser.parse_args()
def build_everything(args: argparse.Namespace): def is_optimization_enabled() -> bool:
build_command = base_build_command(args) # TODO(lucafarsi): switch back to building only affected general-tests modules
# in presubmit once ready.
# if os.environ.get('BUILD_NUMBER')[0] == 'P':
# return True
return False
def build_everything(args: argparse.Namespace, extra_targets: set[str]):
build_command = base_build_command(args, extra_targets)
build_command.append('general-tests') build_command.append('general-tests')
run_command(build_command, print_output=True) run_command(build_command, print_output=True)
def build_affected_modules(args: argparse.Namespace): def build_affected_modules(args: argparse.Namespace, extra_targets: set[str]):
modules_to_build = find_modules_to_build( modules_to_build = find_modules_to_build(
pathlib.Path(args.change_info), args.extra_required_modules pathlib.Path(args.change_info), args.extra_required_modules
) )
# Call the build command with everything. # Call the build command with everything.
build_command = base_build_command(args) build_command = base_build_command(args, extra_targets)
build_command.extend(modules_to_build) build_command.extend(modules_to_build)
# When not building general-tests we also have to build the general tests # When not building general-tests we also have to build the general tests
# shared libs. # shared libs.
@@ -89,7 +95,7 @@ def build_affected_modules(args: argparse.Namespace):
zip_build_outputs(modules_to_build, args.dist_dir, args.target_release) zip_build_outputs(modules_to_build, args.dist_dir, args.target_release)
def base_build_command(args: argparse.Namespace) -> list: def base_build_command(args: argparse.Namespace, extra_targets: set[str]) -> list:
build_command = [] build_command = []
build_command.append('time') build_command.append('time')
build_command.append('./build/soong/soong_ui.bash') build_command.append('./build/soong/soong_ui.bash')
@@ -100,7 +106,7 @@ def base_build_command(args: argparse.Namespace) -> list:
build_command.append('TARGET_RELEASE=' + args.target_release) build_command.append('TARGET_RELEASE=' + args.target_release)
if args.with_dexpreopt_boot_img_and_system_server_only: if args.with_dexpreopt_boot_img_and_system_server_only:
build_command.append('WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY=true') build_command.append('WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY=true')
build_command.extend(args.extra_targets) build_command.extend(extra_targets)
return build_command return build_command
@@ -404,5 +410,5 @@ def get_soong_var(var: str, target_release: str) -> str:
return value return value
def main(argv): def main(argv, extra_targets: set[str]):
build_test_suites(sys.argv) build_test_suites(argv, extra_targets)

View File

@@ -1,4 +1,4 @@
#!prebuilts/build-tools/linux-x86/bin/py3-cmd #!prebuilts/build-tools/linux-x86/bin/py3-cmd -B
# Copyright 2024, The Android Open Source Project # Copyright 2024, The Android Open Source Project
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,10 +14,17 @@
# limitations under the License. # limitations under the License.
import sys import sys
import build_test_suites import build_test_suites
if __name__ == '__main__': build_test_suites.main(
sys.dont_write_bytecode = True sys.argv,
extra_targets=[
build_test_suites.main(sys.argv) 'acts_tests',
'cts',
'host-unit-tests',
'robolectric-tests',
'test_mapping',
'tradefed-all',
'vts',
],
)