diff options
| author | Philippe Crama <pcfeb0009@gmx.com> | 2011-01-03 21:44:01 +0100 | 
|---|---|---|
| committer | Philippe Crama <pcfeb0009@gmx.com> | 2011-01-03 21:44:01 +0100 | 
| commit | dc3f9ef400a4640fd69d7a7c8bf021399fcae767 (patch) | |
| tree | b042321fddfaaf542c7a222b89e0437eb5419bc0 | |
| parent | 51f0c2b8756c63774c507f000dc06d5d56f4cbf7 (diff) | |
Add TUNNELED_MODE and TUNNEL_SCRIPT environment variables
When TUNNELED_MODE=yes, TUNNEL_SCRIPT (when set) is used to establish a
tunnel.  This allows to run skyped.py on a differnt host than the skype.c
bitlbee plugin.
| -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 | 
