source: skype/t/livetest-bitlbee.sh @ c6e0218

Last change on this file since c6e0218 was 77aa416, checked in by Miklos Vajna <vmiklos@…>, at 2010-12-11T15:16:47Z

Cleanup, now we handle certs generated by openssl-1.0

  • Property mode set to 100755
File size: 1.7 KB
Line 
1#!/bin/bash
2BITLBEE=$1
3typeset -ix PORT=`echo $2 | egrep '^[0-9]{1,5}$'`
4SCRIPT=$3
5shift 3
6
7[ -n "$SCRIPT" -a -n "$BITLBEE" -a -e "$SCRIPT" -a "$PORT" -ne 0 ] || { echo Syntax: `basename "$0"` bitlbee-executable listening-port test-script test-script-args; exit 1; }
8
9# Create or empty test dir
10mkdir livetest 2>/dev/null || rm livetest/bitlbeetest*.xml bitlbeetest.pid 2>/dev/null
11
12# Run the bee
13echo Running bitlbee...
14$VALGRIND $BITLBEE -n -c bitlbee.conf -d livetest/ -D -P bitlbeetest.pid -p $PORT 2>bitlbee.log &
15sleep 2
16
17# Check if it's really running
18kill -0 `cat bitlbeetest.pid 2>/dev/null ` 2>/dev/null || { echo Failed to run bitlbee daemon on port $PORT; exit 1; }
19
20# Set up skyped
21
22rm -rf etc
23mkdir etc
24cd etc
25cp ../../skyped.cnf .
26cp ~/.skyped/skyped.cert.pem .
27cp ~/.skyped/skyped.key.pem .
28cd ..
29echo "[skyped]" > skyped.conf
30echo "username = $TEST_SKYPE_ID" >> skyped.conf
31echo "password = $(echo -n $TEST_SKYPE_PASSWORD|sha1sum|sed 's/ *-$//')" >> skyped.conf
32# we use ~ here to test that resolve that syntax works
33echo "cert = $(pwd|sed "s|$HOME|~|")/etc/skyped.cert.pem" >> skyped.conf
34echo "key = $(pwd|sed "s|$HOME|~|")/etc/skyped.key.pem" >> skyped.conf
35echo "port = 2727" >> skyped.conf
36
37# Run skyped
38python ../skyped.py -c skyped.conf -l skypedtest.log > skypedtest.pid
39sleep 2
40
41# Run the test
42echo Running test script...
43"$SCRIPT" $*
44RET=$?
45
46# Kill skyped
47killall -TERM skype
48kill -TERM $(sed 's/.*: //' skypedtest.pid)
49
50# Kill bee
51echo Killing bitlbee...
52kill `cat bitlbeetest.pid`
53
54# Return test result
55[ $RET -eq 0 ] && echo Test passed
56[ $RET -ne 0 ] && echo Test failed
57[ $RET -eq 22 ] && echo '(timed out)'
58[ $RET -eq 66 ] && echo '(environment variables missing)'
59exit $RET
Note: See TracBrowser for help on using the repository browser.