-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_results.sh
executable file
·123 lines (113 loc) · 3.33 KB
/
get_results.sh
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
RUN_DIR="$(dirname "$0")"
BASE_DIR=${BASE_DIR:-$RUN_DIR}
# absolute path
export BASE_DIR=$(readlink -f "${BASE_DIR}")
BIN_DIR="${BASE_DIR}/bin"
PROFILE="${PROFILE:-}"
GROUP="${GROUP:-scenarios}"
RETRANS=""
CDR=""
CDR_TAG_DATA=""
CHECK_TYPE=sipp
usage() {
echo "Usage: get_results.sh [-hcgGr] [-f FILE] [-p PROFILE] [-x GROUP] [-S <all|cfgt|sipp>] [-R number]"
echo -e "\\t-p CE|PRO default is autodetect"
echo -e "\\t-g generate png flow graphs if test fails"
echo -e "\\t-G generate png all flow graphs"
echo -e "\\t-h this help"
echo -e "\\t-r fix retransmission issues"
echo -e "\\t-R choose how many messages before and after to check"
echo -e "\\t-c enable cdr validation"
echo -e "\\t-x set GROUP scenario. Default: scenarios"
echo -e "\\t-f scenarios file"
echo -e "\\t-S check type. Default: sipp <all|cfgt|sipp>"
echo "BASE_DIR:${BASE_DIR}"
echo "BIN_DIR:${BIN_DIR}"
}
get_scenarios() {
if [ -n "${SCEN_FILE}" ]; then
echo "$(date) - scenarios from file"
while read -r t; do
SCEN+=( "${t}" )
echo -e "\\t* ${t}"
done < "${SCEN_FILE}"
else
while read -r t; do
SCEN+=( "${t}" )
done < <("${BIN_DIR}/get_scenarios.sh" -p "${PROFILE}" -x "${GROUP}")
fi
if [[ ${#SCEN[@]} == 0 ]]; then
echo "$(date) no scenarios found"
exit 1
fi
}
while getopts 'hf:gGp:rR:cx:S:' opt; do
case $opt in
h) usage; exit 0;;
G) GRAPH="-G";;
g) GRAPH="-g";;
r) RETRANS="-r";;
R) RETRANS="-r -w ${OPTARG}";;
c) CDR_TAG_DATA="-d"; CDR="-c";;
p) PROFILE=${OPTARG};;
x) GROUP=${OPTARG};;
f) SCEN_FILE=${OPTARG};;
S) CHECK_TYPE=${OPTARG};;
*) usage; exit 1;;
esac
done
shift $((OPTIND-1))
if [[ $# -ne 0 ]]; then
echo "Wrong number or arguments"
usage
exit 1
fi
if [ -z "${PROFILE}" ] ; then
ngcp_type=$(command -v ngcp-type)
if [ -n "${ngcp_type}" ]; then
case $(${ngcp_type}) in
sppro|carrier) PROFILE=PRO;;
spce) PROFILE=CE;;
*) ;;
esac
echo "ngcp-type: profile ${PROFILE}"
fi
fi
if [ "${PROFILE}" != "CE" ] && [ "${PROFILE}" != "PRO" ]; then
echo "PROFILE ${PROFILE} unknown"
usage
exit 2
fi
get_scenarios
check_old() {
echo "$(date) - ================================================================================="
echo "$(date) - ----- ${CHECK_TYPE} checks ----- "
echo "${SCEN[@]}" | tr ' ' '\n' \
| parallel "${BIN_DIR}/check.sh ${GRAPH} -T${CHECK_TYPE} -C -R ${OPTS} ${RETRANS} ${CDR} ${CDR_TAG_DATA} -p ${PROFILE} -s ${GROUP}"
status=$?
echo "$(date) - All done[${status}]"
}
check_sipp() {
echo "$(date) - ================================================================================="
echo "$(date) - ---- sipp checks ----- "
echo "${SCEN[@]}" | tr ' ' '\n' \
| parallel "${BIN_DIR}/check_sipp.sh ${CDR} ${CDR_TAG_DATA} -p ${PROFILE} -s ${GROUP}"
status=$?
echo "$(date) - All done[${status}]"
}
case "${CHECK_TYPE}" in
all|cfgt) check_old;;
sipp) check_sipp;;
*) echo "unknown check type"; exit 1;;
esac
tap_cmd=()
for t in "${SCEN[@]}" ; do
tap_check=$(find "result/${GROUP}/${t}" -name '*.tap' 2>/dev/null)
if [ -n "${tap_check}" ]; then
tap_cmd+=( "result/${GROUP}/${t}/"*tap )
fi
done
prove -f -Q "${tap_cmd[@]}"|tee "result/${GROUP}/prove.log"
grep 'Failed:' "result/${GROUP}/prove.log"|awk -F/ '{print $3}'|uniq > "result/${GROUP}/result_failed.txt"
exit ${status}