rm printfs
This commit is contained in:
parent
3453dae0db
commit
0d7351093b
2 changed files with 8 additions and 13 deletions
|
|
@ -900,7 +900,6 @@ kv_lock(xmldb_handle xh,
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
// struct kv_handle *kh = handle(xh);
|
// struct kv_handle *kh = handle(xh);
|
||||||
fprintf(stderr, "%s %s %d\n", __FUNCTION__, db, pid);
|
|
||||||
if (strcmp("running", db) == 0)
|
if (strcmp("running", db) == 0)
|
||||||
_running_locked = pid;
|
_running_locked = pid;
|
||||||
else if (strcmp("candidate", db) == 0)
|
else if (strcmp("candidate", db) == 0)
|
||||||
|
|
@ -912,8 +911,6 @@ kv_lock(xmldb_handle xh,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
clicon_debug(1, "%s: locked by %u", db, pid);
|
clicon_debug(1, "%s: locked by %u", db, pid);
|
||||||
fprintf(stderr, "running:%d candidate:%d startup:%d\n",
|
|
||||||
_running_locked, _candidate_locked, _startup_locked);
|
|
||||||
retval = 0;
|
retval = 0;
|
||||||
done:
|
done:
|
||||||
return retval;
|
return retval;
|
||||||
|
|
@ -933,7 +930,6 @@ kv_unlock(xmldb_handle xh,
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
// struct kv_handle *kh = handle(xh);
|
// struct kv_handle *kh = handle(xh);
|
||||||
fprintf(stderr, "%s %s\n", __FUNCTION__, db);
|
|
||||||
if (strcmp("running", db) == 0)
|
if (strcmp("running", db) == 0)
|
||||||
_running_locked = 0;
|
_running_locked = 0;
|
||||||
else if (strcmp("candidate", db) == 0)
|
else if (strcmp("candidate", db) == 0)
|
||||||
|
|
@ -984,9 +980,6 @@ kv_islocked(xmldb_handle xh,
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
// struct kv_handle *kh = handle(xh);
|
// struct kv_handle *kh = handle(xh);
|
||||||
|
|
||||||
fprintf(stderr, "%s %s\n", __FUNCTION__, db);
|
|
||||||
fprintf(stderr, "running:%d candidate:%d startup:%d\n",
|
|
||||||
_running_locked, _candidate_locked, _startup_locked);
|
|
||||||
if (strcmp("running", db) == 0)
|
if (strcmp("running", db) == 0)
|
||||||
retval = _running_locked;
|
retval = _running_locked;
|
||||||
else if (strcmp("candidate", db) == 0)
|
else if (strcmp("candidate", db) == 0)
|
||||||
|
|
|
||||||
14
test/lib.sh
14
test/lib.sh
|
|
@ -5,7 +5,9 @@ testnname=
|
||||||
clixon_cf=/usr/local/etc/routing.conf
|
clixon_cf=/usr/local/etc/routing.conf
|
||||||
# error and exit, arg is optional extra errmsg
|
# error and exit, arg is optional extra errmsg
|
||||||
err(){
|
err(){
|
||||||
echo "Error in Test$testnr [$testname] $1"
|
echo "Error in Test$testnr [$testname]:"
|
||||||
|
echo "Expected: $1"
|
||||||
|
echo "Received: $2"
|
||||||
exit $testnr
|
exit $testnr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -28,7 +30,7 @@ expectfn(){
|
||||||
fi
|
fi
|
||||||
ret=`$cmd`
|
ret=`$cmd`
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err "wrong args"
|
||||||
fi
|
fi
|
||||||
# Match if both are empty string
|
# Match if both are empty string
|
||||||
if [ -z "$ret" -a -z "$expect" ]; then
|
if [ -z "$ret" -a -z "$expect" ]; then
|
||||||
|
|
@ -40,12 +42,12 @@ expectfn(){
|
||||||
# echo "expect:\"$expect\""
|
# echo "expect:\"$expect\""
|
||||||
# echo "match:\"$match\""
|
# echo "match:\"$match\""
|
||||||
if [ -z "$match" ]; then
|
if [ -z "$match" ]; then
|
||||||
err "Expected:\"$expect\" Got:\"$ret\""
|
err $expect "$ret"
|
||||||
fi
|
fi
|
||||||
if [ -n "$expect2" ]; then
|
if [ -n "$expect2" ]; then
|
||||||
match=`echo "$ret" | grep -EZo "$expect2"`
|
match=`echo "$ret" | grep -EZo "$expect2"`
|
||||||
if [ -z "$match" ]; then
|
if [ -z "$match" ]; then
|
||||||
err "Expected:\"$expect\" Got: \"$ret\""
|
err $expect "$ret"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
@ -71,7 +73,7 @@ EOF
|
||||||
# echo "expect:\"$expect\""
|
# echo "expect:\"$expect\""
|
||||||
# echo "match:\"$match\""
|
# echo "match:\"$match\""
|
||||||
if [ -z "$match" ]; then
|
if [ -z "$match" ]; then
|
||||||
err "Expected:\"$expect\" Got: \"$ret\""
|
err "$expect" "$ret"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -88,7 +90,7 @@ expectwait(){
|
||||||
read ret
|
read ret
|
||||||
match=$(echo "$ret" | grep -Eo "$expect");
|
match=$(echo "$ret" | grep -Eo "$expect");
|
||||||
if [ -z "$match" ]; then
|
if [ -z "$match" ]; then
|
||||||
err "\nExpected:\t\"$expect\"\nGot:\t\"$ret\""
|
err $expect "$ret"
|
||||||
fi
|
fi
|
||||||
break
|
break
|
||||||
done
|
done
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue