Commit graph

5096 commits

Author SHA1 Message Date
Patrick Ohly
e6c5d574ae Folks: avoid warnings when unsetting photo
The code which removed a photo from a contact did it by creating a
g_file_icon() with a NULL GFile. This is invalid and caused warnings
from glib. Eventually it must have passed NULL to folks, which is what
the new code does directly.
2013-02-26 12:03:45 +01:00
Patrick Ohly
84855750f9 PIM: fix initialization of folks backends
The FolksBackendStore must be prepared before disabling or enabling
backends. Using the wrong order caused ERROR messages about using a
NULL key file.
2013-02-26 12:03:45 +01:00
Patrick Ohly
882ff26695 PIM: capture libphonenumber output
Don't let libphonenumber write to stdout. Instead redirect into
SyncEvolution logging and manage severity level. For example,
previously parsing errors of phone numbers were logged as [ERROR] by
libphonenumber. Now that appears as "phonenumber error: ...".
2013-02-26 12:03:45 +01:00
Patrick Ohly
22a809beae logging: more independent of namespace
The previous macros assumed to be used inside the SyncEvo namespace
and had problems when used in a context where "Logger" was resolved to
something other than SyncEvo::Logger. Making that more explicit solved
that problem.
2013-02-26 12:03:45 +01:00
Patrick Ohly
cf01f9296f D-Bus testing: enhanced checking of D-Bus and stdout log
Adds the possibility to check the servers standard output
similar to its D-Bus log output. Both can now also be set
before invoking runTest() because that method no longer
sets the members.
2013-02-26 12:03:45 +01:00
Patrick Ohly
227cab6953 EDS: direct access with EDS master
Use e_book_client_connect_direct_sync(), the official API, when
available. Support for e_book_client_new_direct() is still in the
code; it can be removed onces the 3.6 openismus-work branch adapts the
official API.
2013-02-26 12:03:45 +01:00
Patrick Ohly
a01824793e PBAP: support Bluez 5
The new Bluez 5 API is the third supported API for doing PBAP
transfers. It gets checked first, then the PBAB backend falls back to
new-style obexd (file based, similar to Bluez 5, but not quite the
same) and finally old-style obexd (data transfer via D-Bus).

In contrast to previous APIs, Bluez 5 does not report the reason for a
failed PBAP transfer. SyncEvolution then throws a generic "transfer
failed" error with "reason unknown" as message.
2013-02-26 12:03:44 +01:00
Patrick Ohly
4946adeb83 PIM testing: turn testActive into performance test
When using more than 10 contacts (TESTPIM_TEST_ACTIVE_NUM), logging
and polling are turned towards causing less work by testpim.py itself.

TESTPIM_TEST_ACTIVE_RESPONSE can be used to give a maximum response
time in seconds, which gets checked by watchdog by calling
GetAllPeers().

This is relevant in two cases, data loaded before folks starts reading
from EDS (TESTPIM_TEST_ACTIVE_LOAD set) and folks getting change
notifications as SyncEvolution imports data into EDS (not set).

Related to FDO #60851. Currently SyncEvolution+Folks do not pass the
performance test.
2013-02-26 12:03:44 +01:00
Patrick Ohly
fa83ec1538 PIM testing: introduce watchdog
The server must remain responsive at all times. The new Watchdog
class tests that by calling GetAllPeers() at regular intervals. It
can only be used in tests which do not block the event processing
in the Python script itself.

Once the watchdog runs, it must be removed when a test stops.  The new
cleanup test member can be used to add cleanup code at runtime which
will be called when tearing down the test.
2013-02-26 12:03:44 +01:00
Patrick Ohly
8b2b79f0cc PIM testing: avoid large ReadContacts() calls
The D-Bus server has to respond to the entire request at once, which
makes it unresponsive. Needs to be avoided in the client, because
doing it on the server side is too complicated. The server would have
to start gathering results, but those results may become invalid again
in response to processing events before it can send them out.

Related to BGO #60851.
2013-02-26 12:03:44 +01:00
Patrick Ohly
c6f872228f PIM testing: fix testRead test case
The \n in the testRead vCard was interpreted by Python instead of
being written into the file. Must mark the string as raw. Did not
affect the test itself, but the libebook vCard parser reported
warnings.
2013-02-26 12:03:44 +01:00
Patrick Ohly
459d6a49bf PIM: debug messages for modifying contact
Track which changes need to be stored and how that gets processed. Was
useful for finding that modifying groups failed when the groups hadn't
actually changed.
2013-02-26 12:03:44 +01:00
Patrick Ohly
6323155dd0 PIM: adapt to gee 0.8
The latest folks from master uses gee 0.8. Requires changing some
GeeHashSet instantiations due to an API change.
2013-02-26 12:03:44 +01:00
Patrick Ohly
1f082efdf3 PIM testing: testActive for large number of contacts
Setting TESTPIM_TEST_ACTIVE_NUM to a value larger than 10 enables a
mode with less logging and more efficient event handling in
runUntil. Useful for performance testing, because otherwise testpim.py
itself consumes considerable CPU cycles.
2013-02-26 12:03:44 +01:00
Patrick Ohly
7c029afcb6 PIM testing: more efficient ViewAgent
Support disabling of logging in ViewAgent. Necessary when dealing with
large views.
2013-02-26 12:03:43 +01:00
Patrick Ohly
91b79834c7 D-Bus testing: improved logging
Log message now contain time stamps. A NullLogging class mimics the
Logging interface and can be used instead of that to suppress logging.

As a side effect of turning the log() method into a wrapper, the D-Bus
signal is now called "log2", which makes it possible to search for it
case-insensitively in emacs without finding the LogOutput signal.
2013-02-26 12:03:43 +01:00
Patrick Ohly
5ae059affc D-Bus testing: optionally use gzip
The dbus-monitor output can be very large. Handle that a bit better by
compressing the file with a gzip pipe. Experimental and a bit broken:
output is not flushed properly when killing dbus-monitor + gzip.
2013-02-26 12:03:43 +01:00
Patrick Ohly
9156ff3598 D-Bus testing: more efficient runUntil
An different approach is taken when runUntil() is called with
may_block=True: it lets the main loop run for 0.5 seconds and then
returns to do the status checking. No logging is done for each check.
This is meant for long-running operations where the 0.5 second latency
doesn't matter and too frequent checking and logging cause overhead.

The default code path checks every 0.1 second and recognizes
progress (defined as "there was an event to be processed"), which then
causes debug logging about waiting.
2013-02-26 12:03:43 +01:00
Patrick Ohly
1c125ac680 PIM testing: avoid reading multiple times
Mark pending reads by adding the start time. Avoid requesting data
again which is still pending. Relevant when dealing with many contacts
in testActive, helps performance by avoiding redundant operations.
2013-02-26 12:03:43 +01:00
Patrick Ohly
cd5a3944cd D-Bus server: reduce D-Bus log messages
Sending DEBUG messages via the LogOutput signal is expensive and often
not necessary. Ideally LogOutput should only send data that someone is
interested in. The problem is that the SyncEvolution D-Bus API has no
way of specifying that and some clients, like dbus-monitor, would not be
able to use it.

Therefore this commit makes the default level of detail configurable
when syncevo-dbus-server is started, via a separate --dbus-verbosity
option.

This gets applied to output generated from syncevo-dbus-server itself
as well as output from sync sessions.

test-dbus.py exposes that via a new TEST_DBUS_QUIET option. The
default is to include DEBUG output. When TEST_DBUS_QUIET is set to a
non-empty string, only ERROR and INFO messages are sent.
2013-02-26 12:03:43 +01:00
Patrick Ohly
179590135f D-Bus testing: avoid extranuous message about SIGTERM
The message was printed also when there were no children to kill
that way. Now also include the process list of hanging children.
2013-02-26 12:03:43 +01:00
Patrick Ohly
5d0b2bb89b D-Bus testing: TEST_DBUS_VERBOSE shows logging messages
When setting TEST_DBUS_VERBOSE to a non-empty value, all the Python
log messages are printed directly. TEST_DBUS_GDB implies
TEST_DBUS_VERBOSE.
2013-02-26 12:03:43 +01:00
Patrick Ohly
b29ffb2da7 PIM: introduce CreateConfig()
That SetPeer() allows modifying and creating a config leads to race
conditions when multiple clients want to create a config. The new
CreateConfig() avoids that by atomically checking that a config does
not exist yet and creating it.

SetPeer() is still available for backwards compatibility. It continues
to be used for modifying an existing config in TestContacts.testSync
to check the effect of the logging settings.
2013-02-26 12:03:43 +01:00
Patrick Ohly
3c0fee9536 PIM: support location = GEO property (FDO #60373)
Exposed as "location" -> (lat, long) in the D-Bus bindings.
Reading, writing and updating are supported. Depends on a folks
release which has the patch which adds FolksLocationDetails.

Default EDS test data now includes GEO. Several peers do not support
it, which gets ignored by synccompare.
2013-02-26 12:03:43 +01:00
Patrick Ohly
0dfc364d82 PIM: support groups = CATEGORIES (FDO #60380)
Allow reading and writing of groups (folks terminology), aka
CATEGORIES in vCard.
2013-02-26 12:03:43 +01:00
Patrick Ohly
b81aa5ab3c engine: support GEO property (part of FDO #60374)
Was lost earlier during syncing. Must be defined in field list and
vCard profile. Still not supported by PIM Manager, because folks doesn't
support it (see FDO #60373).
2013-02-26 12:03:42 +01:00
Patrick Ohly
2659d3358b PIM: fix memory leaks during writing of contacts
Constructing the GValues created additional references instead
of taking over ownership as intended. For refcounted GObject,
the solution is to pass the instance and let GValue take the
reference.

For other cases, ownership of a new instance is transfered to the
GValue using the new constructors with a boolean flag.
2013-02-26 12:03:42 +01:00
Patrick Ohly
cf30d7b0fe GValue: support constructors which take ownership
The existing constructors with native data pointers
always copied data or increased the reference counter.
It is useful to store the result of creation methods
directly in a GValue, so allow that with a second
variation of the constructors which explicitly take
an "addRef" parameter.
2013-02-26 12:03:42 +01:00
Patrick Ohly
4add4e91fe syslog: fix read-after-free bug
openlog() expects the string to remain valid. Must ensure that in
LoggerSyslog by making a copy. Found with valgrind.
2013-02-26 12:03:42 +01:00
Patrick Ohly
0c99abad29 PIM testing: D-Bus methods thread-safe
The test must be activated by compiling manager.cpp with
PIM_MANAGER_TEST_THREADING and then runs start() in a new
thread which gets created during startup.
2013-02-26 12:03:42 +01:00
Patrick Ohly
612db449d5 PIM Manager: make some of the D-Bus methods thread-safe, attempt II
The first attempt was buggy: the idle callback is always active and
prevents sleeping => 100% CPU load. It also seems to prevent proper
shutdown somehow.

This version is much simpler. It removes the task queue and the
manager's idle callback. Instead the non-main thread adds an idle
callback itself which gets run once. To have the main thread notice
the new idle callback, g_main_context_wakeup() is used, as before.

The reason for not using this approach before was that the glib
documentation only mentioned GAsyncQueue as one of its structures
which are thread-safe. A look at the code shows that GMainContext and
GMainLoop are also thread-safe.
2013-02-26 12:03:42 +01:00
Patrick Ohly
fecfd3f69d PIM Manager: make some of the D-Bus methods thread-safe
This adds the infrastructure for shifting the work of the D-Bus
methods into the main thread if called by another thread, which may
happen when we add other bindings for them.

Work is shifted to the main thread via a GAsyncQueue +
g_main_context_wakeup(). The calling thread then blocks waiting on a
condition variable until signaled by the main thread. Results are
stored for the calling thread as part of the operation that it
provides. Exceptions in the main thread are caught+serialized as
string and deserialized+rethrown in the calling thread - a bit crude,
but should work and reuses existing code.
2013-02-26 12:03:42 +01:00
Patrick Ohly
501c32c06d Exception: tryRethrow() can be used to throw in all cases
It is useful to let tryRethrow be used in a mode where it never
returns. The PIM Manager will use that.
2013-02-26 12:03:42 +01:00
Patrick Ohly
771d630400 glib: support ...CXX::steal() and ..StealCXX() for non-GObject
This makes the C++ plain GLib types like GMainLoop consistent
with their GObject counterparts.
2013-02-26 12:03:42 +01:00
Patrick Ohly
388a196510 CalDAV: work around Google server regression (undeclared namespace prefix in XML)
Google CalDAV currently sends invalid XML back when asked to include
CardDAV properties in a PROPFIND. This gets rejected in the XML
parser, which prevents syncing calendar data:
   Neon error code 1: XML parse error at line 55: undeclared namespace prefix

The incorrect XML is this:
  <D:propstat>
   <D:status>HTTP/1.1 404 Not Found</D:status>
   <D:prop>
   ...
    <caldav:max-attendees-per-instance/>
    <ns1:addressbook-home-set xmlns:ns1="urn:ietf:params:xml:ns:carddav"/>
==> <ns1:principal-address/>
    <ns1:addressbook-description/>
    <ns1:supported-address-data/>
    <ns1:max-resource-size/>
   </D:prop>
  </D:propstat>

This was introduced on the server side sometime after December 12nd
2012 (tests run at that time showed a different response) and does not
affect SyncEvolution 1.2 because it did not yet ask for CardDAV
properties.

The workaround on the client side is to ask for only the properties
which are really needed.
2013-02-26 12:03:42 +01:00
Patrick Ohly
e83b58e933 PIM testing: include PHOTO data in testSync
Photo data is special. Syncing it was not covered elsewhere, so
include it in the testSync test.
2013-02-26 12:03:41 +01:00
Patrick Ohly
0d2201605a PIM testing: fixed testSync with Nokia phone
Must exclude SyncML configs and logs when checking files. Ignore the
empty vCard that the N97 mini insists on sending via PBAP.
2013-02-26 12:03:41 +01:00
Patrick Ohly
83cdc39c66 PIM testing: handle missing config dirs
Don't try to list non-existent directories, that causes an uncaught
Python exception. Happens when using testpim.py for the first time
in a clean directory.
2013-02-26 12:03:41 +01:00
Patrick Ohly
b202533b7d command line: recover from slow sync with new sync modes
The error message for an unexpected slow sync still mentioned
the old and obsolete "refresh-from-client/server" sync modes.
Better mention "refresh-from-local/remote".
2013-02-26 12:03:41 +01:00
Patrick Ohly
505b2cd63d Merge tag 'syncevolution-1-3-99-2' 2013-02-26 12:02:16 +01:00
Mario Kicherer
57a6c5a214 sqlite: add #include <stdio.h>
Fails to compile on Gentoo with gcc 4.5.4 otherwise because the header
file is needed for sprintf.
2013-01-15 16:26:12 +01:00
Patrick Ohly
453ee98740 autotools: bump version to 1.3.99.2 2012-12-12 18:57:17 +01:00
Patrick Ohly
16a532893b Revert "SyncML: workarounds for broken peers"
This reverts commit 3a71a2bf53 and
commit a0375e0160.

Need to back out the workaround for broken peers because it breaks
SyncEvolution<->SyncEvolution syncing.
2012-12-12 18:56:10 +01:00
Patrick Ohly
f1e7d92265 NEWS, PIM API + README: updated for 1.3.99.2 2012-12-07 20:09:08 +01:00
Patrick Ohly
677f2efd18 testing: support --enable dist=<configure flags>
Allow the runtest.py caller to choose which kind of distcheck
is done. When "dist" has parameters, then those are used
as distcheck configure flags instead of trying out a set
of default ones.
2012-12-07 20:09:08 +01:00
Patrick Ohly
cabcfedae7 PIM Manager: don't prevent auto termination when idle
When compiled with PIM Manager, syncevo-dbus-server still should
shut down automatically when idle. Only when the PIM Manager was
started and has (or will have) a unified address book, then keep
the process running.
2012-12-07 20:09:08 +01:00
Patrick Ohly
3a6c0c35c7 debugging: revise suppression rule
The old suppression rule for a problem with ESourceRegistry no
longer matched after introducing EDSRegistryLoader. Support old and
new flavor.
2012-12-07 20:09:08 +01:00
Patrick Ohly
c02571bcf5 autotools: fix "make distcheck" when LD_LIBRARY_PATH is set
Because of a space instead of colon the command line for the
link check was broken when LD_LIBRARY_PATH was non-empty.
2012-12-07 20:09:08 +01:00
Patrick Ohly
b38c88b40c PIM: avoid compiler warnings in 32 bit
gcc warns about a "long int" vs. "unsigned int" mismatch when
compiling for x86. All of that is in debugging output printfs.
Cast the index_t into long int to avoid that.
2012-12-07 20:09:08 +01:00
Patrick Ohly
2e48d4ef9d PIM: fix signed/unsigned comparison warning
g++ in contrast to clang++ warns about this.
2012-12-07 20:09:08 +01:00