diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2011-07-24 13:51:00 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2011-07-24 13:51:00 +0100 |
commit | c8b8c83fb6a0ae1b59de71ac796a78d73e444988 (patch) | |
tree | 9fdc9d1393353e663132b34cff0b8c16fb1e014c /protocols/skype/t/irssi/livetest-irssi.sh | |
parent | a01049810d7101b8c0014aa7b36826fc95f944a5 (diff) | |
parent | 17f6079a06eaed2fba1da999332e9e5ac1dbc2a6 (diff) |
Merging Skype plugin. Many thanks to Miklos Vajna for all his work on this,
having this distributed together with BitlBee will hopefully make up for the
fact that BitlBee has poor binary API backward compatibility.
Diffstat (limited to 'protocols/skype/t/irssi/livetest-irssi.sh')
-rwxr-xr-x | protocols/skype/t/irssi/livetest-irssi.sh | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/protocols/skype/t/irssi/livetest-irssi.sh b/protocols/skype/t/irssi/livetest-irssi.sh new file mode 100755 index 00000000..a8e136cf --- /dev/null +++ b/protocols/skype/t/irssi/livetest-irssi.sh @@ -0,0 +1,109 @@ +#!/usr/bin/env bash +ISCRIPT=$1 +OPT=$2 + +[ -n "$ISCRIPT" ] || { echo Syntax: `basename "$0"` irssi-test-script; exit 1; } + +# Load variables from test +eval `sed -e '1,/^###/!d;/^###/d' "$ISCRIPT"` + +#if [ "$OPT" == "checkvars" ]; then echo $TESTNEEDEDVARS; fi +RET=0 + +# Check if we have the neccessary environment variables for this test +for var in $TESTNEEDEDVARS; do + if [ -z `eval echo \$\{$var\}` ]; then + if [ "$OPT" != "checkvars" ]; then + echo Need environment variable "$var" for this test. + exit 66 + else + echo $var + RET=66 + fi + fi +done + +# if we got this far we're OK +if [ "$OPT" == "checkvars" ]; then exit $RET; fi + +[ -n "$PORT" ] || { echo 'Need the bitlbee listening port as environment variable PORT'; exit 1; } + +# Setup the irssi dir +( + rm -r dotirssi + mkdir -p dotirssi/scripts dotirssi/logs + cp "`dirname $0`"/trigger.pl dotirssi/scripts && + echo 'script load trigger.pl' >dotirssi/startup +) &>/dev/null || { echo Failed to setup irssi testdir; exit 1; } + +# write irssi config + +echo ' + +aliases = { + runtest = "'`sed -e "1,/^###/d;s/@LOGIN@/$TESTLOGIN/;s/@PASSWORD@/$TESTPASSWORD/" "$ISCRIPT" | tr '\n' ';'`'"; + expectbee = "/trigger add -publics -channels &bitlbee -regexp"; + expectjoin = "/trigger add -joins -masks *!$0@* $1-"; + expectmsg = "/trigger add -privmsgs -masks *!$0@* $1-"; +}; + +servers = ( { address = "localhost"; chatnet = "local"; port = "'$PORT'"; autoconnect="yes";}); + +settings = { + settings_autosave = "no"; + core = { real_name = "bitlbee-test"; user_name = "bitlbee-test"; nick = "bitlbeetest"; }; + "fe-text" = { actlist_sort = "refnum"; }; +}; + +chatnets = { local = { type = "IRC"; autosendcmd = "/runtest"; }; }; + +logs = { +"dotirssi/logs/status.log" = { auto_open = "yes"; level = "ALL"; items = ( { type = "window"; name = "1"; } ); }; +"dotirssi/logs/control.log" = { auto_open = "yes"; level = "ALL"; items = ( { type = "target"; name = "&bitlbee"; } ); }; +' >dotirssi/config + +for nick in $TESTLOGNICKS; do + echo ' + "dotirssi/logs/'$nick'.log" = { auto_open = "yes"; level = "ALL"; items = ( { type = "target"; name = "'$nick'"; } ); }; + ' >>dotirssi/config +done + +echo '};' >>dotirssi/config + +# Go! + +echo Running irssi... +screen -D -m irssi --config=dotirssi/config --home=dotirssi/ & + +# output logs + +submitlogs() { + perl -p -i -e "s/$TESTLOGIN/---TESTLOGIN---/;s/$TESTPASSWORD/---TESTPASSWORD---/" dotirssi/logs/*.log + + if [ "$OPT" == "tgz" ]; then + tar czf "`dirname $0`"/"`basename "$ISCRIPT"`".logs.tgz dotirssi/logs/*.log + elif [ "$OPT" == "ctest" ]; then + echo CTEST_FULL_OUTPUT + for log in dotirssi/logs/*.log; do + echo -n '<DartMeasurement name="'$log'" type="text/string"><![CDATA[' + cat "$log" + echo "]]></DartMeasurement>" + done + else + echo Test logs: dotirssi/logs/*.log + fi +} + +# timeout stuff + +t=$TESTDURATION +intval=1 +while (( t >= intval )); do + sleep $intval + kill -0 $! &>/dev/null || { echo screen/irssi terminated.; submitlogs; bash -c "cd dotirssi/logs && $TESTCHECKRESULT" >/dev/null; exit $?; } + t=$(( t - $intval )) +done +echo Killing screen/irssi... +kill $! +submitlogs +exit 22 |