source: skype/t/livetest-bitlbee.sh @ 25a7eb8

Last change on this file since 25a7eb8 was 25a7eb8, checked in by Miklos Vajna <vmiklos@…>, at 2009-02-17T23:31:13Z

Initial testcase.

Code is based on ulim's automated live tests.

  • Property mode set to 100755
File size: 1.1 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# Run skyped
20python ../skyped.py -c ../skyped.conf > skypedtest.pid
21sleep 2
22
23# Run the test
24echo Running test script...
25"$SCRIPT" $*
26RET=$?
27
28# Kill skyped
29killall -TERM skype
30kill -TERM $(sed 's/.*: //' skypedtest.pid)
31
32# Kill bee
33echo Killing bitlbee...
34kill `cat bitlbeetest.pid`
35
36# Return test result
37[ $RET -eq 0 ] && echo Test passed
38[ $RET -ne 0 ] && echo Test failed
39[ $RET -eq 22 ] && echo '(timed out)'
40[ $RET -eq 66 ] && echo '(environment variables missing)'
41exit $RET
Note: See TracBrowser for help on using the repository browser.