MT#5757 bin/check.sh: add -g option to generate graph only if test fails

mr3.2.1
Victor Seva 12 years ago
parent 7b51aa89af
commit 608c604a33

@ -35,6 +35,7 @@ function graph
# $3 destination tap filename # $3 destination tap filename
function check_test function check_test
{ {
local dest=${RESULT_DIR}/$(basename $3 .tap)
if [ ! -f $1 ]; then if [ ! -f $1 ]; then
echo "File $1 does not exists" echo "File $1 does not exists"
ERR_FLAG=1 ERR_FLAG=1
@ -51,6 +52,11 @@ function check_test
if [[ $? -ne "0" ]]; then if [[ $? -ne "0" ]]; then
echo " NOT ok" echo " NOT ok"
ERR_FLAG=1 ERR_FLAG=1
if [ -z ${GRAPH} ] && [ ! -z ${GRAPH_FAIL} ]; then
echo "$(date) - Generating flow image: ${dest}.png"
graph $msg ${dest}.png
echo "$(date) - Done"
fi
else else
echo " ok" echo " ok"
fi fi
@ -326,13 +332,14 @@ function usage
echo -e "\t-T: skip checks" echo -e "\t-T: skip checks"
echo -e "\t-P: skip parse" echo -e "\t-P: skip parse"
echo -e "\t-G: creation of graphviz image" echo -e "\t-G: creation of graphviz image"
echo -e "\t-g: creation of graphviz image only if test fails"
echo -e "\t-d: DOMAIN" echo -e "\t-d: DOMAIN"
echo -e "\t-p CE|PRO default is CE" echo -e "\t-p CE|PRO default is CE"
echo "Arguments:" echo "Arguments:"
echo -e "\tcheck_name. Scenario name to check. This is the name of the directory on scenarios dir." echo -e "\tcheck_name. Scenario name to check. This is the name of the directory on scenarios dir."
} }
while getopts 'hCd:p:RDTPG' opt; do while getopts 'hCd:p:RDTPGg' opt; do
case $opt in case $opt in
h) usage; exit 0;; h) usage; exit 0;;
C) SKIP=1;; C) SKIP=1;;
@ -343,6 +350,7 @@ while getopts 'hCd:p:RDTPG' opt; do
T) SKIP_TESTS=1;; T) SKIP_TESTS=1;;
P) SKIP_PARSE=1;; P) SKIP_PARSE=1;;
G) GRAPH=1;; G) GRAPH=1;;
g) GRAPH_FAIL=1;;
esac esac
done done
shift $(($OPTIND - 1)) shift $(($OPTIND - 1))

@ -10,17 +10,19 @@ function usage
{ {
echo "Usage: get_results.sh [-p PROFILE] [-h] [-g]" echo "Usage: get_results.sh [-p PROFILE] [-h] [-g]"
echo "-p CE|PRO default is CE" echo "-p CE|PRO default is CE"
echo "-g generate png flow graphs" echo "-g generate png flow graphs if test fails"
echo "-G generate png all flow graphs"
echo "-h this help" echo "-h this help"
echo "BASE_DIR:${BASE_DIR}" echo "BASE_DIR:${BASE_DIR}"
echo "BIN_DIR:${BIN_DIR}" echo "BIN_DIR:${BIN_DIR}"
} }
while getopts 'hgp:' opt; do while getopts 'hgGp:' opt; do
case $opt in case $opt in
h) usage; exit 0;; h) usage; exit 0;;
g) GRAPH="-G";; G) GRAPH="-G";;
g) GRAPH="-g";;
p) PROFILE=$OPTARG;; p) PROFILE=$OPTARG;;
esac esac
done done

Loading…
Cancel
Save