[asterisk-commits] tilghman: branch tilghman/callparking_retrieval r825 - in /asterisk/team/tilg...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Nov 10 17:06:01 CST 2010
Author: tilghman
Date: Wed Nov 10 17:05:57 2010
New Revision: 825
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=825
Log:
A few remaining tests
Modified:
asterisk/team/tilghman/callparking_retrieval/lib/sh/library.sh
asterisk/team/tilghman/callparking_retrieval/tests/callparking_retrieval/run-test
asterisk/team/tilghman/callparking_retrieval/tests/callparking_retrieval/userB/extensions.conf
asterisk/team/tilghman/callparking_retrieval/tests/pbx/call-files2/run-test
Modified: asterisk/team/tilghman/callparking_retrieval/lib/sh/library.sh
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/tilghman/callparking_retrieval/lib/sh/library.sh?view=diff&rev=825&r1=824&r2=825
==============================================================================
--- asterisk/team/tilghman/callparking_retrieval/lib/sh/library.sh (original)
+++ asterisk/team/tilghman/callparking_retrieval/lib/sh/library.sh Wed Nov 10 17:05:57 2010
@@ -52,7 +52,7 @@
for user in $@; do
echo " >>> Creating configuration directory for $user"
- eval "${user}_tmpdir=`mktemp --tmpdir=/var/tmp -t -d spoolfile_$user.XXXXXX`"
+ eval "${user}_tmpdir=`mktemp --tmpdir=/var/tmp -t -d testsuite_$user.XXXXXX`"
# Shortcut for referral within this loop only
eval "conf=\${${user}_tmpdir}"
@@ -110,11 +110,10 @@
for u in $lib_SYSDIRS; do
eval "conf=\${${u}_tmpdir}"
if test "x$conf" = "x"; then : ; else
- $ASTERISK -C $conf/asterisk.conf -rx "core stop when convenient" >/dev/null 2>&1
- let $u=$?
+ $ASTERISK -C $conf/asterisk.conf -rx "core stop when convenient" >/dev/null 2>&1 &
fi
done
- sleep 1
+ sleep 2
for u in $lib_SYSDIRS; do
eval "conf=\${${u}_tmpdir}"
if test "x$conf" = "x"; then : ; else
@@ -147,7 +146,10 @@
$KILLALL -9 asterisk >/dev/null 2>&1
fi
- rm -rf $userA_tmpdir $userB_tmpdir
+ for u in $lib_SYSDIRS; do
+ eval "rm -rf \${${u}_tmpdir}"
+ done
+
set -e
}
@@ -159,13 +161,18 @@
#
verify_call() {
# Verify that the call is up
- local count=`$ASTERISK -C $1/asterisk.conf -rx "core show channels" | wc -l`
+ if test -d $1; then
+ conf=$1
+ else
+ eval "conf=\${${1}_tmpdir}"
+ fi
+ local count=`$ASTERISK -C $conf/asterisk.conf -rx "core show channels" | wc -l`
if test $count != $(($CSC_HEADERS+$2)); then
echo -n " *** Call generation failed: got $count, but expected "
echo $(($CSC_HEADERS+$2))
if test "$debug" = "1"; then
echo ">>>>>$1>>>>>"
- $ASTERISK -C $1/asterisk.conf -rx "core show channels"
+ $ASTERISK -C $conf/asterisk.conf -rx "core show channels"
echo "<<<<<$1<<<<<"
fi
cleanup
Modified: asterisk/team/tilghman/callparking_retrieval/tests/callparking_retrieval/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/tilghman/callparking_retrieval/tests/callparking_retrieval/run-test?view=diff&rev=825&r1=824&r2=825
==============================================================================
--- asterisk/team/tilghman/callparking_retrieval/tests/callparking_retrieval/run-test (original)
+++ asterisk/team/tilghman/callparking_retrieval/tests/callparking_retrieval/run-test Wed Nov 10 17:05:57 2010
@@ -1,153 +1,40 @@
#!/bin/bash
-set +e
+. lib/sh/library.sh
+
+#debug=1
echo " >>> Starting callparking_retrieval test"
-testdir=${0%%run-test}
-ASTERISK=/usr/sbin/asterisk
-
-case `uname -s` in
- solaris*|sunos*)
- PS="ps -ef"
- KILLALL="pkill"
- ;;
- *)
- PS="ps auxwww"
- KILLALL="killall"
- ;;
-esac
-
-case $2 in
- *-1.4*)
- ORIGINATE='originate'
- CSC_HEADERS=3
- ;;
- *-1.6.2*|*-1.4*)
- ORIGINATE='originate'
- CSC_HEADERS=4
- ;;
- *)
- ORIGINATE='channel originate'
- CSC_HEADERS=4
- ;;
-esac
-
-cleanup() {
- if test "x$userA_tmpdir" = "x"; then : ; else
- $ASTERISK -C $userA_tmpdir/asterisk.conf -rx "core stop now" >/dev/null 2>&1
- fi
- if test "x$userB_tmpdir" = "x"; then : ; else
- $ASTERISK -C $userB_tmpdir/asterisk.conf -rx "core stop now" >/dev/null 2>&1
- fi
- if test "x$userC_tmpdir" = "x"; then : ; else
- $ASTERISK -C $userC_tmpdir/asterisk.conf -rx "core stop now" >/dev/null 2>&1
- fi
- sleep 2
- $KILLALL asterisk
- sleep 1
- $KILLALL -9 asterisk
- rm -rf $userA_tmpdir $userB_tmpdir $userC_tmpdir
- set -e
-}
-
-for user in userA userB userC; do
- echo " >>> Creating configuration directory for $user"
- eval "${user}_tmpdir=`mktemp -t -d callparking_retrieval_$user.XXXXXX`"
- # Shortcut for referral within this loop only
- eval "conf=\${${user}_tmpdir}"
-
- if test "$conf" = ""; then
- echo " *** Unable to create temporary directory for $user"
- cleanup
- exit 1
- fi
-
-
- echo " >>> Creating files in configuration directory"
- for i in ../configs/*.sample; do
- dst=$conf/`basename $i .sample`
- install -m 644 $i $dst
- done
- for i in $testdir$user/*.conf; do
- dst=$conf/`basename $i`
- install -m 644 $i $dst
- done
- ( echo "[directories]"; echo "astetcdir => $conf"; echo "astrundir => $conf"; echo "astlogdir => $testdir/$user"; echo "[options]"; echo "verbose = 10"; echo "documentation_language = en_US" ) > $conf/asterisk.conf
-
- # Verify that files got created properly
- if test -s $conf/asterisk.conf ; then : ; else
- echo " *** Unable to create test configuration files in $conf"
- cleanup
- exit 1
- fi
- echo "Starting Asterisk for $user"
- $ASTERISK -g -C $conf/asterisk.conf
- sleep 1
- # Asterisk is running, right?
- if test `$PS | grep $conf[/] | wc -l` = "0"; then
- echo " *** Unable to start asterisk for $user"
- cleanup
- exit 1
- fi
-done
+initialize userA userB userC
echo " >>> User A is calling user B, who will park the call."
$ASTERISK -C $userA_tmpdir/asterisk.conf -rx "$ORIGINATE Local/wait at parking extension callb at parking" &
sleep 2
# Verify that the call is up
-count=`$ASTERISK -C $userA_tmpdir/asterisk.conf -rx "core show channels" | wc -l`
-if test $count != $(($CSC_HEADERS+3)); then # 3 = 2 sides of Local channel plus outgoing to B
- echo " *** Call generation from user A to user B failed: $count"
- cleanup
- exit 1
-fi
+verify_call userA 3
-sleep 3
+sleep 5
# Verify that the call is up on our bridge server
-count=`$ASTERISK -C $userC_tmpdir/asterisk.conf -rx "core show channels" | wc -l`
-if test $count != $(($CSC_HEADERS+1)); then
- echo " *** User B failed to park the call from user A: $count"
- cleanup
- exit 1
-fi
+verify_call userC 1
echo " >>> User B is retrieving user A from parking, then will attempt to repark it."
$ASTERISK -C $userB_tmpdir/asterisk.conf -rx "$ORIGINATE IAX2/userc/701 at parking extension parka at parking" &
sleep 2
# Verify that the call is up
-count=`$ASTERISK -C $userC_tmpdir/asterisk.conf -rx "core show channels" | wc -l`
-echo "====="
-$ASTERISK -C $userA_tmpdir/asterisk.conf -rx "core show channels"
-echo "-----"
-$ASTERISK -C $userB_tmpdir/asterisk.conf -rx "core show channels"
-echo "-----"
-$ASTERISK -C $userC_tmpdir/asterisk.conf -rx "core show channels"
-if test $count != $(($CSC_HEADERS+2)); then # 2 = channel A linked to B + channel B linked to A
- echo " *** User B failed to retrieve the call from parking: $count"
- cleanup
- exit 1
-fi
+verify_call userC 2
-sleep 3
+# Have to wait for the announcement to complete
+sleep 5
-a_parked=`$ASTERISK -C $userC_tmpdir/asterisk.conf -rx "core show channels" | wc -l`
-echo "====="
-$ASTERISK -C $userA_tmpdir/asterisk.conf -rx "core show channels"
-echo "-----"
-$ASTERISK -C $userB_tmpdir/asterisk.conf -rx "core show channels"
-echo "-----"
-$ASTERISK -C $userC_tmpdir/asterisk.conf -rx "core show channels"
-if test $a_parked != $(($CSC_HEADERS+1)); then
- echo " *** Failed. When user B hung up, user A was not parked and thus hungup as well: $count."
- cleanup
- exit 1
-fi
+verify_call userC 1
-echo "Success!"
+echo " *** Success!"
+
+$ASTERISK -C $userB_tmpdir/asterisk.conf -rx "$ORIGINATE IAX2/userc/701 at parking extension hangup at parking" &
cleanup
Modified: asterisk/team/tilghman/callparking_retrieval/tests/callparking_retrieval/userB/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/tilghman/callparking_retrieval/tests/callparking_retrieval/userB/extensions.conf?view=diff&rev=825&r1=824&r2=825
==============================================================================
--- asterisk/team/tilghman/callparking_retrieval/tests/callparking_retrieval/userB/extensions.conf (original)
+++ asterisk/team/tilghman/callparking_retrieval/tests/callparking_retrieval/userB/extensions.conf Wed Nov 10 17:05:57 2010
@@ -14,3 +14,5 @@
; After retrieving the parked call, try parking it again
exten => parka,1,Goto(userb,1)
+exten => hangup,1,Hangup
+
Modified: asterisk/team/tilghman/callparking_retrieval/tests/pbx/call-files2/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/tilghman/callparking_retrieval/tests/pbx/call-files2/run-test?view=diff&rev=825&r1=824&r2=825
==============================================================================
--- asterisk/team/tilghman/callparking_retrieval/tests/pbx/call-files2/run-test (original)
+++ asterisk/team/tilghman/callparking_retrieval/tests/pbx/call-files2/run-test Wed Nov 10 17:05:57 2010
@@ -57,7 +57,7 @@
create_spool "Local/answer at spoolfile" "donothing" > $userA_tmpdir/spoolfile
mv -f $userA_tmpdir/spoolfile $userA_tmpdir/spool/outgoing/
sleep 1
-verify_call $userA_tmpdir 2
+verify_call $userA_tmpdir 3
sleep 5
More information about the asterisk-commits
mailing list