diff options
author | Miklos Vajna <vmiklos@frugalware.org> | 2011-01-04 02:00:00 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@frugalware.org> | 2011-01-04 02:00:00 +0100 |
commit | c12a5c8202c3391673a4651c769863e6d08ffceb (patch) | |
tree | f5c63bd6e7656dd74d87896bc0194c26adc3147a | |
parent | 6f5ab2a7c46f4388817f800b68141ca163412d37 (diff) |
Make tests a bit more robust
Sometimes skyped exits on startup because of the failure of some
underlying C lib (ie we get no expections), that's not something I want
to care about.
-rw-r--r-- | skype/t/irssi/skype-msg.test | 4 | ||||
-rwxr-xr-x | skype/t/livetest-bitlbee.sh | 25 |
2 files changed, 27 insertions, 2 deletions
diff --git a/skype/t/irssi/skype-msg.test b/skype/t/irssi/skype-msg.test index d1d21e68..d35615cd 100644 --- a/skype/t/irssi/skype-msg.test +++ b/skype/t/irssi/skype-msg.test @@ -8,6 +8,10 @@ TESTPASSWORD="$TEST_SKYPE_PASSWORD" /expectbee 'Account successfully created' -command 'msg $$C account add skype @LOGIN@ @PASSWORD@' /expectbee 'Account successfully added' -command 'msg $$C account 0 set test_join true' /expectbee 'test_join' -command 'msg $$C account 0 on' +# use builtin test service +/expectjoin echo123 -command 'msg $$C echo123: ping, say pong' +/expectbee 'pong' -command 'quit Test Passed' +# use a public bot as well, just in case the above one would fail /expectjoin echo123 -command 'msg $$C add skype pam_bot' /expectjoin pam_bot -command 'msg $$C pam_bot: pambot help' /expectbee 'PamBot, thanks for chatting with me' -command 'quit Test Passed' diff --git a/skype/t/livetest-bitlbee.sh b/skype/t/livetest-bitlbee.sh index 162dfb8f..8aa048ff 100755 --- a/skype/t/livetest-bitlbee.sh +++ b/skype/t/livetest-bitlbee.sh @@ -1,4 +1,21 @@ #!/usr/bin/env bash + +start_skyped() +{ + python ../skyped.py "$@" > skypedtest.pid + while true + do + [ -e skypedtest.pid ] || break + pid=$(sed 's/.*: //' skypedtest.pid) + if [ -e /proc/$pid ]; then + sleep 5 + else + start_skyped "$@" + break + fi + done +} + BITLBEE=$1 typeset -ix PORT=`echo $2 | egrep '^[0-9]{1,5}$'` SCRIPT=$3 @@ -45,7 +62,7 @@ if [ -z "$TUNNELED_MODE" ]; then echo "port = 2727" >> skyped.conf # Run skyped - python ../skyped.py -c skyped.conf -l skypedtest.log > skypedtest.pid + start_skyped -c skyped.conf -l skypedtest.log & sleep 2 fi @@ -67,7 +84,11 @@ if [ -z "$TUNNELED_MODE" ]; then # skyped runs on another host: no means to kill it # Kill skyped killall -TERM skype - kill -TERM $(sed 's/.*: //' skypedtest.pid) + if [ -f skypedtest.pid ]; then + pid=$(sed 's/.*: //' skypedtest.pid) + rm skypedtest.pid + [ -e /proc/$pid ] && kill -TERM $pid + fi fi if [ "$TUNNELED_MODE" = "yes" ]; then |