diff options
| -rw-r--r-- | skype/t/Makefile | 8 | ||||
| -rwxr-xr-x | skype/t/irssi/livetest-irssi.sh | 4 | ||||
| -rwxr-xr-x | skype/t/livetest-bitlbee.sh | 84 | 
3 files changed, 69 insertions, 27 deletions
| diff --git a/skype/t/Makefile b/skype/t/Makefile index c58729dc..be960f24 100644 --- a/skype/t/Makefile +++ b/skype/t/Makefile @@ -14,7 +14,13 @@ default: $(tests)  $(tests): % : %.test  	@echo "--- Running test $@ ---"; \ -		if ! ./livetest-bitlbee.sh $(BITLBEE) $(PORT) irssi/livetest-irssi.sh $< >$@.log; then \ +		if [ -r "$(BITLBEE)" -a -x "$(BITLBEE)" ]; then \ +			bitlbee_binary="$(BITLBEE)"; \ +		else \ +			bitlbee_basename=`basename $(BITLBEE)`; \ +			bitlbee_binary=`which $$bitlbee_basename`; \ +		fi; \ +		if ! ./livetest-bitlbee.sh "$$bitlbee_binary" $(PORT) irssi/livetest-irssi.sh $< >$@.log; then \  			echo Test failed, log: ;\  			cat $@.log;\  			exit 1;\ diff --git a/skype/t/irssi/livetest-irssi.sh b/skype/t/irssi/livetest-irssi.sh index 349521a8..a8e136cf 100755 --- a/skype/t/irssi/livetest-irssi.sh +++ b/skype/t/irssi/livetest-irssi.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash  ISCRIPT=$1  OPT=$2 @@ -78,7 +78,7 @@ screen -D -m irssi --config=dotirssi/config --home=dotirssi/ &  # output logs  submitlogs() { -	sed -i -e "s/$TESTLOGIN/---TESTLOGIN---/;s/$TESTPASSWORD/---TESTPASSWORD---/" dotirssi/logs/*.log +	perl -p -i -e "s/$TESTLOGIN/---TESTLOGIN---/;s/$TESTPASSWORD/---TESTPASSWORD---/" dotirssi/logs/*.log  	if [ "$OPT" == "tgz" ]; then  		tar czf "`dirname $0`"/"`basename "$ISCRIPT"`".logs.tgz dotirssi/logs/*.log diff --git a/skype/t/livetest-bitlbee.sh b/skype/t/livetest-bitlbee.sh index dc2f9126..162dfb8f 100755 --- a/skype/t/livetest-bitlbee.sh +++ b/skype/t/livetest-bitlbee.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash  BITLBEE=$1  typeset -ix PORT=`echo $2 | egrep '^[0-9]{1,5}$'`  SCRIPT=$3 @@ -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 | 
