Merge "Revert^2 "[CrashRecovery] Add module to BCP and SSCP"" into main
diff --git a/ci/build_test_suites b/ci/build_test_suites
index 861065a..89ecefe 100755
--- a/ci/build_test_suites
+++ b/ci/build_test_suites
@@ -1,3 +1,4 @@
+#!prebuilts/build-tools/linux-x86/bin/py3-cmd
# Copyright 2024, The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/ci/build_test_suites.py b/ci/build_test_suites.py
index 0c1d211..1064041 100644
--- a/ci/build_test_suites.py
+++ b/ci/build_test_suites.py
@@ -69,7 +69,7 @@
build_command = base_build_command(args)
build_command.append('general-tests')
- run_command(build_command)
+ run_command(build_command, print_output=True)
def build_affected_modules(args: argparse.Namespace):
@@ -81,9 +81,9 @@
build_command = base_build_command(args)
build_command.extend(modules_to_build)
- run_command(build_command)
+ run_command(build_command, print_output=True)
- zip_build_outputs(modules_to_build, args.dist_dir)
+ zip_build_outputs(modules_to_build, args.dist_dir, args.target_release)
def base_build_command(args: argparse.Namespace) -> list:
@@ -102,12 +102,17 @@
return build_command
-def run_command(args: list[str]) -> str:
+def run_command(
+ args: list[str],
+ env: Dict[Text, Text] = os.environ,
+ print_output: bool = False,
+) -> str:
result = subprocess.run(
args=args,
text=True,
capture_output=True,
check=False,
+ env=env,
)
# If the process failed, print its stdout and propagate the exception.
if not result.returncode == 0:
@@ -116,6 +121,10 @@
print('stderr: ' + result.stderr)
result.check_returncode()
+
+ if print_output:
+ print(result.stdout)
+
return result.stdout
@@ -201,17 +210,19 @@
return False
-def zip_build_outputs(modules_to_build: Set[Text], dist_dir: Text):
+def zip_build_outputs(
+ modules_to_build: Set[Text], dist_dir: Text, target_release: Text
+):
src_top = os.environ.get('TOP', os.getcwd())
# Call dumpvars to get the necessary things.
# TODO(lucafarsi): Don't call soong_ui 4 times for this, --dumpvars-mode can
# do it but it requires parsing.
- host_out_testcases = get_soong_var('HOST_OUT_TESTCASES')
- target_out_testcases = get_soong_var('TARGET_OUT_TESTCASES')
- product_out = get_soong_var('PRODUCT_OUT')
- soong_host_out = get_soong_var('SOONG_HOST_OUT')
- host_out = get_soong_var('HOST_OUT')
+ host_out_testcases = get_soong_var('HOST_OUT_TESTCASES', target_release)
+ target_out_testcases = get_soong_var('TARGET_OUT_TESTCASES', target_release)
+ product_out = get_soong_var('PRODUCT_OUT', target_release)
+ soong_host_out = get_soong_var('SOONG_HOST_OUT', target_release)
+ host_out = get_soong_var('HOST_OUT', target_release)
# Call the class to package the outputs.
# TODO(lucafarsi): Move this code into a replaceable class.
@@ -267,12 +278,16 @@
zip_command.append('-o')
zip_command.append(os.path.join(dist_dir, 'general-tests.zip'))
- run_command(zip_command)
+ run_command(zip_command, print_output=True)
-def get_soong_var(var: str) -> str:
+def get_soong_var(var: str, target_release: str) -> str:
+ new_env = os.environ.copy()
+ new_env['TARGET_RELEASE'] = target_release
+
value = run_command(
- ['./build/soong/soong_ui.bash', '--dumpvar-mode', '--abs', var]
+ ['./build/soong/soong_ui.bash', '--dumpvar-mode', '--abs', var],
+ env=new_env,
).strip()
if not value:
raise RuntimeError('Necessary soong variable ' + var + ' not found.')
diff --git a/core/Makefile b/core/Makefile
index 6edac1a..90312d0 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -2094,11 +2094,6 @@
# Get a colon-separated list of search paths.
INTERNAL_USERIMAGES_BINARY_PATHS := $(subst $(space),:,$(sort $(dir $(INTERNAL_USERIMAGES_DEPS))))
-# Collects file_contexts files from modules to be installed
-$(call merge-fc-files, \
- $(sort $(foreach m,$(product_MODULES),$(ALL_MODULES.$(m).FILE_CONTEXTS))),\
- $(call intermediates-dir-for,ETC,file_contexts.bin)/file_contexts.modules.tmp)
-
SELINUX_FC := $(call intermediates-dir-for,ETC,file_contexts.bin)/file_contexts.bin
INTERNAL_USERIMAGES_DEPS += $(SELINUX_FC)
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 254bfeb..1793f00 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -1187,7 +1187,6 @@
endif
ALL_MODULES.$(my_register_name).FOR_HOST_CROSS := $(my_host_cross)
ifndef LOCAL_IS_HOST_MODULE
-ALL_MODULES.$(my_register_name).FILE_CONTEXTS := $(LOCAL_FILE_CONTEXTS)
ALL_MODULES.$(my_register_name).APEX_KEYS_FILE := $(LOCAL_APEX_KEY_PATH)
endif
test_config :=
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 2b84fcd..8d99176 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -87,7 +87,6 @@
LOCAL_EXTRA_FULL_TEST_CONFIGS:=
LOCAL_EXTRACT_APK:=
LOCAL_EXTRACT_DPI_APK:=
-LOCAL_FILE_CONTEXTS:=
LOCAL_FINDBUGS_FLAGS:=
LOCAL_FORCE_STATIC_EXECUTABLE:=
LOCAL_FULL_CLASSES_JACOCO_JAR:=
diff --git a/tools/perf/benchmarks b/tools/perf/benchmarks
index 05adbe5..acc53bb 100755
--- a/tools/perf/benchmarks
+++ b/tools/perf/benchmarks
@@ -130,8 +130,9 @@
def Clean():
"""Remove the out directory."""
def remove_out():
- if os.path.exists("out"):
- shutil.rmtree("out")
+ out_dir = utils.get_out_dir()
+ if os.path.exists(out_dir):
+ shutil.rmtree(out_dir)
return Change(label="Remove out", change=remove_out, undo=lambda: None)
@@ -270,7 +271,7 @@
def _run_benchmark(self, lunch, benchmark, iteration):
"""Run a single benchmark."""
- benchmark_log_subdir = self._log_dir(lunch, benchmark, iteration)
+ benchmark_log_subdir = self._benchmark_log_dir(lunch, benchmark, iteration)
benchmark_log_dir = self._options.LogDir().joinpath(benchmark_log_subdir)
sys.stderr.write(f"STARTING BENCHMARK: {benchmark.id}\n")
@@ -298,7 +299,7 @@
dist_one = self._options.DistOne()
if dist_one:
# If we're disting just one benchmark, save the logs and we can stop here.
- self._dist(dist_one)
+ self._dist(utils.get_dist_dir())
else:
# Postroll builds
for i in range(benchmark.preroll):
@@ -315,7 +316,7 @@
self._write_summary()
sys.stderr.write(f"FINISHED BENCHMARK: {benchmark.id}\n")
- def _log_dir(self, lunch, benchmark, iteration):
+ def _benchmark_log_dir(self, lunch, benchmark, iteration):
"""Construct the log directory fir a benchmark run."""
path = f"{lunch.Combine()}/{benchmark.id}"
# Zero pad to the correct length for correct alpha sorting
@@ -355,8 +356,8 @@
return after_ns - before_ns
def _dist(self, dist_dir):
- out_dir = pathlib.Path("out")
- dest_dir = pathlib.Path(dist_dir).joinpath("logs")
+ out_dir = utils.get_out_dir()
+ dest_dir = dist_dir.joinpath("logs")
os.makedirs(dest_dir, exist_ok=True)
basenames = [
"build.trace.gz",
diff --git a/tools/perf/utils.py b/tools/perf/utils.py
index 08e393f..934130d 100644
--- a/tools/perf/utils.py
+++ b/tools/perf/utils.py
@@ -28,3 +28,15 @@
d = d.parent
if d == pathlib.Path("/"):
return None
+
+def get_dist_dir():
+ dist_dir = os.getenv("DIST_DIR")
+ if dist_dir:
+ return pathlib.Path(dist_dir).resolve()
+ return get_out_dir().joinpath("dist")
+
+def get_out_dir():
+ out_dir = os.getenv("OUT_DIR")
+ if not out_dir:
+ out_dir = "out"
+ return pathlib.Path(out_dir).resolve()
diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py
index 4356394..7b497c1 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -1137,6 +1137,7 @@
devkeydir + "/shared": d + "/shared",
devkeydir + "/platform": d + "/platform",
devkeydir + "/networkstack": d + "/networkstack",
+ devkeydir + "/sdk_sandbox": d + "/sdk_sandbox",
})
else:
OPTIONS.key_map[s] = d