From 29a9b313c4465d6bde1a812f4d3264befddbaa9a Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Thu, 23 Jun 2022 14:38:36 +0200 Subject: mbuto: Add support for externally defined profiles This is convenient for passt (https://passt.top) tests, given that the set of commands we need there might change as tests are modified, and we don't want to rely on definitions that are built into mbuto itself. Eventually, we could drop the built-in passt profile altogether, but let's wait a bit before doing that. Suggested-by: David Gibson Signed-off-by: Stefano Brivio Reviewed-by: David Gibson --- mbuto | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/mbuto b/mbuto index 29adf06..693aaaa 100755 --- a/mbuto +++ b/mbuto @@ -1135,9 +1135,15 @@ usage() { echo " kernel version. Default: $(uname -r)" echo " -m PATH" echo " relative root for /lib/modules. Default: /" - echo " -p PROFILE" - echo " select profile for add-ons, one of:" + echo " -p PROFILE|FILE" + echo " select profile for add-ons, built-in PROFILEs are:" echo " base bash kata kata_debug passt kselftests" + echo + echo " alternatively, an executable shell script FILE" + echo " including assignments of configuration variables can be" + echo " used. To avoid collisions with built-in profiles, FILE" + echo " needs to be as a command, e.g. './passt', not 'passt'" + echo echo " Default: base" echo echo " kselftests sub-options (same as run_kselftests.sh):" @@ -1247,9 +1253,13 @@ fi # Create working directory wd="$("${MKTEMP}" -d)" -# Apply profile requested via -p, if any, from matching profile_*() function -if [ -n "${PROFILE}" ]; then - notice "Applying profile ${PROFILE}" +# Apply profile requested from file or matching profile_*() function +if [ -x "${PROFILE}" ] && __profile_file="$(command -v ${PROFILE})" && \ + [ "${PROFILE}" = "${__profile_file}" ]; then + notice "Applying profile from file ${PROFILE}" + . "${PROFILE}" +else + notice "Applying built-in profile ${PROFILE}" eval "profile_${PROFILE}" || err "profile ${PROFILE} not found" fi -- cgit v1.2.3