[sr-dev] git:master: tests: use bash compliant return values

Henning Westerholt hw at kamailio.org
Sun Apr 21 19:53:27 CEST 2013


Module: sip-router
Branch: master
Commit: 59117e598386d013d9c9f62282aa434dc5806c03
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=59117e598386d013d9c9f62282aa434dc5806c03

Author: Henning Westerholt <hw at kamailio.org>
Committer: Henning Westerholt <hw at kamailio.org>
Date:   Sun Apr 21 18:30:21 2013 +0200

tests: use bash compliant return values

---

 test/unit/include/database |   12 ++++++------
 test/unit/include/require  |   12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/test/unit/include/database b/test/unit/include/database
index ddc357f..d5e6a0f 100644
--- a/test/unit/include/database
+++ b/test/unit/include/database
@@ -27,12 +27,12 @@ function check_mysql() {
 	$MYSQL "select * from location;" > /dev/null
 	if ! [ "$?" -eq 0 ] ; then
 		echo "can't read from database"
-		return -1
+		return 1
 	fi;
 	$MYSQL "insert into location (user_agent) values ('___test___');" > /dev/null
 	if ! [ "$?" -eq 0 ] ; then
 		echo "can't write to database"
-		return -1
+		return 1
 	fi;
 	$MYSQL "delete from location where user_agent ='___test___';" > /dev/null
 	return 0
@@ -42,12 +42,12 @@ function check_postgres() {
 	$PSQL "select * from location;" > /dev/null
 	if ! [ "$?" -eq 0 ] ; then
 		echo "can't read from database"
-		return -1
+		return 1
 	fi;
 	$PSQL "insert into location (user_agent) values ('___test___');" > /dev/null
 	if ! [ "$?" -eq 0 ] ; then
 		echo "can't write to database"
-		return -1
+		return 1
 	fi;
 	$PSQL "delete from location where user_agent ='___test___';" > /dev/null
 	return 0
@@ -57,12 +57,12 @@ function check_unixodbc() {
 	echo "select * from location;" | $ISQL  > /dev/null
 	if ! [ "$?" -eq 0 ] ; then
 		echo "can't read from database"
-		return -1
+		return 1
 	fi;
 	echo "insert into location (id, user_agent) values ('$RANDOM', '___test___');" | $ISQL > /dev/null
 	if ! [ "$?" -eq 0 ] ; then
 		echo "can't write to database"
-		return -1
+		return 1
 	fi;
 	echo "delete from location where user_agent ='___test___';" | $ISQL > /dev/null
 	return 0
diff --git a/test/unit/include/require b/test/unit/include/require
index f94b877..d08b64b 100644
--- a/test/unit/include/require
+++ b/test/unit/include/require
@@ -21,7 +21,7 @@ source include/common
 function check_kamailio() {
 	if ! (test -e $BIN) ; then
 		echo "kamailio not found, not run"
-		return -1
+		return 1
 	fi;
 	return 0
 }
@@ -29,7 +29,7 @@ function check_kamailio() {
 function check_module() {
 	if [ $# -ne 1 ]; then
 		echo "wrong number of params in check_module()"
-		return -1
+		return 1
 	fi
 
 	if ! (test -e $SR_DIR/modules_k/$1/$1.so) ; then
@@ -39,7 +39,7 @@ function check_module() {
 	fi;
 	if ! (test -e $SR_DIR/modules/$1/$1.so) ; then
 		echo "$SR_DIR/modules/$1/$1.so not found, not run"
-		return -1
+		return 1
 	fi;
 	return 0
 }
@@ -47,7 +47,7 @@ function check_module() {
 function check_netcat() {
 	if ! ( which nc > /dev/null ); then
 		echo "netcat not found, not run"
-		return -1
+		return 1
 	fi;
 	return 0
 }
@@ -55,7 +55,7 @@ function check_netcat() {
 function check_sipp() {
 	if ! ( which sipp > /dev/null ); then
 		echo "sipp not found, not run"
-		return -1
+		return 1
 	fi;
 	return 0
 }
@@ -63,7 +63,7 @@ function check_sipp() {
 function check_sipsak() {
 	if ! ( which sipsak > /dev/null ); then
 		echo "sipsak not found, not run"
-		return -1
+		return 1
 	fi;
 	return 0
 }




More information about the sr-dev mailing list