util/scripts/testsoc: Pass arguments to abuild

This allows the user to pass one or more arguments through the testsoc
script to abuild.

Example:
testsoc -K SOC_AMD_CEZANNE -a "--skip_unset BOARD_GOOGLE_NIPPERKIN"

Signed-off-by: Martin Roth <gaumless@gmail.com>
Change-Id: Ic2bc8d656022560ed1eebf6eee0512d3633ebe84
Reviewed-on: https://review.coreboot.org/c/coreboot/+/72766
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Martin Roth 2023-02-03 13:10:11 -07:00 committed by Martin L Roth
parent c489a405d1
commit 4bd2325802
1 changed files with 11 additions and 3 deletions

View File

@ -11,6 +11,9 @@ UNSORTED=()
CPUS=$(nproc || echo "4") CPUS=$(nproc || echo "4")
NO_CROS=0 NO_CROS=0
# Extra arguments to pass to abuild
ABUILD_ARGS=""
# Text STYLE variables # Text STYLE variables
BOLD="\033[1m" BOLD="\033[1m"
RED='\033[38;5;9m' RED='\033[38;5;9m'
@ -26,6 +29,7 @@ runs abuild on the mainboards it finds.
Usage: ${PROGNAME} [options] Usage: ${PROGNAME} [options]
Options: Options:
-a | --abuild "<text>" Specify options to pass to abuild
-C | --cpus <num> Specify number of CPUs to use (currently ${CPUS}) -C | --cpus <num> Specify number of CPUs to use (currently ${CPUS})
-K | --kconfig <CONFIG> Search for Kconfig option -K | --kconfig <CONFIG> Search for Kconfig option
-n | --no_cros Don't run chromeos builds -n | --no_cros Don't run chromeos builds
@ -66,7 +70,7 @@ get_args() {
local mblist local mblist
local mainboards=() local mainboards=()
if ! args="$(getopt -l version,help,debug,nocolor,kconfig:,cpus:,no_cros -o C:K:nDhV -- "$@")"; then if ! args="$(getopt -l version,help,debug,nocolor,kconfig:,cpus:,no_cros,abuild: -o a:C:K:nDhV -- "$@")"; then
usage usage
exit 1 exit 1
fi fi
@ -75,6 +79,10 @@ get_args() {
while true; do while true; do
case "$1" in case "$1" in
-a | --abuild)
shift
ABUILD_ARGS=$1
;;
-C | --cpus) -C | --cpus)
shift shift
CPUS=$1 CPUS=$1
@ -155,7 +163,7 @@ main() {
rm -rf "./${OUTPUT}" rm -rf "./${OUTPUT}"
# Non-CrOS build # Non-CrOS build
if ! "${ABUILD}" --exitcode --cpus ${CPUS} --target "${board}"; then if ! "${ABUILD}" --exitcode --cpus ${CPUS} --target "${board}" ${ABUILD_ARGS}; then
_echo_error "Error: Non-cros build of ${board} failed." _echo_error "Error: Non-cros build of ${board} failed."
exit 1 exit 1
fi fi
@ -163,7 +171,7 @@ main() {
# CrOS build # CrOS build
if [[ ${NO_CROS} -eq 0 ]]; then if [[ ${NO_CROS} -eq 0 ]]; then
rm -rf "./${OUTPUT}" rm -rf "./${OUTPUT}"
if ! "${ABUILD}" --exitcode --cpus ${CPUS} --target "${board}" --chromeos; then if ! "${ABUILD}" --exitcode --cpus ${CPUS} --target "${board}" --chromeos ${ABUILD_ARGS}; then
_echo_error "Error: CrOS build of ${board} failed." _echo_error "Error: CrOS build of ${board} failed."
exit 1 exit 1
fi fi