source: skype/t/livetest-bitlbee.sh @ 3d88f65

Last change on this file since 3d88f65 was 3d88f65, checked in by Miklos Vajna <vmiklos@…>, at 2010-08-03T11:57:08Z

tests: don't generate new certs all the time if not needed

this is a hack, looks like openssl-1.0 generates something which is not
compatible with python-gnutls, let's reuse what we have for now

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