]> git.stg.codes - stg.git/blob - functest/do.sh
Portable count.
[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 2> /dev/null || $MKTEMP -d -t stg`
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. Working dir: $DIR\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.\n"
39 fi
40
41 ./test.sh "$DIR" # >> "$LOGFILE" 2>&1
42
43 printf "Cleaning up... "
44
45 $RM -rf $DIR
46 if [ "$?" != "0" ]
47 then
48     printf "Failed.\n"
49     exit -1
50 else
51     printf "Ok.\n"
52 fi