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 <pgeorgi@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/50494
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Patrick Georgi 2021-02-10 19:49:15 +01:00
parent 373769f103
commit fe5cf51258
1 changed files with 24 additions and 5 deletions

View File

@ -330,15 +330,24 @@ function check_config
local BUILD_DIR="$1" local BUILD_DIR="$1"
local TEST_TYPE="$2" local TEST_TYPE="$2"
local TEST_STRING="$3" local TEST_STRING="$3"
local NEGATE="$4"
local CONFIG_FILE="$BUILD_DIR/config.build" local CONFIG_FILE="$BUILD_DIR/config.build"
local CONFIG_LOG="$BUILD_DIR/config.log" local CONFIG_LOG="$BUILD_DIR/config.log"
if [ -z "$NEGATE" ]; then
if ! grep -q "$TEST_STRING" "$CONFIG_FILE"; then if ! grep -q "$TEST_STRING" "$CONFIG_FILE"; then
echo "config file: $CONFIG_FILE has incorrect $TEST_TYPE" echo "config file: $CONFIG_FILE has incorrect $TEST_TYPE"
echo "Error: Expected '$TEST_STRING' in config file." >> "$CONFIG_LOG" echo "Error: Expected '$TEST_STRING' in config file." >> "$CONFIG_LOG"
return 1 return 1
fi 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 return 0
} }
@ -443,7 +452,17 @@ function build_config
check_config "$build_dir" "vendor" "CONFIG_VENDOR_$(mainboard_vendor "${MAINBOARD}")=y" check_config "$build_dir" "vendor" "CONFIG_VENDOR_$(mainboard_vendor "${MAINBOARD}")=y"
local VENDOR_OK=$? 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 " <testcase classname='board${testclass/#/.}' name='$BUILD_NAME' >" junit " <testcase classname='board${testclass/#/.}' name='$BUILD_NAME' >"
junit "<failure type='BuildFailed'>" junit "<failure type='BuildFailed'>"