addressbook tests: Run with private D-Bus session and environment.
[platform/upstream/evolution-data-server.git] / tests / tools / eds.sh
1 #
2 # Helper functions to start your own e-d-s instance. This depends
3 # on you having your own D-Bus session bus started (first).
4 #
5 #
6 # Copyright (C) 2011 Collabora Ltd. <http://www.collabora.co.uk/>
7 #
8 # Copying and distribution of this file, with or without modification,
9 # are permitted in any medium without royalty provided the copyright
10 # notice and this notice are preserved.
11
12 eds_tmpdir=$(mktemp -d)
13
14 eds_init_settings () {
15     export XDG_DATA_HOME=$eds_tmpdir/.local
16     export XDG_CACHE_HOME=$eds_tmpdir/.cache
17     export XDG_CONFIG_HOME=$eds_tmpdir/.config
18 }
19
20 # This makes sure that our locally-built service starts,
21 # in our already-started private D-Bus session,
22 # so we don't need to use a .service file to make sure that it will be 
23 # activated instead. 
24 eds_start() {
25    #$(top_builddir)/addressbook/libedata-book/e-addressbook-factory -r
26    $cur_dir"/../../addressbook/libedata-book/e-addressbook-factory" -r&
27    eds_pid=$!
28 }
29
30 # This should be called on INT TERM and EXIT
31 eds_stop () {
32     kill $eds_pid
33     rm -rf $eds_tmpdir
34     rm -rf $eds_tmpdir
35 }
36