diff options
-rwxr-xr-x | skype/t/livetest-bitlbee.sh | 82 |
1 files changed, 59 insertions, 23 deletions
diff --git a/skype/t/livetest-bitlbee.sh b/skype/t/livetest-bitlbee.sh index f0027d1c..162dfb8f 100755 --- a/skype/t/livetest-bitlbee.sh +++ b/skype/t/livetest-bitlbee.sh @@ -17,40 +17,76 @@ sleep 2 # Check if it's really running kill -0 `cat bitlbeetest.pid 2>/dev/null ` 2>/dev/null || { echo Failed to run bitlbee daemon on port $PORT; exit 1; } -# Set up skyped - -rm -rf etc -mkdir etc -cd etc -cp ../../skyped.cnf . -cp ~/.skyped/skyped.cert.pem . -cp ~/.skyped/skyped.key.pem . -cd .. -echo "[skyped]" > skyped.conf -echo "username = $TEST_SKYPE_ID" >> skyped.conf -echo "password = $(echo -n $TEST_SKYPE_PASSWORD|sha1sum|sed 's/ *-$//')" >> skyped.conf -# we use ~ here to test that resolve that syntax works -echo "cert = $(pwd|sed "s|$HOME|~|")/etc/skyped.cert.pem" >> skyped.conf -echo "key = $(pwd|sed "s|$HOME|~|")/etc/skyped.key.pem" >> skyped.conf -echo "port = 2727" >> skyped.conf - -# Run skyped -python ../skyped.py -c skyped.conf -l skypedtest.log > skypedtest.pid -sleep 2 +if [ -z "$TUNNELED_MODE" ]; then + # Set up skyped + + rm -rf etc + mkdir etc + cd etc + cp ../../skyped.cnf . + cp ~/.skyped/skyped.cert.pem . + cp ~/.skyped/skyped.key.pem . + cd .. + echo "[skyped]" > skyped.conf + echo "username = $TEST_SKYPE_ID" >> skyped.conf + SHA1=`which sha1sum` + if [ -z "$SHA1" ]; then + SHA1=`which sha1` + fi + if [ -z "$SHA1" ]; then + echo Test failed + echo "(Can't compute password for skyped.conf)" + exit 77 + fi + echo "password = $(echo -n $TEST_SKYPE_PASSWORD|$SHA1|sed 's/ *-$//')" >> skyped.conf + # we use ~ here to test that resolve that syntax works + echo "cert = $(pwd|sed "s|$HOME|~|")/etc/skyped.cert.pem" >> skyped.conf + echo "key = $(pwd|sed "s|$HOME|~|")/etc/skyped.key.pem" >> skyped.conf + echo "port = 2727" >> skyped.conf + + # Run skyped + python ../skyped.py -c skyped.conf -l skypedtest.log > skypedtest.pid + sleep 2 +fi + +if [ "$TUNNELED_MODE" = "yes" ]; then + rm -f tunnel.pid + if [ -n "$TUNNEL_SCRIPT" ]; then + $TUNNEL_SCRIPT & + echo $! > tunnel.pid + sleep 5 + fi +fi # Run the test echo Running test script... "$SCRIPT" $* RET=$? -# Kill skyped -killall -TERM skype -kill -TERM $(sed 's/.*: //' skypedtest.pid) +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) +fi + +if [ "$TUNNELED_MODE" = "yes" ]; then + if [ -n "$TUNNEL_SCRIPT" ]; then + cat tunnel.pid >> /tmp/tunnel.pid + kill `cat tunnel.pid` + rm -f tunnel.pid + fi +fi # Kill bee echo Killing bitlbee... kill `cat bitlbeetest.pid` +if [ "$TUNNELED_MODE" = "yes" ]; then + # give the skyped a chance to timeout + sleep 30 +fi + # Return test result [ $RET -eq 0 ] && echo Test passed [ $RET -ne 0 ] && echo Test failed |