From 962dd4b225c17ae48d36a978602b245dbf77bec5 Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Wed, 28 Sep 2016 12:37:53 +0100 Subject: [PATCH] Allow ./make-new-test.sh to determine the default category more cleverly When making an XSA proof of concept test, automatically generate the standard documentation template. Signed-off-by: Andrew Cooper --- make-new-test.sh | 49 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/make-new-test.sh b/make-new-test.sh index 39a199d..035eda8 100755 --- a/make-new-test.sh +++ b/make-new-test.sh @@ -15,28 +15,28 @@ else echo -n "Test name: " read NAME fi +NAME_UC=$(echo $NAME | tr a-z A-Z) [ -z "$NAME" ] && fail "No name given" [ -e tests/$NAME ] && fail "Test $NAME already exists" mkdir -p tests/$NAME -# Category -echo -n "Category [utility]: " -read CATEGORY - -if [ -z "$CATEGORY" ]; +# Category - Select default based on test name +if [ ${NAME#xsa-} != ${NAME} ]; then - CATEGORY="utility" + DEF_CATEGORY="xsa" +else + DEF_CATEGORY="utility" fi +echo -n "Category [$DEF_CATEGORY]: " +read CATEGORY +CATEGORY=${CATEGORY:-$DEF_CATEGORY} + # Environments echo -n "Environments [hvm32]: " read ENVS - -if [ -z "$ENVS" ]; -then - ENVS="hvm32" -fi +ENVS=${ENVS:-"hvm32"} # Optional extra config echo -n "Extra xl.cfg? [y/N]: " @@ -89,9 +89,26 @@ echo "Writing default tests/$NAME/main.c" cat <