|
@@ -34,19 +34,19 @@ export TEXTDOMAIN=${PROJECT_NAME}-tests
|
34
|
34
|
export TEXTDOMAINDIR="/usr/share/locale"
|
35
|
35
|
|
36
|
36
|
function show_help {
|
37
|
|
- echo ''
|
38
|
|
- echo $"${PROJECT_NAME}-tests"
|
39
|
|
- echo ''
|
40
|
|
- echo $'Runs tests on the system'
|
41
|
|
- echo ''
|
42
|
|
- echo $' --help Show help'
|
43
|
|
- echo ''
|
44
|
|
- exit 0
|
|
37
|
+ echo ''
|
|
38
|
+ echo $"${PROJECT_NAME}-tests"
|
|
39
|
+ echo ''
|
|
40
|
+ echo $'Runs tests on the system'
|
|
41
|
+ echo ''
|
|
42
|
+ echo $' --help Show help'
|
|
43
|
+ echo ''
|
|
44
|
+ exit 0
|
45
|
45
|
}
|
46
|
46
|
|
47
|
47
|
function test_app_function_type {
|
48
|
|
- filename=$1
|
49
|
|
- fn_type=$2
|
|
48
|
+ filename=$1
|
|
49
|
+ fn_type=$2
|
50
|
50
|
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
|
51
|
51
|
app_function=$(cat "${filename}" | grep "function ${fn_type}_${app_name} {" | awk -F "${fn_type}_" '{print $2}' | awk -F ' ' '{print $1}')
|
52
|
52
|
if [ ! ${app_function} ]; then
|
|
@@ -63,28 +63,34 @@ function test_app_functions {
|
63
|
63
|
else
|
64
|
64
|
FILES=/usr/bin/${PROJECT_NAME}-app-*
|
65
|
65
|
fi
|
66
|
|
-
|
|
66
|
+
|
|
67
|
+ # check that these functions exist
|
|
68
|
+ interface_functions=( install remove backup )
|
|
69
|
+
|
|
70
|
+ # for all the app scripts
|
67
|
71
|
for filename in $FILES
|
68
|
72
|
do
|
69
|
|
- test_app_function_type ${filename} install
|
70
|
|
- test_app_function_type ${filename} remove
|
71
|
|
- test_app_function_type ${filename} backup
|
72
|
|
- done
|
|
73
|
+ # for each expected interface function
|
|
74
|
+ for f in "${interface_functions[@]}"
|
|
75
|
+ do
|
|
76
|
+ test_app_function_type ${filename} $f
|
|
77
|
+ done
|
|
78
|
+ done
|
73
|
79
|
}
|
74
|
80
|
|
75
|
81
|
while [[ $# > 1 ]]
|
76
|
82
|
do
|
77
|
|
- key="$1"
|
|
83
|
+ key="$1"
|
78
|
84
|
|
79
|
|
- case $key in
|
80
|
|
- -h|--help)
|
81
|
|
- show_help
|
82
|
|
- ;;
|
83
|
|
- *)
|
84
|
|
- # unknown option
|
85
|
|
- ;;
|
86
|
|
- esac
|
87
|
|
- shift
|
|
85
|
+ case $key in
|
|
86
|
+ -h|--help)
|
|
87
|
+ show_help
|
|
88
|
+ ;;
|
|
89
|
+ *)
|
|
90
|
+ # unknown option
|
|
91
|
+ ;;
|
|
92
|
+ esac
|
|
93
|
+ shift
|
88
|
94
|
done
|
89
|
95
|
|
90
|
96
|
echo $'Running tests'
|