Commit graph

5589 commits

Author SHA1 Message Date
Patrick Ohly 3bcb67178c D-Bus server: use monotonic time for timeouts
gettimeofday() has the disadvantage that it may jump as system time
gets set or adjusted. Timespec::monotonic() avoids that.
2014-04-01 16:45:09 +02:00
Patrick Ohly f44621a5e3 PIM testing: handle test data without photo data
The code was meant to check whether a contact really has contact
data; because the if check was missing, the sync result checking
in testSync failed for test data where one or more contacts had
not photos.
2014-04-01 16:45:09 +02:00
Patrick Ohly 16a6c6affd PIM testing: better timeFunction()
The function now keeps the event loop running while waiting for
completion. That ensures that events get received immediately.

testpim.py now matches the po scanning process because of the _(' text
pattern. We need to exclude it explicitly.
2014-04-01 16:45:09 +02:00
Patrick Ohly 988ad5d2e8 D-Bus GIO: variant with more types
Will be needed for PIM Manager, therefore not also added to D-Bus
libdbus.
2014-04-01 16:45:09 +02:00
Patrick Ohly e29d376df0 Timespec: in-place resetMonotonic() and resetSystem()
The new methods are slightly more efficient for updating an existing
Timespec instance than creating a temporary instance and assigning
that.
2014-04-01 16:45:08 +02:00
Patrick Ohly 3f82f32a0c PIM: add SyncPeerWithFlags() and 'pbap-sync' flag (FDO #70950)
The is new API and flag grant control over the PBAP sync mode. It is
implemented by setting the SYNCEVOLUTION_PBAP_SYNC env variable in the
forked helper process.
2014-04-01 16:45:08 +02:00
Patrick Ohly b202f656dc PBAP: transfer data via pipe (part of FDO #72112)
The main advantage is that processed data can be discarded
immediately. When using a plain file, the entire address book must be
stored in it.

It also enables suspending a transfer by stopping to read from the
pipe, either via some internal API or simply freezing the
syncevo-local-sync process with SIGSTOP.

The drawback is that obexd does not react well to a full pipe. It
simply gets stuck in a blocking write(); in other words, all obexd
operations get frozen and obexd stops responding on D-Bus.
2014-04-01 16:45:08 +02:00
Patrick Ohly 46042c397e signon: fix build
Static build was broken for gSSO and UOA (wrong path name to .la file)
and gSSO was not enabled properly (wrong condition check).
2014-04-01 16:27:29 +02:00
Patrick Ohly 7771ee4ad1 autotools, NEWS: SyncEvolution 1.4.1 2014-03-31 16:35:58 +02:00
Patrick Ohly ef9a89f788 EDS: only load one backend plugin of each kind
SyncEvolution was meant to load the syncecal or syncebook shared object
which uses the most recent libraries (libical, libecal/libebook) on
the system and then stop loading further backends. Due to a string
handling bug the check for already backends always found nothing,
leading to multiple conflicting backends loaded on some systems (for
example, those with libical0 and libical1 installed).

If that happened, the backend became unusable.
2014-03-31 16:08:08 +02:00
Patrick Ohly 9ac06d187f D-Bus testing: fix testAutoSyncNoNetworkManager
In testAutoSyncNoNetworkManager, syncs keep happening while the test
terminates. The processes get killed correctly, but that ocassionally triggers
notifictions which the post-test D-Bus log checking treats as test failures.

To avoid this, truncate the D-Bus log before shutting down. Then all extra
events are available for debugging, but will not be seen by the check code.
2014-03-31 11:12:21 +02:00
Patrick Ohly 4879b697df D-Bus testing: extra sanity checks before starting daemon
Check for an already running instance. Otherwise the new one
will fail to start up, which will be hard to diagnose. Happened
recently when a test was broken and failed to kill its daemon
instance.
2014-03-31 11:12:21 +02:00
Patrick Ohly 2ce83fcb14 testing: updated valgrind supressions for Debian Testing and Ubuntu Saucy
New problems showed up after updating Debian Testing, similar
to what was seen also on Ubuntu Saucy.
2014-03-31 11:12:21 +02:00
Patrick Ohly 93612b5f6d testing: enable dbug mode when running syncevo-http-server
The logs do not get that much larger and the additional output
is useful when debugging problems, so enable it by default.
2014-03-31 11:12:21 +02:00
Patrick Ohly 624c357e11 http server: include time stamps in debug mode
Sometimes time stamps are necessary to understand timing-dependent
issues. A separate flag for timestamps on/off might be useful.
For now, enable them in debug mode.
2014-03-31 11:12:21 +02:00
Patrick Ohly 5713f8ff3d testing: fix akonadi.db creation problem
Occasionally in the nightly testing reading the existing akonadi.db
produced incomplete output which could not be used to create the
modified akonadi.db. This patch works around that by using pre-generated
akonadi.db.dump files as input if found.
2014-03-31 11:12:21 +02:00
Patrick Ohly 4462536f16 testing: split up local testing
"evolution" tests used to be a traditional name for all Client::Source
and SyncEvolution unit tests. This caused problems when adding
Akonadi (crash in Akonadi client lib when EDS was used before) and
was not nice in the test reporting (multiple different tests all mixed
into one summary line). It also prevented running these tests in parallel.

All of this gets fixed by splitting "evolution" into "eds", "kde",
"file" and "unittests". To avoid updating the nightly test run scripts,
--enable evolution=.... is still understood.
2014-03-31 11:12:21 +02:00
Patrick Ohly 7df500d509 testing: create XDG_RUNTIME_DIR in dbus-session.sh
More recent distros (for example, Ubuntu Saucy) rely on
XDG_RUNTIME_DIR. Each time dbus-session.sh runs, it must
ensure that the runtime dir exists and is empty.

Not doing so may have caused random concurrency issues in
parallel nightly testing.

It also was a problem when trying to run activesyncd + SyncEvolution
on a headless Ubuntu Saucy server (see FDO #76273).
2014-03-31 11:12:20 +02:00
Patrick Ohly 07d7a9f306 testing: fix empty DBUS_SESSION_BUS_PID in dbus-session.sh
If the variable was empty (not likely/possible?), then the test became
invalid.
2014-03-31 11:12:20 +02:00
Patrick Ohly e2c76c9e2e testing: remove debug logging from dbus-session.sh
set -x output is not needed anymore, we "echo" everything that is
going on.
2014-03-31 11:12:20 +02:00
Patrick Ohly 5fd70f38e7 testing: use absolute path for valgrind log file
Better assume that the program may change directories. In that
case we need an absolute path for the output file.

Nightly testing failed once because valgrind was not able to
write its output file in the new directory. It remained unclear
why the directory was changed and to what, though. But that is
a different problem.
2014-03-31 11:12:20 +02:00
Patrick Ohly f33db08c43 syncing: remember original path to session dir
Nightly testing uses a "Client_Sync_Current" symlink to point
the server to a location where it shall write its per-test logs
without having to reconfigure the server.

When the server-side session runs longer than a specific test, it ends up
using the "Client_Sync_Current" link of the next test. "permission denied"
errors were also seen, although it is less certain whether that had the same
root cause.

To avoid such issues, the sync session now tries to resolve the log dir
path to an absolute path at the start of the session.
2014-03-31 11:11:56 +02:00
Patrick Ohly ffc0c57402 D-Bus testing: fix testNoParent
When spawning the dlt daemon under "unbuffer", a lingering tclsh process
exists before the test starts and the test ended up waiting for that to
stop.

We need to be more specific with identifying sync processes: only those
processes started as part of syncing matter.
2014-03-31 11:11:41 +02:00
Patrick Ohly 5066fe2a97 D-Bus testing: increase timeouts
On a fully loaded system some tests took longer than expected.
Allow that.
2014-03-31 11:11:34 +02:00
Patrick Ohly cf08b687dc testing: remove LANGUAGE from ATTENDEE
Specifying the language of the email address did not make much sense
to start with, even if EDS does (did?) it that way originally. Akonadi
strips LANGUAGE=en. Instead of filtering that out for Akonadi, better
simplify the test data.
2014-03-26 09:48:53 +01:00
Patrick Ohly 4600c2c0d0 testing: ignore harmless data changes in Akonadi
Akonadi formats iCalendar 2.0 data slightly differently. It is okay
to ignore that in the normalized data before comparison.
2014-03-26 09:48:53 +01:00
Patrick Ohly 3632af817a testing: ignore one more Akonadi 404 failure
The linked item tests also checked for reading non-existent items,
which does not fail as expected with Akonadi.
2014-03-26 09:48:53 +01:00
Patrick Ohly 43309b14fa testing: ignore filekde::file_contact::testItems test failures
The test fails because we don't deal with some of minor data changes
introduced by KDE. Could use some love and care, ignore for now.
2014-03-26 09:48:53 +01:00
Patrick Ohly f9c9a7371c Akonadi: support KDE Notes, enhanced "database" check
The KDE Notes resources store items under a different MIME type than the one
used in AKonadi (see "[Kde-pim] note format"). SyncEvolution use the same type
as Akonadi and thus did not find existing KDE Notes resources.

To support both while KDE and Akonadi transition to the same type,
SyncEvolution now looks for notes resources using both MIME types and accepts
both kinds of items when reading. When writing, SyncEvolution picks the MIME
type that is supported by the resource, which hopefully avoids confusing the
KDE app using the resource (untested).

As a positive side effect, the "database" value used for opening a resource is
now checked more thoroughly. Non-existent resources and the type mismatches
like pointing a "kde-contacts" backend to a calendar resource are now detected
early.
2014-03-26 09:48:52 +01:00
Patrick Ohly a496f9dbfc Akonadi: ensure that UID is set (FDO #74342)
Akonadi resources do not enforce iCalendar 2.0 semantic like
"each VEVENT must have a UID" (see "[Kde-pim] iCalendar semantic").
When receiving an event from a peer which itself does not enforce
that semantic (Funambol, vCalendar 1.0 based phones), then we
need to generate a UID, otherwise KOrganizer will ignore the
imported event.
2014-03-26 09:48:52 +01:00
Patrick Ohly 387a0f58a7 testing: disable "NoID" tests when source does not support iCalendar 2.0 semantic
The tests depend on the source re-adding UID and/or RECURRENCE-ID during an
update. The Akonadi source and file source do not do that and thus we cannot
run the test against them.
2014-03-26 09:48:52 +01:00
Patrick Ohly b97dddc4b2 Akonadi: disable testing of iCalendar 2.0 semantic
Akonadi and Akonadi resources do not enforce iCalendar 2.0 semantic
like "UID+RECURRENCE-ID must be unique in a collection". Therefore we
must disable all tests expecting that behavior.

Regular syncing should work okay as long as the peer behaves. A misbehaving
peer will be able to send us invalid sets of items and syncing will not be
able to detect that because the sync engine itself is also agnostic to the
special iCalendar 2.0 semantic.

See "[Kde-pim] iCalendar semantic".
2014-03-26 09:48:52 +01:00
Patrick Ohly 05c5d53627 testing: simplify Akonadi server startup
Do not run agents that we do not need by setting
AKONADI_DISABLE_AGENT_AUTOSTART=1. See "[Kde-pim] configuring Akonadi server".
2014-03-26 09:48:52 +01:00
Patrick Ohly 6655e5ebe8 syncevo-http-server: remove D-Bus timeouts
Under heavy load while testing, syncing occasionally failed with a D-Bus
message timeout, for example in the Close() call. Let's disable these timeouts
by explicitly passing something very large (infinite is not supported by the
Python bindings).

If HTTP processing takes to long, the client may resend, but in contrast to a
failed D-Bus method call that case is handled.

The increased timeout has no negative effect on detecting when
syncevo-dbus-server dies, because then the D-Bus daemon will notify
us immediately.
2014-03-26 09:48:52 +01:00
Patrick Ohly 55bd6a76f6 testing: optimize sleep 60 in wrapperchecks.h
The previous solution left the "sleep 60" shell command running despite
killing the shell that spawned it. That lingering process caused schroot to
wait during session shutdown, which slowed down result checking considerably.

Now a single Perl process does the sleep and the killing. Killing that
process allows schroot to proceed immediately.
2014-03-26 09:48:52 +01:00
Patrick Ohly 163a27c7d9 testing: more SyncEvolution client/server combinations
filekde covers running Akonadi in HTTP server mode, which was broken in
SyncEvolution 1.4 (see FDO 75672). kdekde and filefile get added for
the sake of completeness.
2014-03-26 09:48:52 +01:00
Patrick Ohly 77ae1f2d09 testing: improved parallel testing of Akonadi
Somehow akonadi.db ends up lacking any resources. Check each sqlite3 call, log
db content and explicitly close akonadiserverc to be more resilient.
2014-03-26 09:48:52 +01:00
Patrick Ohly 2d862c7375 testing: support parallel testing of Akonadi
When cloning the home dir template, take care of adapting
some hard-coded paths in akonadiserverrc and the akonadi.db
used for sqlite. This only works when Akonadi was configured
to use sqlite as backend in the home dir template.
2014-03-26 09:48:52 +01:00
Patrick Ohly 853f70a2a1 Akonadi: avoid threading problem in HTTP server mode (FDO #75672)
When used as storage in a server, Akonadi got called in a background thread
that gets created to handle slow initialization of sources and preventing
ensuing timeouts in HTTP clients (probably not needed for Akonadi itself,
but may still be useful when combining it with other sources).

Akonadi cannot be used like that, leading to false "Akonadi not running"
errors or (if one got past that check) failing item operations.

This commit avoids the situation by shifting the work back into the main
thread.
2014-03-26 09:48:52 +01:00
Patrick Ohly 07bc8414c2 glib: adding GRunInMain() and GRunIsMain()
This is needed to move one-time operations from AkonadiSyncSource into the
main thread if (and only if) the source is used in a background
thread. Akonadi can't be used in a thread unless the thread was created with
QThread, which is not the case in SyncEvolution.

The basic functionality is the same as the older GRunWhile(). It just has to
be extended so that the action is guaranteed to be called only in the main
thread and there runs only once. This is achieved by turning the action
into a check which immediately returns false.

AkonadiSyncSource cannot include GLibSupport.h due to conflicting usage of
"signal" (a define in Qt, parameter name in glib), therefore these functions
are now made available via util.h.
2014-03-26 09:48:52 +01:00
Patrick Ohly 2a63d6d694 testing: check that we get the right VTIMEZONE
Writing a test that ensures that libsynthesis gets the right
timezone was hard, because the original problem only occurs
when syncing a vCalendar 1.0 based device with SyncEvolution.

Emulating libsynthesis at least comes close.
2014-03-26 09:48:52 +01:00
Patrick Ohly 9d13210d0b ical: workaround for libical 1.0 builtin timezone change
libical 1.0 started to return VTIMEZONE definitions with multiple
absolute transition times instead of RRULEs. This causes problems when
exchanging data with peers (see
https://sourceforge.net/p/freeassociation/bugs/95/).

In SyncEvolution, this affected sending an event using New Zealand
time in vCalendar 1.0 format to a phone, because the internal,
out-dated definition of the time zone in libsynthesis was used as
fallback when loading RRULE-based timezone definitions from libical
failed (see "[SyncEvolution] Some events showing wrong time on
phone"). It might also affect exchanging data with CalDAV peers (not
tested).

The workaround is to include the original code from libical from
before the change in SyncEvolution and override
icaltimezone_get_component() with a version that uses the original
timezone loading code. This does not fix cases where other code causes
libical itself to load a timezone, but for libsynthesis it is good
enough because it does the loading early when no other code should
have used libical.

The downside is that now we need to maintain the RRULE heuristics and
ensure that they actually work. Copying libical/src/test/timezones.c
would be useful for that.

Long-term it would be good to enhance libical itself such that it can
return a VTIMEZONE with suitable RRULEs matching a specific event,
point in time or time range.
2014-03-26 09:48:52 +01:00
Patrick Ohly 5d43c5d7e3 ical: support overriding icaltimezone_get_component() in compat layer
Check for icaltimezone_get_component() before actually loading libical.
That way our own code uses our own copy of that method from the copied
icaltz-util.c instead of always using the one from libical.

For that we must not overwriting already found functions.
2014-03-26 09:48:44 +01:00
Patrick Ohly b0ddae71cc ical compatibility: cover more symbols
The additional ones are needed for icaltz-util.c.
2014-03-26 09:48:32 +01:00
Patrick Ohly 8d84ef1ab4 ical: fix gcc 4.4 warning
gcc 4.4 complains about "num_types" being used potentially uninitialized.
This probably refers to bailing out before num_types gets set. However,
the use is conditional on "types", which is only set after "num_types",
so this is a false warning.

Prevent the warning anyway for the sake of clean -Wall -Werror compilation.
2014-03-26 09:42:57 +01:00
Patrick Ohly fd0d1582f7 ical: fix memory leak in case of read error
When EFREAD() does a "goto error", the code leaks the "r_trans"
memory. Found with cppcheck. Adding cleanup code fixes that.

To avoid a false cppcheck warning, the free() call must use the same
variable name as the calloc() assignment. It is a bit more readable
that way, too.
2014-03-26 09:42:57 +01:00
Patrick Ohly cbad1fd697 ical: enable icaltz-util executable
Can be compiled separately when linking against libical. For this
to work it must use header file locations as in libical client
programs.

icaltzutil_get_zone_directory() can come from either libical or
the icatz-util.c copy, depending on DISABLE_ICALTZUTIL_GET_ZONE_DIRECTORY.
2014-03-26 09:42:57 +01:00
Patrick Ohly c0f10a0e21 ical: unistd.h is needed for access()
This allows compiling with -Wall.
2014-03-26 09:42:57 +01:00
Patrick Ohly 4455907097 ical: import icaltz-util
This is an unmodified copy from libical trunk revision 1130, the
latest one before RRULE calculation was removed from the code.

See
https://sourceforge.net/p/freeassociation/code/1130
https://sourceforge.net/p/freeassociation/bugs/95/
2014-03-26 09:42:57 +01:00
Patrick Ohly 912bb10395 EDS: allow compat init before main()
We have to use singleton methods to ensure that the global std::string
instances are initialized before use. There was some non-determinism before
because SyncSource loading happens as part of the executable initialization,
too, and can cause a call to EDSAbiWrapperInit().
2014-03-26 09:42:42 +01:00