From e5f674da17442efacf355bc05c614a1afeee7c11 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Fri, 12 Jul 2013 16:27:50 +0200 Subject: [PATCH] bin/generate.sh: Added directory option --- bin/generate_tests.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bin/generate_tests.sh b/bin/generate_tests.sh index f1d2691f..85c72106 100755 --- a/bin/generate_tests.sh +++ b/bin/generate_tests.sh @@ -4,8 +4,8 @@ BIN_DIR="${BASE_DIR}/bin" LOG_DIR="${BASE_DIR}/log" RESULT_DIR="${BASE_DIR}/result" DOMAIN="spce.test" -PROFILE="$1" TPAGE="/usr/bin/tpage" +DIR="${BASE_DIR}/scenarios" error_flag=0 function clean @@ -15,21 +15,24 @@ function clean function usage { - echo "Usage: generate_tests.sh [-h] [-c] profile" + echo "Usage: generate_tests.sh [-h] [-c] [-d directory] profile" echo "Options:" echo -e "\tc: clean. Removes all generated test files" + echo -e "\td: directory" echo -e "\th: this help" echo "Args:" echo -e "\tprofile: CE|PRO" } -while getopts 'hc' opt; do +while getopts 'hcd:' opt; do case $opt in h) usage; exit 0;; c) clean; exit 0;; + d) DIR=$OPTARG;; esac done shift $(($OPTIND - 1)) +PROFILE="$1" if [[ $# -ne 1 ]]; then echo "Wrong number or arguments" @@ -53,7 +56,7 @@ if [ ! -x ${TPAGE} ]; then exit 3 fi -for t in $(find ${BASE_DIR}/scenarios/ -not -regex '.+customtt.tt2' -type f -name '*.tt2' | sort); do +for t in $(find ${DIR} -not -regex '.+customtt.tt2' -type f -name '*.tt2' | sort); do template="$(basename $t)" destdir="$(dirname $t)" destfile="$(basename $t .tt2)"