source: skype/t/livetest-bitlbee.sh @ 2ef7d37

Last change on this file since 2ef7d37 was be22e7b, checked in by Miklos Vajna <vmiklos@…>, at 2010-08-03T13:42:15Z

t/livetest-bitlbee: redirect bitlbee's stderr to a logfile, not useful to see that as long as it works

  • Property mode set to 100755
File size: 1.9 KB
RevLine 
[25a7eb8]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...
[be22e7b]14$VALGRIND $BITLBEE -n -c bitlbee.conf -d livetest/ -D -P bitlbeetest.pid -p $PORT 2>bitlbee.log &
15sleep 2
[25a7eb8]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
[fbd6c69]20# Set up skyped
21
22rm -rf etc
23mkdir etc
24cd etc
25cp ../../skyped.cnf .
[3d88f65]26if [ ! -e ~/.skyped/skyped.cert.pem -o ! -e ~/.skyped/skyped.key.pem ]; then
27        yes ""|openssl req -new -x509 -days 365 -nodes -config skyped.cnf -out skyped.cert.pem -keyout skyped.key.pem 2> openssl.log
28else
29        cp ~/.skyped/skyped.cert.pem .
30        cp ~/.skyped/skyped.key.pem .
31fi
[fbd6c69]32cd ..
33echo "[skyped]" > skyped.conf
34echo "username = $TEST_SKYPE_ID" >> skyped.conf
35echo "password = $(echo -n $TEST_SKYPE_PASSWORD|sha1sum|sed 's/ *-$//')" >> skyped.conf
[7cc2c1e]36# we use ~ here to test that resolve that syntax works
37echo "cert = $(pwd|sed "s|$HOME|~|")/etc/skyped.cert.pem" >> skyped.conf
38echo "key = $(pwd|sed "s|$HOME|~|")/etc/skyped.key.pem" >> skyped.conf
[fbd6c69]39echo "port = 2727" >> skyped.conf
40
[25a7eb8]41# Run skyped
[bcdc24b]42python ../skyped.py -c skyped.conf -l skypedtest.log > skypedtest.pid
[25a7eb8]43sleep 2
44
45# Run the test
46echo Running test script...
47"$SCRIPT" $*
48RET=$?
49
50# Kill skyped
51killall -TERM skype
52kill -TERM $(sed 's/.*: //' skypedtest.pid)
53
54# Kill bee
55echo Killing bitlbee...
56kill `cat bitlbeetest.pid`
57
58# Return test result
59[ $RET -eq 0 ] && echo Test passed
60[ $RET -ne 0 ] && echo Test failed
61[ $RET -eq 22 ] && echo '(timed out)'
62[ $RET -eq 66 ] && echo '(environment variables missing)'
63exit $RET
Note: See TracBrowser for help on using the repository browser.