summaryrefslogtreecommitdiffstats
path: root/karm/test/__lib.sh
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch)
tree67208f7c145782a7e90b123b982ca78d88cc2c87 /karm/test/__lib.sh
downloadtdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz
tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'karm/test/__lib.sh')
-rw-r--r--karm/test/__lib.sh79
1 files changed, 79 insertions, 0 deletions
diff --git a/karm/test/__lib.sh b/karm/test/__lib.sh
new file mode 100644
index 00000000..06fd9df6
--- /dev/null
+++ b/karm/test/__lib.sh
@@ -0,0 +1,79 @@
+
+# Expects karm test file in $TESTFILE
+# Returns dcop id in $DCOP_ID
+function set_up()
+{
+ DCOPID=`dcop 2>/dev/null | grep karm`
+
+ if [ -n "$DCOPID" ]; then dcop $DCOPID KarmDCOPIface quit; fi;
+
+ if [ "x$SKIP_TESTFILE_DELETE" != "xtrue" ]; then
+ if [ -e "$TESTFILE" ]; then rm $TESTFILE; fi
+ fi
+
+ #echo "__lib.sh - starting karm with $TESTFILE"
+ karm "$TESTFILE" &
+
+ # Make sure karm is up and running
+ limit=10
+ idx=0
+ DCOPID=""
+ while [ "$idx" -lt "$limit" ]
+ do
+ #echo "__lib.sh: dcop 2>/dev/null | grep karm"
+ DCOPID=`dcop 2>/dev/null | grep karm`
+ if [ -n "$DCOPID" ]
+ then
+ break
+ else
+ let "idx += 1"
+ fi
+ sleep 1
+ done
+
+ # It's not enough to get the dcop id, as this is available almost
+ # immediately. We need to make sure karm (and fam) is done loading data.
+ limit=20
+ idx=0
+ KARM_VERSION=""
+ while [ "$idx" -lt "$limit" ]
+ do
+ #echo "__lib.sh: dcop $DCOPID KarmDCOPIface version 2>/dev/null"
+ KARM_VERSION=`dcop $DCOPID KarmDCOPIface version 2>/dev/null`
+ if [ -n "$KARM_VERSION" ]
+ then
+ break
+ else
+ let "idx += 1"
+ fi
+ sleep 1
+ done
+
+ if [ "x$DCOPID" = x ]
+ then
+ echo "__lib.sh set_up error: could not start karm--no dcop id."
+ exit 1
+ else
+ echo "__lib.sh: DCOPID = $DCOPID, KARM_VERSION = $KARM_VERSION"
+ fi
+
+ if [ "x$KARM_VERSION" = x ]
+ then
+ echo "__lib.sh set_up error: karm did not return a version string."
+ exit 1
+ fi
+}
+
+function test_func()
+{
+ echo "Yep, that works."
+}
+
+function tear_down()
+{
+ if [ -n "$DCOPID" ]; then dcop "$DCOPID" KarmDCOPIface quit; fi;
+
+ if [ "x$SKIP_TESTFILE_DELETE" != "xtrue" ]; then
+ if [ -e "$TESTFILE" ]; then rm "$TESTFILE"; fi
+ fi
+}