blob: e007f82eb59a5eb7b235504ec8ec6e6d4b54a39d (
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
#!/bin/sh
STATUS_FILE=./.exit_status
## func
failed(){
TEST_NAME="$1"
TEST_SECTION="$2"
echo "[\033[31mFAILED\033[0m] -- ${TEST_NAME}:${TEST_SECTION} "
FAILED_TESTS=$((${FAILED_TESTS} + 1))
}
## func
fatal(){
TEST_NAME="$1"
TEST_SECTION="$2"
echo "[\033[7;31mFATAL\033[0m] -- ${TEST_NAME}:${TEST_SECTION} "
FAILED_TESTS=$((${FAILED_TESTS} + 1))
}
## func
passed(){
TEST_NAME="$1"
TEST_SECTION="$2"
echo "[\033[32mPASSED\033[0m] -- ${TEST_NAME}:${TEST_SECTION} "
PASSED_TESTS=$((${PASSED_TESTS} + 1))
}
## func
check(){
EXPR="$1"
TEST_NAME="$2"
TEST_SECTION="$3"
TOT_TESTS=$((${TOT_TESTS} + 1))
##echo "EXPR: ${EXPR}"
if $(echo ${EXPR}) ; then
passed ${TEST_NAME} ${TEST_SECTION}
else
failed ${TEST_NAME} ${TEST_SECTION}
fi
}
## func
check_fatal(){
EXPR="$1"
TEST_NAME="$2"
TEST_SECTION="$3"
TOT_TESTS=$((${TOT_TESTS} + 1))
##echo "EXPR: ${EXPR}"
if $(echo ${EXPR}) ; then
passed ${TEST_NAME} ${TEST_SECTION}
else
fatal ${TEST_NAME} ${TEST_SECTION}
echo "Fatal test failed -- Aborting"
exit 1
fi
}
## func
report_results(){
echo -n "TOTAL_TESTS: ${TOT_TESTS} -- "
echo -n "\033[32mPASSED: ${PASSED_TESTS}\033[0m -- "
echo "\033[31mFAILED: ${FAILED_TESTS}\033[0m "
}
# func
return_results(){
echo "TOT_TESTS=${TOT_TESTS};PASSED_TESTS=${PASSED_TESTS};FAILED_TESTS=${FAILED_TESTS};">${STATUS_FILE}
}
|