Browse Source

tests: use bash compliant return values

Henning Westerholt 12 years ago
parent
commit
59117e5983
2 changed files with 12 additions and 12 deletions
  1. 6 6
      test/unit/include/database
  2. 6 6
      test/unit/include/require

+ 6 - 6
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

+ 6 - 6
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
 }