]> git.stg.codes - stg.git/blob - functest/do.sh
Uniform error reporting for services managment.
[stg.git] / functest / do.sh
1 #!/bin/sh
2
3 MKTEMP=/usr/bin/mktemp
4 RM=/bin/rm
5
6 printf "Creating temporary dir... "
7 DIR=`$MKTEMP -d`
8
9 if [ "$DIR" == "" ]
10 then
11     printf "Failed.\nTemporary dir is empty.\n"
12     exit -1
13 fi
14
15 if [ ! -d "$DIR" ]
16 then
17     printf "Failed.\nTemporary dir '$DIR' does not exist or not a directory.\n"
18     exit -1
19 fi
20
21 LOGFILE=`date "+%Y-%m-%d-%H%M%S.log"`
22
23 printf "Ok.\nCloning... "
24 ./clone.sh "$DIR" >> "$LOGFILE" 2>&1
25 if [ "$?" != "0" ]
26 then
27     printf "Failed.\n"
28     exit -1
29 else
30     printf "Ok.\nBuilding... "
31 fi
32 ./build.sh "$DIR" >> "$LOGFILE" 2>&1
33 if [ "$?" != "0" ]
34 then
35     printf "Failed.\n"
36     exit -1
37 else
38     printf "Ok.\nTesting... "
39 fi
40 ./test.sh "$DIR" # >> "$LOGFILE" 2>&1
41 if [ "$?" != "0" ]
42 then
43     printf "Failed.\n"
44     exit -1
45 else
46     printf "Ok.\nCleaning up... "
47 fi
48
49 $RM -rf $DIR
50 if [ "$?" != "0" ]
51 then
52     printf "Failed.\n"
53     exit -1
54 else
55     printf "Ok.\n"
56 fi