From fe5cf512587244558565685904b21be3b859e55a Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Wed, 10 Feb 2021 19:49:15 +0100 Subject: [PATCH] util/abuild: Ensure that non-Chrome OS builds are non-Chrome OS Sometimes boards enable it by default, making the Kconfig option impossible to disable without messing with the Kconfig files. This shouldn't happen, so report on such occurrences early. TEST=Tried building GOOGLE_KOHAKU through abuild with -x, without -x and both cases after having added a "select CHROMEOS" for testing and it failed in the "without -x with select" scenario while properly configuring and passing all other builds. Change-Id: Ieb6bcbf3e9ca8cd4ced85c7c9ffaa39505f5a9b7 Signed-off-by: Patrick Georgi Reviewed-on: https://review.coreboot.org/c/coreboot/+/50494 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons --- util/abuild/abuild | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/util/abuild/abuild b/util/abuild/abuild index 408de12e7a..0b7b05c551 100755 --- a/util/abuild/abuild +++ b/util/abuild/abuild @@ -330,14 +330,23 @@ function check_config local BUILD_DIR="$1" local TEST_TYPE="$2" local TEST_STRING="$3" + local NEGATE="$4" local CONFIG_FILE="$BUILD_DIR/config.build" local CONFIG_LOG="$BUILD_DIR/config.log" - if ! grep -q "$TEST_STRING" "$CONFIG_FILE"; then - echo "config file: $CONFIG_FILE has incorrect $TEST_TYPE" - echo "Error: Expected '$TEST_STRING' in config file." >> "$CONFIG_LOG" - return 1 + if [ -z "$NEGATE" ]; then + if ! grep -q "$TEST_STRING" "$CONFIG_FILE"; then + echo "config file: $CONFIG_FILE has incorrect $TEST_TYPE" + echo "Error: Expected '$TEST_STRING' in config file." >> "$CONFIG_LOG" + return 1 + fi + else + if grep -q "$TEST_STRING" "$CONFIG_FILE"; then + echo "config file: $CONFIG_FILE has incorrect $TEST_TYPE" + echo "Error: Expected not to see '$TEST_STRING' in config file." >> "$CONFIG_LOG" + return 1 + fi fi return 0 @@ -443,7 +452,17 @@ function build_config check_config "$build_dir" "vendor" "CONFIG_VENDOR_$(mainboard_vendor "${MAINBOARD}")=y" local VENDOR_OK=$? - if [ $BUILDENV_CREATED -ne 0 ] || [ $MAINBOARD_OK -ne 0 ] || [ $VENDOR_OK -ne 0 ]; then + if [ "$chromeos" = false ]; then + # Skip this rule for configs created from templates that already + # come with CHROMEOS enabled. + grep -q "^CONFIG_CHROMEOS=y" ${config_file:-/dev/null} || \ + check_config "$build_dir" "Chrome OS" "CONFIG_CHROMEOS=y" negate + local FORCE_ENABLED_CROS=$? + else + local FORCE_ENABLED_CROS=0 + fi + + if [ $BUILDENV_CREATED -ne 0 ] || [ $MAINBOARD_OK -ne 0 ] || [ $VENDOR_OK -ne 0 ] || [ $FORCE_ENABLED_CROS -eq 1 ]; then junit " " junit ""