diff options
author | 2024-01-05 16:30:58 +0000 | |
---|---|---|
committer | 2025-02-19 12:19:48 -0800 | |
commit | 50f41ab016288e44e70689d6ed60e38f749c59e2 (patch) | |
tree | 4050dbfcdf827e9e17260476cfe6ad428973c7d7 /test/generate-boot-image/generate-boot-image.cc | |
parent | 11bd0da6cfa3fa40bc61deae0ad1e6ba230b0954 (diff) |
[Sim] Build target boot image for simulator
The simulator requires a target profile and boot image to run and
correctly simulate target tests so add a build step to generate a
target profile and boot image on the host if the simulator is being
built.
Also add a flag (--android-root-for-locations) to allow the
bootclasspath locations to use the android root as a prefix to the
bootclasspath files. This means non-device paths (e.g.: the target or
host out directory) to the bootclasspath files can be used.
Author: Chris Jones <christopher.jones@arm.com>
Test: export ART_USE_SIMULATOR=true
test.py --host --target
Change-Id: I8c9f2a1c2e3f14bbc48bc3f2eef18a682ce5557b
Diffstat (limited to 'test/generate-boot-image/generate-boot-image.cc')
-rw-r--r-- | test/generate-boot-image/generate-boot-image.cc | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/test/generate-boot-image/generate-boot-image.cc b/test/generate-boot-image/generate-boot-image.cc index 3cd992f0c6..454b63185a 100644 --- a/test/generate-boot-image/generate-boot-image.cc +++ b/test/generate-boot-image/generate-boot-image.cc @@ -80,6 +80,9 @@ Supported options: host. The default on target is based on the ISA of this binary. --core-only=true|false: If true, only compile ART jars. Otherwise, also compile core-icu4j and conscrypt. Default: false + --android-root-for-location=true|false: If true, use --android-root as a prefix to the dex + locations. This allows non-device paths to the bootclasspath jars to be used, for example: to + generate a boot image on host that can be used on host. Default: false --: Arguments following '--' are directly passed to dex2oat. )"; @@ -94,6 +97,7 @@ struct Options { std::string profile_file = ""; std::string instruction_set = ""; bool core_only = false; + bool android_root_for_location = false; std::vector<std::string> dex2oat_options; }; @@ -133,7 +137,12 @@ int GenerateBootImage(const Options& options) { std::vector<std::string> dex_files = GetLibCoreDexFileNames(options.android_root, options.core_only); - std::vector<std::string> dex_locations = GetLibCoreDexLocations(options.core_only); + std::vector<std::string> dex_locations; + if (options.android_root_for_location) { + dex_locations = dex_files; + } else { + dex_locations = GetLibCoreDexLocations(options.core_only); + } args.push_back("--runtime-arg"); args.push_back("-Xbootclasspath:" + Join(dex_files, ":")); args.push_back("--runtime-arg"); @@ -209,6 +218,12 @@ int Main(int argc, char** argv) { Usage(ART_FORMAT("Unrecognized --core-only value: '{}'", arg)); } options.core_only = result == ParseBoolResult::kTrue; + } else if (ConsumePrefix(&arg, "--android-root-for-location=")) { + ParseBoolResult result = ParseBool(arg); + if (result == ParseBoolResult::kError) { + Usage(ART_FORMAT("Unrecognized --android-root-for-location value: '{}'", arg)); + } + options.android_root_for_location = result == ParseBoolResult::kTrue; } else if (arg == "--") { for (i++; i < argc; i++) { options.dex2oat_options.push_back(argv[i]); |