summaryrefslogtreecommitdiff
path: root/test/scorsh_testsuite
blob: a631a2918b80026188f644aa8c4b560a575baf77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/sh

####
##
## testsuite for SCORSH
##

if [ $# -lt 1 ]; then
    echo "Usage: $0 <spec_file>"
    exit 1
fi

. ./scorsh_functions

[ -f "$1" ] || ( echo "Unable to open file $1" && exit 2 )

. "$1"


trap cleanup 0 HUP INT TRAP TERM QUIT

## func
cleanup(){
    ## do stuff here
    # rm -rf ${SCORSH_REPO}
    # rm -rf ${SCORSH_APP}
    # rm -rf ${REMOTE_REPO}
    # rm -rf ${LOCAL_REPO}
    
    echo "Exiting..."
}

## func
run_tests(){

    for t in $TESTS; do
        export PASSED_TESTS FAILED_TESTS TOT_TESTS
        echo "\033[4;7;36m-+-+- running tests in $t -+-+-\033[0m"
        $t
        if [ $? -ne 0 ]; then
            echo "test $t aborted unexpectedly. Aborting"
            exit 2
        fi
        eval $(cat ${STATUS_FILE})
        echo "\033[35m-------------------------------------------------------------\033[0m"
        
    done
    export PASSED_TESTS FAILED_TESTS TOT_TESTS
}


## main

export SCORSH_URL SCORSH_REPO SCORSH_APP REMOTE_REPO LOCAL_REPO
PASSED_TESTS=0
FAILED_TESTS=0
TOT_TESTS=0

rm ${STATUS_FILE}

run_tests

report_results