~timo-jyrinki/ubuntu-ui-toolkit/test_jenkins_7_success

« back to all changes in this revision

Viewing changes to run_tests.sh

  • Committer: Christian Dywan
  • Date: 2015-01-30 11:58:40 UTC
  • mto: This revision was merged to the branch mainline in revision 1394.
  • Revision ID: christian.dywan@canonical.com-20150130115840-hhzzmardyl68vmh0
Smarter arg handling and usage without args

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
    exit 1
23
23
fi
24
24
 
 
25
MODES='run|list|vis|launch'
 
26
usage(){
 
27
    echo Usage:
 
28
    echo "  " $(basename $0) "[-h] [$MODES] SUITE"
 
29
    exit 1
 
30
}
 
31
 
25
32
cd tests/autopilot
26
33
 
27
34
export UBUNTU_UI_TOOLKIT_AUTOPILOT_FROM_SOURCE=1
29
36
export UITK_SOURCE_ROOT="$SRC_DIR"
30
37
MODE="run"
31
38
SUITE=ubuntuuitoolkit
32
 
if [ "$1" != "" -a "$2" != "" ]; then
33
 
    MODE="$1"
34
 
    SUITE="$2"
35
 
    shift 2
36
 
elif [ "$1" != "" ]; then
37
 
    MODE="$1"
38
 
    shift 1
 
39
 
 
40
if [ "$1" == "" ]; then
 
41
    usage
 
42
elif [[ $MODES == *$1* ]]; then
 
43
    MODE=$1
 
44
    if [ "$2" == "" ]; then
 
45
        set "$SUITE"
 
46
    else
 
47
        shift 1
 
48
    fi
 
49
elif [ "$2" = "" ]; then
 
50
    true
 
51
elif [[ $MODES == *$2* ]]; then
 
52
    MODE=$2
 
53
    if [ "$3" == "" ]; then
 
54
        shift 1
 
55
        set "$SUITE"
 
56
    else
 
57
        shift 2
 
58
    fi
39
59
fi
40
60
 
41
61
if [ "$MODE" = "run" ]; then
42
 
    autopilot3 $MODE -o ../../$SUITE -f xml -r -rd ../../ $SUITE $*
 
62
    autopilot3 $MODE -o ../../$SUITE -f xml -r -rd ../../ $*
43
63
else
44
 
    autopilot3 $MODE $SUITE $*
 
64
    autopilot3 $MODE $*
45
65
fi
46
66
 
47
67
RESULT=$?
48
68
if [ "$RESULT" == "2" ]; then
49
 
    echo Usage:
50
 
    echo "  " $(basename $0) "run|list|vis|launch [suite] [-v]"
51
 
    echo "See also 'autopilot -h'"
 
69
    usage
52
70
fi
53
71
exit $RESULT