X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fscripts%2Fretriever.sh;h=ea75c43eed7e1e4e137c5cda879cb7e6c726cb93;hp=c1d466d037e8a72f80c3dbcdf4153df376666b1d;hb=d0c8d5e919188a5be7b42f8de86a43ba6b6290fa;hpb=5f6e04b26996da4c06716ce044bdfdb0e7e2e61b diff --git a/automated-tests/scripts/retriever.sh b/automated-tests/scripts/retriever.sh index c1d466d..ea75c43 100755 --- a/automated-tests/scripts/retriever.sh +++ b/automated-tests/scripts/retriever.sh @@ -1,10 +1,10 @@ #!/bin/bash USAGE=$(cat < 3, -# - argument doesn't begin with '-' and number of arguments is > 2 -if [[ ( "$1" == -* && ( ! "$1" =~ ^-(anum|mnum|f)$ || $# > 3 ) ) || ( "$1" != -* && $# > 2 ) ]]; then - echo -e "$USAGE" - exit 1 +TEMP=`getopt -o f::,a:,m: --long full::,anum:,mnum: \ + -n 'retriever.sh' -- "$@"` + +if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi + +# Note the quotes around `$TEMP': they are essential! +eval set -- "$TEMP" + +opt_full=false +opt_full_dir= +opt_anum= +opt_mnum= + +while true ; do + case "$1" in + -f|--full) opt_full_dir="$2" ; opt_full="true" ; shift 2 ;; + -a|--anum) opt_anum="$2" ; shift 2 ;; + -m|--mnum) opt_mnum="$2" ; shift 2 ;; + --) shift ; break ;; + *) echo -e $USAGE ; exit 1 ;; + esac +done + +#echo "###Retriever" >& 2 +#echo opt_full: {$opt_full} >& 2 +#echo opt_full_dir: {$opt_full_dir} >& 2 + +DIR=. +if [ -n "$opt_anum" ] ; then + DIR=$opt_anum + echo opt_anum: DIR=$DIR >& 2 +elif [ -n "$opt_mnum" ] ; then + DIR=$opt_mnum + echo opt_mnum: DIR=$DIR >& 2 +elif [ "$opt_full" == "true" ] ; then + if [ -n $opt_full_dir ] ; then + DIR=$opt_full_dir + echo opt_full: DIR=$DIR >& 2 + fi fi -# get directory from last argument (or assume current one) -if [[ ! "$1" =~ ^-(anum|mnum|f)$ ]]; then - DIR=${1:-.} -else - DIR=${2:-.} -fi -# get filename from last argument -if [[ $# == 3 && -f $DIR/$3 ]] ; then - FILE=$3 -elif [[ $# == 2 && -f $DIR/$2 ]] ; then - FILE=$2 +# get filename from first argument +if [[ $# == 1 && -f $DIR/$1 ]] ; then + FILE=$1 + shift; fi #echo "Dir: $DIR File: $FILE" >& 2 - # populate $TC_FILES with files declared in CMakeLists.txt if [[ -z $FILE ]]; then - get_tc_files $DIR + if [[ ! $DIR == "." || $# == 0 ]] ; then + #echo Get tc files: DIR=$DIR >& 2 + get_tc_files $DIR + else + TC_FILES=$( + for i in $* ; do + echo $DIR/$i + done + ) + fi if [ $? != 0 ]; then exit 1 fi - echo "Got all files" >& 2 + echo "Got all files in `pwd`" >& 2 + #echo "TC_FILES: $TC_FILES" >& 2 else TC_FILES="$DIR/$FILE" echo "TC_FILES: $TC_FILES" >& 2 @@ -200,13 +243,12 @@ fi # run appropriate subcommand -case "$1" in - -anum) - tc_anum $TC_FILES ;; - -mnum) - tc_mnum $TC_FILES ;; - -f) - tc_fullinfo $TC_FILES ;; - *) - tc_names $TC_FILES ;; -esac +if [ "$opt_full" == "true" ] ; then + tc_fullinfo $TC_FILES +elif [ -n "$opt_anum" ] ; then + tc_anum $TC_FILES +elif [ -n "$opt_mnum" ] ; then + tc_mnum $TC_FILES +else + tc_names $TC_FILES +fi