source: skype/t/livetest-bitlbee.sh @ 9bc60f0

Last change on this file since 9bc60f0 was bcdc24b, checked in by Miklos Vajna <vmiklos@…>, at 2009-02-18T00:30:13Z

skyped: add logfile option

using this option messages are not lost when not running in foreground
mode

  • Property mode set to 100755
File size: 1.6 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 & sleep 2
15
16# Check if it's really running
17kill -0 `cat bitlbeetest.pid 2>/dev/null ` 2>/dev/null || { echo Failed to run bitlbee daemon on port $PORT; exit 1; }
18
19# Set up skyped
20
21rm -rf etc
22mkdir etc
23cd etc
24cp ../../skyped.cnf .
25yes ""|openssl req -new -x509 -days 365 -nodes -config skyped.cnf -out skyped.cert.pem -keyout skyped.key.pem 2> openssl.log
26cd ..
27echo "[skyped]" > skyped.conf
28echo "username = $TEST_SKYPE_ID" >> skyped.conf
29echo "password = $(echo -n $TEST_SKYPE_PASSWORD|sha1sum|sed 's/ *-$//')" >> skyped.conf
30echo "cert = $(pwd)/etc/skyped.cert.pem" >> skyped.conf
31echo "key = $(pwd)/etc/skyped.key.pem" >> skyped.conf
32echo "port = 2727" >> skyped.conf
33
34# Run skyped
35python ../skyped.py -c skyped.conf -l skypedtest.log > skypedtest.pid
36sleep 2
37
38# Run the test
39echo Running test script...
40"$SCRIPT" $*
41RET=$?
42
43# Kill skyped
44killall -TERM skype
45kill -TERM $(sed 's/.*: //' skypedtest.pid)
46
47# Kill bee
48echo Killing bitlbee...
49kill `cat bitlbeetest.pid`
50
51# Return test result
52[ $RET -eq 0 ] && echo Test passed
53[ $RET -ne 0 ] && echo Test failed
54[ $RET -eq 22 ] && echo '(timed out)'
55[ $RET -eq 66 ] && echo '(environment variables missing)'
56exit $RET
Note: See TracBrowser for help on using the repository browser.