aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-11-22 21:32:10 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-11-22 21:32:10 +0000
commit27a59835afa7928b2c07ca4254d806648d4a5fc9 (patch)
tree31a612058072858297c7e4c4d76e5e4c509cd0db
parente3efbe2d6feb9e7e34be529dc735fad11721e21d (diff)
parent1d5d862ffea9d5959a1836f5a87dcfe70bdd31e6 (diff)
downloadbazel-27a59835afa7928b2c07ca4254d806648d4a5fc9.tar.gz
Snap for 11135399 from 1d5d862ffea9d5959a1836f5a87dcfe70bdd31e6 to simpleperf-release
Change-Id: I8fa3f9fe4d81feedb66993dafcdfba9fbc6956fd
-rwxr-xr-xbin/b1
-rwxr-xr-xbin/bazel5
-rwxr-xr-xci/atest_integration_test.sh31
-rwxr-xr-xci/rbc_dashboard.py15
-rw-r--r--common.bazelrc3
-rw-r--r--lib.sh19
-rw-r--r--rules/java/errorprone/errorprone_flags.bzl2
-rw-r--r--scripts/incremental_build/cuj_catalog.py41
-rw-r--r--scripts/incremental_build/ui.py2
-rw-r--r--tests/products/product_labels.bzl20
-rw-r--r--toolchains/clang/host/linux-x86/cc_toolchain_features.bzl7
-rw-r--r--toolchains/clang/host/linux-x86/cc_toolchain_features_linker_alignment_test.bzl71
-rw-r--r--utils/schema_validation.scl (renamed from utils/schema_validation.bzl)0
-rw-r--r--utils/schema_validation_test.bzl2
14 files changed, 106 insertions, 113 deletions
diff --git a/bin/b b/bin/b
index 72b8bebd..63c95135 100755
--- a/bin/b
+++ b/bin/b
@@ -36,7 +36,6 @@ done
# TODO(b/262904551) - this is Darwin incompatible and should eventually be updated.
BUILD_STARTED_TIME=`date +%s%3N`
B_ARGS=$*
-BES_UUID="$(uuidgen)"
set +e
"$TOP/build/soong/soong_ui.bash" --build-mode --all-modules --dir="$(pwd)" $skip_tests bp2build USE_BAZEL_ANALYSIS= --build-command="b ${B_ARGS}" --skip-metrics-upload --build-started-time-unix-millis=$BUILD_STARTED_TIME
diff --git a/bin/bazel b/bin/bazel
index 31321a35..9121b731 100755
--- a/bin/bazel
+++ b/bin/bazel
@@ -120,11 +120,6 @@ mod:bp2build --package_path=${ABSOLUTE_OUT_DIR}/soong/workspace
query:bp2build --package_path=${ABSOLUTE_OUT_DIR}/soong/workspace
sync:bp2build --package_path=${ABSOLUTE_OUT_DIR}/soong/workspace
-# This flag is intentionally duplicated with bp2build. This is because
-# --config=metrics_data must have a valid definition, even invocations
-# for which no metrics are collected. This is thus an intentional no-op.
-common:metrics_data --noannounce_rc
-
EOF
}
diff --git a/ci/atest_integration_test.sh b/ci/atest_integration_test.sh
index d704b1db..52613955 100755
--- a/ci/atest_integration_test.sh
+++ b/ci/atest_integration_test.sh
@@ -14,8 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# A script to test the end-to-end flow of atest --roboleaf-mode on the Android
-# CI.
+# A script to test the end-to-end flow of atest on the Android CI.
set -euo pipefail
set -x
@@ -35,8 +34,6 @@ if [ ! -n "${TARGET_PRODUCT}" ] || [ ! -n "${TARGET_BUILD_VARIANT}" ] ; then
TARGET_BUILD_VARIANT=userdebug
fi
-remote_cache="grpcs://${FLAG_service%:*}"
-
out=$(get_build_var PRODUCT_OUT)
# ANDROID_BUILD_TOP is deprecated, so don't use it throughout the script.
@@ -44,33 +41,15 @@ out=$(get_build_var PRODUCT_OUT)
cd ${ANDROID_BUILD_TOP:-.}
# Use the versioned Python binaries in prebuilts/ for a reproducible
-# build with minimal reliance on host tools. Add build/bazel/bin to PATH since
-# atest needs 'b'
-export PATH=${PWD}/prebuilts/build-tools/path/linux-x86:${PWD}/build/bazel/bin:${PATH}
+# build with minimal reliance on host tools.
+export PATH=${PWD}/prebuilts/build-tools/path/linux-x86:${PATH}
export \
ANDROID_PRODUCT_OUT=${out} \
OUT=${out} \
ANDROID_HOST_OUT=$(get_build_var HOST_OUT) \
- ANDROID_TARGET_OUT_TESTCASES=$(get_build_var TARGET_OUT_TESTCASES) \
- REMOTE_AVD=true \
-
-build/soong/soong_ui.bash --make-mode bp2build --skip-soong-tests
+ ANDROID_TARGET_OUT_TESTCASES=$(get_build_var TARGET_OUT_TESTCASES)
build/soong/soong_ui.bash --make-mode atest --skip-soong-tests
-launched_targets+=("$(cat tools/asuite/atest/test_runners/roboleaf_launched.txt | grep -v "^#" | cut -d ':' -f2 | tr '\n' ' ')")
-
-${OUT_DIR}/host/linux-x86/bin/atest-dev \
- --roboleaf-mode=dev \
- --bazel-arg=--config=remote_avd \
- --bazel-arg=--config=ci \
- --bazel-arg=--bes_keywords="${ROBOLEAF_BES_KEYWORDS}" \
- --bazel-arg=--bes_results_url="${ROBOLEAF_BES_RESULTS_URL}" \
- --bazel-arg=--remote_cache="${remote_cache}" \
- --bazel-arg=--project_id="${BES_PROJECT_ID}" \
- --bazel-arg=--build_metadata=ab_branch="${BRANCH_NAME}" \
- --bazel-arg=--build_metadata=ab_target="${BUILD_TARGET_NAME}" \
- --bazel-arg=--build_metadata=ab_build_id="${BUILD_NUMBER}" \
- "$@" \
- ${launched_targets[@]}
+${OUT_DIR}/host/linux-x86/bin/atest-dev --host atest_unittests
diff --git a/ci/rbc_dashboard.py b/ci/rbc_dashboard.py
index 22568ede..3619bae3 100755
--- a/ci/rbc_dashboard.py
+++ b/ci/rbc_dashboard.py
@@ -19,6 +19,12 @@ import xml.etree.ElementTree as ET
_PRODUCT_REGEX = re.compile(r'([a-zA-Z_][a-zA-Z0-9_]*)(?:(?:-(trunk|trunk_staging|next))?-(user|userdebug|eng))?')
+_ALREADY_FAILING_PRODUCTS = [
+ "arm_v7_v8",
+ "car_ui_portrait",
+ "car_x86_64",
+ "sdk_car_portrait_x86_64",
+]
@dataclasses.dataclass(frozen=True)
class Product:
@@ -478,5 +484,14 @@ async def main():
print(args.failure_message, file=sys.stderr)
sys.exit(1)
+ for result in all_results:
+ if result.product.product not in _ALREADY_FAILING_PRODUCTS and not result.baseline_success:
+ print(f"{result.product} fails to run (Make-based) product config", file=sys.stderr)
+ dump_files_to_stderr(os.path.join(dirs.results, str(result.product), 'baseline'))
+ if args.failure_message:
+ print(args.failure_message, file=sys.stderr)
+ sys.exit(1)
+
+
if __name__ == '__main__':
asyncio.run(main())
diff --git a/common.bazelrc b/common.bazelrc
index 6d6d60c8..67ac32eb 100644
--- a/common.bazelrc
+++ b/common.bazelrc
@@ -17,6 +17,9 @@ build --experimental_strict_action_env
# Explicitly allow unresolved symlinks (it's an experimental Bazel feature)
build --experimental_allow_unresolved_symlinks
+# Enable SCL because some files are shared between bazel and make/soong
+common --experimental_enable_scl_dialect
+
# Enable usage of experimental cc-related build APIs
common --experimental_cc_shared_library
build --experimental_starlark_cc_import
diff --git a/lib.sh b/lib.sh
index e9399334..87648bf1 100644
--- a/lib.sh
+++ b/lib.sh
@@ -52,33 +52,16 @@ function formulate_b_args {
# Represent the args as an array, not a string.
bazel_args_with_config=()
command_set=0
- bes_disabled=0
- bes_set=0
- BES_UUID=${BES_UUID:-`uuidgen`}
PROFILE_OUT=${PROFILE_OUT:-`get_profile_out_dir`}
- index=1
- metrics_index=1
for arg in $@; do
- if [[ $arg == "--disable_bes" ]]; then
- bes_disabled=1
- continue
- fi
bazel_args_with_config+=("$arg ")
arg_is_command=$(is_command $arg)
# Add the default configs after the first argument, which should be the command, e.g. build/test
if [[ $arg_is_command && $command_set == 0 ]]; then
- bazel_args_with_config+=("--profile=$PROFILE_OUT/bazel_metrics-profile --config=bp2build --invocation_id=$BES_UUID ")
+ bazel_args_with_config+=("--profile=$PROFILE_OUT/bazel_metrics-profile --config=bp2build ")
command_set=1
- metrics_index=$index
fi
- ((index++))
done
-
- # Make sure metrics are set if not explicitly disabled
- # The first array element is the command, the second is the set of default flags
- if [[ $bes_disabled == 0 ]]; then
- bazel_args_with_config[$metrics_index]+=" --config=metrics_data"
- fi
echo ${bazel_args_with_config[@]}
}
diff --git a/rules/java/errorprone/errorprone_flags.bzl b/rules/java/errorprone/errorprone_flags.bzl
index 62b97ab3..a8935cc6 100644
--- a/rules/java/errorprone/errorprone_flags.bzl
+++ b/rules/java/errorprone/errorprone_flags.bzl
@@ -18,7 +18,7 @@ errorprone_soong_bazel_diffs = [
"-Xep:EmptyTopLevelDeclaration:ERROR",
"-Xep:IgnoredPureGetter:ERROR",
"-Xep:ProtoFieldNullComparison:ERROR",
- "-Xep:RestrictedApiChecker:ERROR",
+ "-Xep:RestrictedApi:ERROR",
# Errorprone ENABLED_WARNINGS
"-Xep:CanIgnoreReturnValueSuggester:WARN",
"-Xep:MathAbsoluteRandom:WARN",
diff --git a/scripts/incremental_build/cuj_catalog.py b/scripts/incremental_build/cuj_catalog.py
index a03009c7..14417903 100644
--- a/scripts/incremental_build/cuj_catalog.py
+++ b/scripts/incremental_build/cuj_catalog.py
@@ -349,45 +349,6 @@ class CreateUnkeptBuildFile(CujGroup):
]
-def _kept_build_cujs() -> tuple[CujGroup, ...]:
- # Bp2BuildKeepExistingBuildFile(build/bazel) is True(recursive)
- kept = src("build/bazel")
- finder.confirm(
- kept,
- "compliance/Android.bp",
- "!compliance/BUILD",
- "!compliance/BUILD.bazel",
- "rules/python/BUILD",
- )
-
- return (
- *(
- CreateKeptBuildFile(kept.joinpath("compliance").joinpath(b))
- for b in ["BUILD", "BUILD.bazel"]
- ),
- Create(kept.joinpath("BUILD/kept-dir"), InWorkspace.SYMLINK),
- ModifyKeptBuildFile(kept.joinpath("rules/python/BUILD")),
- )
-
-
-def _unkept_build_cujs() -> tuple[CujGroup, ...]:
- # Bp2BuildKeepExistingBuildFile(bionic) is False(recursive)
- unkept = src("bionic/libm")
- finder.confirm(unkept, "Android.bp", "!BUILD", "!BUILD.bazel")
- return (
- *(CreateUnkeptBuildFile(unkept.joinpath(b)) for b in ["BUILD", "BUILD.bazel"]),
- *(
- Create(build_file, InWorkspace.OMISSION)
- for build_file in [
- unkept.joinpath("bogus-unkept/BUILD"),
- unkept.joinpath("bogus-unkept/BUILD.bazel"),
- ]
- ),
- # TODO: b/258873199 - Support directories named BUILD.
- Create(unkept.joinpath("BUILD/unkept-dir"), InWorkspace.SYMLINK),
- )
-
-
def _mixed_build_launch_cujs() -> tuple[CujGroup, ...]:
core_settings = src("frameworks/base/core/java/android/provider/Settings.java")
ams = src(
@@ -488,8 +449,6 @@ def get_cujgroups() -> tuple[CujGroup, ...]:
*unreferenced_file_cujs,
*_mixed_build_launch_cujs(),
*android_bp_cujs,
- *_unkept_build_cujs(),
- *_kept_build_cujs(),
ReplaceFileWithDir(src("bionic/README.txt")),
# TODO(usta): add a dangling symlink
)
diff --git a/scripts/incremental_build/ui.py b/scripts/incremental_build/ui.py
index 4fc6c296..67d45188 100644
--- a/scripts/incremental_build/ui.py
+++ b/scripts/incremental_build/ui.py
@@ -141,8 +141,6 @@ def get_user_input() -> UserInput:
)
def_build_types = [
BuildType.SOONG_ONLY,
- BuildType.MIXED_PROD,
- BuildType.MIXED_STAGING,
]
p.add_argument(
"-b",
diff --git a/tests/products/product_labels.bzl b/tests/products/product_labels.bzl
index d70dc689..8b9d4018 100644
--- a/tests/products/product_labels.bzl
+++ b/tests/products/product_labels.bzl
@@ -1,3 +1,19 @@
+# Copyright (C) 2023 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Product definitions for Android's C/C++ toolchain."""
+
load("@//build/bazel/tests/products:aosp_arm.variables.bzl", _soong_variables_arm = "variables")
load("@//build/bazel/tests/products:aosp_arm64.variables.bzl", _soong_variables_arm64 = "variables")
load("@//build/bazel/tests/products:aosp_x86.variables.bzl", _soong_variables_x86 = "variables")
@@ -55,6 +71,10 @@ products = {
{"CFIExcludePaths": ["build/bazel/rules/cc"]},
),
"aosp_x86_64_for_testing": _soong_variables_x86_64,
+ "aosp_x86_64_for_testing_custom_linker_alignment": dicts.add(
+ _soong_variables_x86_64,
+ {"DeviceMaxPageSizeSupported": "65536"},
+ ),
"aosp_arm64_for_testing_min_sdk_version_override_tiramisu": dicts.add(
_soong_variables_arm64,
{"ApexGlobalMinSdkVersionOverride": "Tiramisu"},
diff --git a/toolchains/clang/host/linux-x86/cc_toolchain_features.bzl b/toolchains/clang/host/linux-x86/cc_toolchain_features.bzl
index 63632f79..7f41f394 100644
--- a/toolchains/clang/host/linux-x86/cc_toolchain_features.bzl
+++ b/toolchains/clang/host/linux-x86/cc_toolchain_features.bzl
@@ -2172,6 +2172,7 @@ def _manual_binder_interface_feature():
)
# Create the full list of features.
+# buildifier: disable=function-docstring
def get_features(
ctx,
builtin_include_dirs,
@@ -2181,10 +2182,10 @@ def get_features(
target_flags = ctx.attr.target_flags
compile_only_flags = ctx.attr.compiler_flags
linker_only_flags = ctx.attr.linker_flags
- deviceMaxPageSize = ctx.attr._device_max_page_size_supported[BuildSettingInfo].value
- if deviceMaxPageSize and target_arch == "arm64":
+ device_max_page_size = ctx.attr._device_max_page_size_supported[BuildSettingInfo].value
+ if device_max_page_size and (target_arch == "arm64" or target_arch == "x86_64"):
linker_only_flags = ctx.attr.linker_flags + \
- ["-Wl,-z,max-page-size=" + deviceMaxPageSize]
+ ["-Wl,-z,max-page-size=" + device_max_page_size]
libclang_rt_builtin = ctx.file.libclang_rt_builtin
libclang_rt_ubsan_minimal = ctx.file.libclang_rt_ubsan_minimal
diff --git a/toolchains/clang/host/linux-x86/cc_toolchain_features_linker_alignment_test.bzl b/toolchains/clang/host/linux-x86/cc_toolchain_features_linker_alignment_test.bzl
index 44b03191..633697b2 100644
--- a/toolchains/clang/host/linux-x86/cc_toolchain_features_linker_alignment_test.bzl
+++ b/toolchains/clang/host/linux-x86/cc_toolchain_features_linker_alignment_test.bzl
@@ -16,7 +16,8 @@ limitations under the License.
load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts")
def _test_linker_alignment_flag_impl(ctx):
- """
+ """ Checks that linker alignment flag is present.
+
This test checks that the linker alignment flag is present for
arm and arm 64 targets but it is not present for x86 and x86_64 targets.
"""
@@ -94,6 +95,14 @@ custom_linker_alignment_flag_arm64_test = analysistest.make(
},
)
+custom_linker_alignment_flag_x86_64_test = analysistest.make(
+ impl = _test_linker_alignment_flag_impl,
+ attrs = test_attrs,
+ config_settings = {
+ "//command_line_option:platforms": "@//build/bazel/tests/products:aosp_x86_64_for_testing_custom_linker_alignment",
+ },
+)
+
linker_alignment_flag_x86_test = analysistest.make(
impl = _test_linker_alignment_flag_impl,
attrs = test_attrs,
@@ -110,7 +119,9 @@ linker_alignment_flag_x86_64_test = analysistest.make(
},
)
-def test_linker_alignment_flag_arm():
+def _test_linker_alignment_flag_arm():
+ """ Checks that max-page-size flag is not present for arm targets.
+ """
name = "linker_alignment_flag_arm"
test_name = name + "_test"
@@ -133,7 +144,9 @@ def test_linker_alignment_flag_arm():
)
return test_name
-def test_linker_alignment_flag_arm64():
+def _test_linker_alignment_flag_arm64():
+ """ Checks that max-page-size flag is present for arm64 targets.
+ """
name = "linker_alignment_flag_arm64"
test_name = name + "_test"
@@ -154,7 +167,9 @@ def test_linker_alignment_flag_arm64():
)
return test_name
-def test_custom_linker_alignment_flag_arm64():
+def _test_custom_linker_alignment_flag_arm64():
+ """ Checks that max-page-size flag has the custom alignment for arm64.
+ """
name = "custom_linker_alignment_flag_arm64"
test_name = name + "_test"
@@ -175,7 +190,9 @@ def test_custom_linker_alignment_flag_arm64():
)
return test_name
-def test_linker_alignment_flag_x86():
+def _test_linker_alignment_flag_x86():
+ """ Checks that max-page-size flag is not present for x86.
+ """
name = "linker_alignment_flag_x86"
test_name = name + "_test"
@@ -198,7 +215,9 @@ def test_linker_alignment_flag_x86():
)
return test_name
-def test_linker_alignment_flag_x86_64():
+def _test_linker_alignment_flag_x86_64():
+ """ Checks that max-page-size flag is present for x86_64.
+ """
name = "linker_alignment_flag_x86_64"
test_name = name + "_test"
@@ -211,13 +230,34 @@ def test_linker_alignment_flag_x86_64():
linker_alignment_flag_x86_64_test(
name = test_name,
target_under_test = name,
- expected_action_mnemonics = ["CppCompile", "CppLink"],
- expected_flags = [],
- no_expected_flags = [
+ expected_action_mnemonics = ["CppLink"],
+ expected_flags = [
"-Wl,-z,max-page-size=4096",
- "-Wl,-z,max-page-size=16384",
+ ],
+ no_expected_flags = [],
+ )
+ return test_name
+
+def _test_custom_linker_alignment_flag_x86_64():
+ """ Checks that max-page-size flag has the custom alignment for x86_64.
+ """
+ name = "custom_linker_alignment_flag_x86_64"
+ test_name = name + "_test"
+
+ native.cc_binary(
+ name = name,
+ srcs = ["foo.cpp"],
+ tags = ["manual"],
+ )
+
+ custom_linker_alignment_flag_x86_64_test(
+ name = test_name,
+ target_under_test = name,
+ expected_action_mnemonics = ["CppLink"],
+ expected_flags = [
"-Wl,-z,max-page-size=65536",
],
+ no_expected_flags = [],
)
return test_name
@@ -225,10 +265,11 @@ def cc_toolchain_features_linker_alignment_test_suite(name):
native.test_suite(
name = name,
tests = [
- test_linker_alignment_flag_arm(),
- test_linker_alignment_flag_arm64(),
- test_custom_linker_alignment_flag_arm64(),
- test_linker_alignment_flag_x86(),
- test_linker_alignment_flag_x86_64(),
+ _test_linker_alignment_flag_arm(),
+ _test_linker_alignment_flag_arm64(),
+ _test_custom_linker_alignment_flag_arm64(),
+ _test_linker_alignment_flag_x86(),
+ _test_linker_alignment_flag_x86_64(),
+ _test_custom_linker_alignment_flag_x86_64(),
],
)
diff --git a/utils/schema_validation.bzl b/utils/schema_validation.scl
index b1952a8c..b1952a8c 100644
--- a/utils/schema_validation.bzl
+++ b/utils/schema_validation.scl
diff --git a/utils/schema_validation_test.bzl b/utils/schema_validation_test.bzl
index 131e643b..76a15bb0 100644
--- a/utils/schema_validation_test.bzl
+++ b/utils/schema_validation_test.bzl
@@ -14,7 +14,7 @@
"""Tests for the validate() function."""
load("@bazel_skylib//lib:unittest.bzl", "analysistest")
-load(":schema_validation.bzl", "validate")
+load(":schema_validation.scl", "validate")
def _string_comparison_test_impl(ctx):
env = analysistest.begin(ctx)