Commit graph

1392 commits

Author SHA1 Message Date
Patrick Ohly 7ca22d8db8 testing: avoid undefined vararg after reference
clang 3.4 warns about undefined behavior when applying va_start()
to a reference. We have to use a pointer here to avoid that.
2014-07-23 10:48:19 +02:00
Patrick Ohly eaeb528896 autotools: fix linking of dbus-client-server against pcre
When building shared binaries, the pcre libs must be explicitly
listed because dbus-client-server calls them through test.c.
2014-07-23 10:48:19 +02:00
Patrick Ohly 8e333f0a46 glib: avoid deprecated g_type_init and g_thread_init
Calling them triggers warnings with newer glib which are fatal
when compiling with -Werror.
2014-07-23 10:48:19 +02:00
Patrick Ohly fda741136f testing: include syncevo-webdav-lookup in test binaries
syncevo-webdav-lookup is needed during testing when doing
WebDAV database scans, so build it in "src" like the rest
of the binaries and link to it in the installed test suite.
2014-07-21 10:40:57 +02:00
Patrick Ohly 124f6e7b2c testing: uninstall synclog2html
The test script was installed, but not uninstalled.
2014-07-21 10:40:57 +02:00
Patrick Ohly 43ab1aba81 Google Calendar: remove child hack, improve alarm hack (FDO #63881)
Google recently enhanced support for RECURRENCE-ID, so SyncEvolution
no longer needs to replace the property when uploading a single
detached event with RECURRENCE-ID. However, several things are still
broken in the server, with no workaround in SyncEvolution:
- Removing individual events gets ignored by the server;
  a full "wipe out server data" might work (untested).
- When updating the parent event, all child events also get
  updated even though they were included unchanged in the data
  sent by SyncEvolution.
- The RECURRENCE-ID of a child event of an all-day recurring event
  does not get stored properly.
- The update hack seems to fail for complex meetings: uploading them
  once and then deleting them seems to make uploading them again
  impossible.

All of these issues were reported to Google and are worked on there,
so perhaps the situation will improve. In the meantime, syncing with
Google CalDAV should better be limited to:
- Downloading a Google calendar in one-way mode.
- Two-way syncing of simple calendars without complex meeting
  serieses.

While updating the Google workarounds, the alarm hack (sending a
new event without alarms twice to avoid the automatic server side
alarm) was simplified. Now the new event gets sent only once with a
pseudo-alarm.
2014-07-14 04:46:29 -07:00
Patrick Ohly 6b131dc27f testing: refresh test data
Google seems to have changed its PHOTO rewriting. If that keeps
happening, we need to stop comparing the actual data.

However, comparing the actual data is useful to detect when we
do not properly handle it. For example, in testUpdateRemoteWins/local-synced
it was a bit surprising that only one contact had to be updated at first.

It turned out that libsynthesis did not compare the entire photo data,
only the part before embedded null bytes.
2014-07-14 04:43:05 -07:00
Patrick Ohly bbe782a658 testing: ignore some more Akonadi runtime files
Seen after updating Debian Testing.
2014-07-11 11:57:14 +02:00
Patrick Ohly 845b0ba614 testing: ignore minor leak when using DLT 2014-07-11 11:57:14 +02:00
Patrick Ohly 5aee365225 testing: use inline cppcheck suppressions for libsynthesis
cppcheck 1.65 finds several false positives which are easier
to handle with inline suppressions.
2014-07-03 11:20:10 +02:00
Patrick Ohly 764e9eee79 testing: fix cppcheck ClientTest::registerTests() warning
cppcheck warns that "factory" might get overwritten. Probably
never happened becaued registerTests() is only called once, but
let's fix it anyway.
2014-07-03 11:20:10 +02:00
Patrick Ohly e71b925f17 config templates: Funambol URLs
Funambol turned of the URL redirect from my.funambol.com to
onemedia.com. The Funambol template now uses the current URL.  Users
with existing Funambol configs must updated the syncURL property
manually to https://onemediahub.com/sync

Kudos to Daniel Clement for reporting the change.
2014-05-22 17:05:01 +02:00
Patrick Ohly 1dcbf3988d testing: enable sync tests for Google CardDAV
For performance reasons we only run selected Client::Sync
tests with Google CardDAV (each PUT/POST and DELETE take 10
seconds because of some intentional delay on the server).

Some Google-specific tests should also be run.
2014-05-19 21:33:45 +02:00
Patrick Ohly ae84edf417 testing: simulate remote item manipulation
Traditionally, SyncEvolution only modified remote data via syncing.
This is not enough because it does not cover data on the remote side
that SyncEvolution cannot sync.

The new tests solve this by using the command line's import/update
operations which modify data more or less directly.

Now we can test:
- downloading data created remotely
- uploading data via sync, export directly, compare
- simulate conflicts with changes made remotely

The download and upload test include full round-trips, i.e.
the initial transfer plus a change that needs to be synced back.

Because this is highly dependent on the exact data stored by the
peer, all these tests depend on per-peer test data and scripts
for modifying that data. The tests only get enabled if the test
data is found.

The initial test data covers Apple Calendar server, EDS<->EDS
and Google Contacts.
2014-05-19 21:33:45 +02:00
Patrick Ohly 933d10f97c CardDAV: use Apple/Google/CardDAV vCard flavor
In principle, CardDAV servers support arbitrary vCard 3.0
data. Extensions can be different and need to be preserved. However,
when multiple different clients or the server's Web UI interpret the
vCards, they need to agree on the semantic of these vCard extensions.

In practice, CardDAV was pushed by Apple and Apple clients are
probably the most common clients of CardDAV services. When the Google
Contacts Web UI creates or edits a contact, Google CardDAV will
send that data using the vCard flavor used by Apple.

Therefore it makes sense to exchange contacts with *all* CardDAV
servers using that format. This format could be made configurable in
SyncEvolution on a case-by-case basis; at the moment, it is
hard-coded.

During syncing, SyncEvolution takes care to translate between the
vCard flavor used internally (based on Evolution) and the CardDAV
vCard flavor. This mapping includes:

X-AIM/JABBER/... <-> IMPP + X-SERVICE-TYPE

  Any IMPP property declared as X-SERVICE-TYPE=AIM will get
  mapped to X-AIM. Same for others. Some IMPP service types
  have no known X- property extension; they are stored in
  EDS as IMPP. X- property extensions without a known X-SERVICE-TYPE
  (for example, GaduGadu and Groupwise) are stored with
  X-SERVICE-TYPE values chosen by SyncEvolution so that
  Google CardDAV preserves them (GroupWise with mixed case
  got translated by Google into Groupwise, so the latter is used).

  Google always sends an X-ABLabel:Other for IMPP. This is ignored
  because the service type overrides it.

  The value itself also gets transformed during the mapping. IMPP uses
  an URI as value, with a chat protocol (like "aim" or "xmpp") and
  some protocol specific identifier. For each X- extension the
  protocol is determined by the property name and the value is the
  protocol specific identifier without URL encoding.

X-SPOUSE/MANAGER/ASSISTANT <-> X-ABRELATEDNAMES + X-ABLabel

  The mapping is based on the X-ABLabel property attached to
  the X-ABRELATEDNAMES property. This depends on the English
  words "Spouse", "Manager", "Assistant" that Google CardDAV
  and Apple devices seem to use regardless of the configured
  language.

  As with IMPP, only the subset of related names which have
  a corresponding X- property extension get mapped. The rest
  is stored in EDS using the X-ABRELATEDNAMES property.

X-ANNIVERSARY <-> X-ABDATE

  Same here, with X-ABLabel:Anniversary as the special case
  which gets mapped.

X-ABLabel parameter <-> property

  CardDAV vCards have labels attached to arbitrary other properties
  (TEL, ADR, X-ABDATE, X-ABRELATEDNAMES, ...) via vCard group tags:
  item1.X-ABDATE:2010-01-01
  item1.X-ABLabel:Anniversary

  The advantage is that property values can contain arbitrary
  characters, including line breaks and double quotation marks,
  which is not possible in property parameters.

  Neither EDS nor KDE (judging from the lack of responses on the
  KDE-PIM mailing list) support custom labels. SyncEvolution could
  have used grouping as it is done in CardDAV, but grouping is not
  used much (not at all?) by the UIs working with the vCards in EDS
  and KDE. It seemed easier to use a new X-ABLabel parameter.

  Characters which cannot be stored in a parameter get converted
  (double space to single space, line break to space, etc.) during
  syncing. In practice, these characters don't appear in X-ABLabel
  properties anyway because neither Apple nor Google UIs allow entering
  them for custom labels.

  The "Other" label is used by Google even in case where it adds no
  information. For example, all XMPP properties have an associated
  X-ABLabel=Other although the Web UI does not provide a means to edit
  or show such a label. Editing the text before the value in the UI
  changes the X-SERVICE-TYPE parameter value, not the X-ABLabel as for
  other fields.

  Therefore the "Other" label is ignored by removing it during syncing.

X-EVOLUTION-UI-SLOT (the parameter used in Evolution to determine the
order of properties in the UI) gets stored in CardDAV. The only exception
is Google CardDAV which got confused when an IMPP property had both
X-SERVICE-TYPE and X-EVOLUTION-UI-SLOT parameters set. For Google,
X-EVOLUTION-UI-SLOT is only sent on other properties and thus ordering
of chat information can get lost when syncing with Google.

CardDAV needs to use test data with the new CardDAV vCard flavor.
Most CardDAV servers can store EDS vCards and thus
Client::Source::*::testImport passed (with minor tweaks in
synccompare) when using the default eds_contact.vcf, but
Client::Sync::*::testItems fails when comparing synced data with test
cases when the synced data uses the native format and the test cases
are still the ones from EDS.

A libsynthesis with URLENCODE/DECODE() and sharedfield parameter for
<property> is needed.
2014-05-19 21:33:38 +02:00
Patrick Ohly f61e417360 synccompare: properly support quoted string parameters
The previous, regular expression based reordering of parameters broke
parameters containing semicolons in quoted strings. The splitting must
be done using a proper parser which knows whether a semicolon
delimits a parameter (outside of quotation marks) or is part of the
parameter value (inside quotation marks).

synccompare now also normalizes the quoting of parameter values:
quotation marks are used for anything more complex than alphanumeric
plus underscore and hyphen.
2014-05-19 11:55:12 +02:00
Patrick Ohly 68f6640612 synccompare: ignore remaining X-ABLabel in group
When removing an empty property, we may still have the corresponding
X-ABLabel left. Remove that, too.

Example:
item1.URL:
item1.X-ABLabel:Other
2014-05-19 11:55:12 +02:00
Patrick Ohly 18a18d057e synccompare: IMPP + X-ABLabel:Other normalization
Google CardDAV always adds the "Other" label to IMPP properties.
Ignore this by replacing the group of these two properties
with just the IMPP property. The normalization is intentionally
only done for two grouped properties. If we end up with more,
we need to check what that means instead of removing the label.
It's also more efficient and easier to implement this way.
2014-05-17 21:31:29 +02:00
Patrick Ohly 87dd789b99 synccompare: handle grouping
Grouped properties are sorted first according to the actual property
name, then related properties are moved to the place where their group
tag appears first. The first grouped property gets a "- " prefix, all
following ones are just indended with "  ". The actual group tag is not
part of the normalized output, because its value is irrelevant:

BDAY:19701230
- EMAIL:john@custom.com
  X-ABLabel:custom-label2
...
FN:Mr. John 1 Doe Sr.
- IMPP;X-SERVICE-TYPE=AIM:aim:aim
  X-ABLabel:Other
...
- X-ABDATE:19710101
  X-ABLabel:Anniversary

Redundant tags (those set for only a single property) get removed as
part of normalizing an item.
2014-05-17 21:31:29 +02:00
Patrick Ohly 9efa21496f autotools: avoid redundancy in installation of test files
testcase files used to be installed in src/testcases.am, using a duplicated
list of files. Better do it in test/test.am with the canonical list of files
and only install generated files in src/testcases.am. This makes it easier
to extend the list in the future.
2014-05-16 11:26:55 +02:00
Patrick Ohly f0df27f407 testing: relax gnutls leak suppression
Also happens with realloc.
2014-05-05 09:28:14 +02:00
Patrick Ohly 56c106703a testing: ignore Apple Calendar Server 5.2 VTIMEZONE bug
As confirmed by Cyrus Daboo, Apple Calendar Server 5.2 should
return VTIMEZONE embedded in the item data if matching against
well-known timezones fails. This broken when Apple implemented
support for timezones via reference.

Long term we need to support that feature, but for now it and
this bug are not important because for most timezones, we should
be fine with our TZID based mapping. Ignore the issue during
testing...
2014-05-05 09:28:14 +02:00
Patrick Ohly eedc598a1a synccompare: optionally ignore VTIMEZONE definitions
Depends on CLIENT_TEST_NO_TIMEZONES. Needed to work around
an Apple Calendar Server bug.
2014-05-05 09:28:14 +02:00
Patrick Ohly c5cec8e62b testing: try harder to send email
When any kind of exception occurs, send an email with the exception
because it is likely that the real result email was not sent.
2014-05-05 09:28:13 +02:00
Patrick Ohly b25f175284 autotools: remove duplicate eds_contact.vcf
This crept in during the conversion to the non-recursive build.
It was not a problem for "make dist", but when using the list in rules
it causes make warnings.
2014-05-02 16:43:53 +02:00
Patrick Ohly 51d21e8127 D-Bus testing: fix TestFileNotify
The test assumed that it can rename the main syncevo-dbus-server
executable to trigger the file watch mechanism. That's not correct:
- It might be the system's /usr/libexec/syncevo-dbus-server,
  which a normal user cannot rename.
- The binary might be also active in some other, parallel tests.
  Renaming it interferes with those other tests.

The latter happened in the nightly testing: HTTP server tests with
a long-running syncevo-dbus-server failed because the daemon terminated
during the tests.
2014-05-02 16:43:52 +02:00
Patrick Ohly de8461f802 code restructing: Exception, throwError()
Raising exceptions via throwError() looses the original source code
location information. Fixing that by explicitly passing that
information as additional parameter, created with the preprocessor
macro SE_HERE.

Several files included the complex SyncContext.h only because needed
throwError(). A better place for the revised implementation is the
Exception class which used to be in util.h, now Exception.h.

Simplifying the include statements exposed indirect include
dependencies and removed "using namespace std" from the compilation of
some source files which happened to rely on it. We want to get rid of
that name space polution, so fix the code instead of adding it back.
2014-05-02 16:43:52 +02:00
Patrick Ohly 27af370ac2 WebDAV: do not mangle UID when sending items
The WebDAV backends contained a hack where the UID inside the data was forced
to be identical to the resource name. This is wrong for items created by us
via POST (because the server may choose a resource name != UID) or by some
other entity (where we have no idea how the resource name got chosen).

This commit removes the hack. Testing must be updated to pass correct data
with the same UID as on the server when updating an item, because the backend
will no longer ensure that and changing the UID of a resource gets rejected by
some servers.

The hack was introduced for peers which do not store the UID (for example, a
vCard or iCalendar 1.0 based SyncML client). A better solution must be found,
probably involving the Synthesis engine and its read/update/write cycle.
2014-05-02 16:43:44 +02:00
Patrick Ohly 03a7b4f1ab DAV: more efficient item creation
PUT has the disadvantage that a client needs to choose a name and then
figure out what the real name on the server is. With Google CardDAV that
requires sending another request and only works because the server happens
to remember the original name (which is not guaranteed!).

POST works for new items without a name and happens to be implemented
by Google such that the response already includes all required
information (new name and revision string).

POST is checked for as described in RFC 5995 once before creating a new
item. Servers which don't support it continue to get a PUT.

The 403 status code must be checked to detect UID conflicts when adding
an item that already exists on the server.
2014-04-24 04:32:19 -07:00
Patrick Ohly 1afcdb5de8 testing: further Akonadi parallel test fixes
When running Akonadi with the reference home dir, it creates
a socket symlink that we must not copy. Otherwise all Akonadi
instances end up sharing the same Unix domain socket name and
thus Akonadi instance.
2014-04-24 04:32:18 -07:00
Patrick Ohly b57ae0d319 testing: more verbose HTTP server testing
Seeing all daemon output is useful and does not bloat the logs too
much, enable it permanently.
2014-04-24 04:32:18 -07:00
Patrick Ohly 0d2d047cdc testing: more logging around directory handling
Sometimes os.getcwd() returns an empty string. Not sure why, perhaps
more logging will help to track this down.
2014-04-24 04:32:18 -07:00
Patrick Ohly 9e00e3154e testing: ignore ESourceRegistry unref leak 2014-04-24 04:32:18 -07:00
Patrick Ohly 32e3e92de7 testing: ignore locale when invoking certain shell tools
When testing for specific output of shell tools, we need to ensure that the
system locale (typically engineering English) is active, otherwise we end
up with mismatches when the error messages get translated.
2014-04-24 04:32:18 -07:00
Patrick Ohly 15bb6dcc23 testing: replace CT_ASSERT_TRUE
The macro was supposed to help Clang scan-build detect that error
paths are not taken. However, it caused the expression to be
evaluated twice, which is not okay for some more recent checks.

Instead we now enable either the real assert or our simplified check,
depending on a custom CT_ASSERT_SIMPLE that has to be set when running with
scan-build.

The same applies to "no throw" asserts. To keep the wrapper macros
simple, we pass the same statement twice.
2014-04-24 04:30:34 -07:00
Patrick Ohly 225a1c3eed testing: use simpler shell for result checking
The --shell value used for Clang build-scan builds includes
scan-build and an additional wrapper script. These extra commands
break result checking. Instead of trying to filter them out,
use the new, optional --simple-shell.
2014-04-24 04:30:34 -07:00
Patrick Ohly d89ca72d01 D-Bus: use streams for direct IPC with GIO
When using GIO, it is possible to avoid the DBusServer listening on a
publicly accessible address. Connection setup becomes more reliable,
too, because the D-Bus server side can detect that a child died
because the connection will be closed.

When using libdbus, the traditional server/listen and client/connect
model is still used. GDBus GIO mimicks the same API to minimize
changes in ForkExec. The API gets simplified to support both
approaches:
- Choosing an address is no longer possible (was only used in the
  test example anyway)
- The new connection callback must be specified already when starting
  the server.

The GDBus GIO implementation uses SyncEvolution utility code. Strictly
speaking, this creates a circular dependency
libsyncevolution<->libgdbus. This is solved by not linking libgdbus
against libsyncevolution and expecting executables to do that instead.

The GDBus GIO example no longer linked because of that; it gets removed
because it was of little value.

Now that we started using CLOEXEC, we might as well use it for the
permanent file descriptors created for each ForkExec instance.
2014-04-01 16:45:09 +02:00
Patrick Ohly 3c01a1ebf6 PIM: enhanced progress notifications (FDO #72114)
This adds GetPeerStatus() and "progress" events.

To detect DB changes as they happen, the SyncSource operations are
monitored. Upon entry, a counter gets increased and transmitted
through to the PIM manager in syncevo-dbus-server using extended
SourceProgress structs (only visible internally - public API must not
be extended!). This will count operations which fail and count those
twice which get resumed, so the counts will be too high
occasionally. That is in line with the API definition; because it is
not exact, the API only exposes a "modified" flag.

Progress is reported based on the "item received" Synthesis event and
the total item count. A modified libsynthesis is needed where the
SyncML binfile client on the target side of the local sync actually
sends the total item count (via NumberOfChanges). This cannot be done
yet right at the start of the sync, only the second SyncML message
will have it. That is acceptable, because completion is reached very
quickly anyway for syncs involving only one message.

At the moment, SyncContext::displaySourceProgress() holds back "item
received" events until a different event needs to be emitted. Progress
reporting might get more fine-grained when adding allowing held back
events to be emitted at a fixed rate, every 0.1s. This is not done yet
because it seems to work well enough already.

For testing and demonstration purposes, sync.py gets command line
arguments for setting progress frequency and showing progress either
via listening to signals or polling.
2014-04-01 16:45:09 +02:00
Patrick Ohly 940f1ba7d8 sync output: hide "<source>: started" INFO messages
These messages get printed at the start of processing each
SyncML message. This is not particularly useful and just
adds noise to the output.
2014-04-01 16:45:09 +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 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 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 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 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 62c835ea69 testing: ignore some more leaks 2014-03-19 19:26:15 +01:00
Patrick Ohly 10a2d04519 testing: link client-test with original LDFLAGS
On some platforms, LDFLAGS is used during configure to set rpath
options. runtests.py must pass the -no-install to the linker
of client-test without overwriting those flags.
2014-03-19 19:26:15 +01:00
Patrick Ohly 969c794606 D-Bus testing: must ping server more often in testNoTerm
The test randomly failed under load because the client's GetVersion
call did not make it to the server in time. It seems to work better
with a smaller delay.
2014-02-16 20:56:14 +01:00
Patrick Ohly f033cb9297 D-Bus testing: more debug output for testNoTerm
The test randomly fails. Perhaps we can find out why with a dump
of the actual D-Bus exception.
2014-02-13 07:30:52 -08:00
Patrick Ohly 553703f237 testing: ignore repeated TZID suffices
With DAViCal, the "EST/EDT" VTIMEZONE gets renamed by e_cal_check_timezones()
because DAViCal reorders properties and thus breaking the simple string
comparison even though the semantic of the timezone did not change.

If this happens multiple times (for example, in testTwinning), the test
failed because the " 1" suffix was only stripped once. We also need to
ignore multiple repeated suffices (" 1 1") because e_cal_check_timezones()
is not intelligent enough to bump an existing suffix.

Long term, it would be better to teach e_cal_check_timezones() how to
normalize timezones before the comparison and thus avoiding the duplicated
timezones in the first place.
2014-02-13 07:26:07 -08:00
Patrick Ohly 43d4a00963 D-Bus testing: remove race condition in testNoParent
The test relied on fixed timeouts for a) killing syncevo-dbus-server
and b) completion of the sync. The second timeout sometimes occurred
to soon, causing the testNoParent itself to fail and also the following
test (because log files from testNoParent were not removed).

Now be more careful about really killing in the middle of the sync (thanks
to delaying the sync and not the helper startup) and really wait for process
termination (with getChildren() and os.kill() checking).
2014-02-12 12:52:56 +01:00
Patrick Ohly 6f08c6de8d testing: ignore Google CalDAV backslash encoding problem
Google CalDAV server does not handle \\\n properly. It adds
an extra backslash. Avoid this aspect of the test case because
a fix on the server side has been slow in coming.

eds_event.ics.googlecalendar.tem.patch is used with
Client::Sync::eds_event and Google CalDAV as server. google_event.ics
is used for Client::Source::google_caldav.
2014-02-12 12:52:09 +01:00
Patrick Ohly 33428312b2 D-Bus testing: allow more time when running under valgrind
valgrind on Ubuntu Saucy is slower than on previous distros.
Need to increase timeouts to get tests to pass.
2014-02-12 12:52:09 +01:00
Patrick Ohly 816c756d7b testing: ignore some minor (false) valgrind leaks
Started to appear when testing on Ubuntu Saucy and Trusty and/or
with GDBus GIO over sockets. Seems minor.
2014-02-12 12:52:09 +01:00
Patrick Ohly 0385fbae55 testing: ignore Memotoo X-AIM merge failure
Memotoo should preserve X-AIM during merge conflict handling.
Instead it drops the extension. Ignore the problem, it was reported
via email and we can't work around it.

https://lists.syncevolution.org/pipermail/syncevolution/2012-July/003711.html
2014-02-12 12:52:08 +01:00
Patrick Ohly 466199d318 testing: ignore Google CardDAV X- testRemoveProperties problem
Google CardDAV preserves X- properties when they are not included
in an update. Perhaps sending them as empty properties would work.
In the meantime, ignore the failure by stripping X- props before
comparison.
2014-02-12 12:52:08 +01:00
Patrick Ohly 6c972c4684 testing: parallel runtests.py
Testing on one platform can only be sped up further by parallelizing
it. Each action started by runtests.py may potentially run in parallel
to other actions, if it either does not need files in the home
directory (like checking out source) or can be run in its own, private
home directory.

The new --home-template parameter specifies the location of a home
directory that runtests.py can copy to create these private home
directory of each test. Each action is run in a fork of the main
runtests.py, so env and working directory changes are confined to that
fork and do not affect other actions.

When --home-template is given, runtests.py will also set up a new home
directory and point to it with HOME,
XDG_CACHE/CONFIG/DATA_HOME. Because test-dbus.py and testpim.py use a
non-standard layout of the XDG dirs without directories hidden by the
leading dot, runtests.py must move the standard directories to conform
with the other scripts' expectation.

testpim.py itself must be more flexible and allow running with a root
for the XDG dirs that is not called "temp-testpim". To allow parallel
tests, GNOME keyrings must be located in XDG_DATA_HOME, which is
supported since gnome-keyring 3.6. On older distros, parallel testing
does not work because gnome-keyring-daemon would always look in the
home directory as specified in /etc/passwd, which we cannot override.
testpim.py must not delete the keyrings when cleaning up the XDG dirs
for a test.

Locking Murphy resources and allocating jobs from GNU make jobserver
gets moved into a separate script which wraps the actual execution of
the action. Some change would have been necessary anyway (we cannot
connect to D-Bus and then fork) and the new approach is cleaner. It
ensures that cut-and-paste of the action command line into a shell
will only run with the necessary Murphy resource locked. Previously,
it might have conflicted with a running test.

As a new feature, test names as passed to resources.py can be mapped
to actual resource names via RESOURCE_<test name> env
variables. Useful for tests with different names which use the same
resources (currently DAViCal for the DAV server tests).
2014-02-03 14:30:45 +01:00
Patrick Ohly 856185019c testing: more time for TestCmdline.testSyncOutput2
When running under valgrind on a loaded machine, the test might run
for more than the 200s allowed earlier.
2014-02-02 19:32:42 +01:00
Patrick Ohly 1953dc2961 testing: wait for syncevo-http-server, enable more logging
Use the new wrappercheck.sh option --wait-for-daemon-output to ensure
that the syncevo-http-server is really running. This solves both a
timing issue (tests might start too soon) and make it more obvious when
the HTTP server is not working properly.

Diagnosing that was hard. Now we detect it and also write more debug
output from the HTTP server side into the syncevohttp.log.
2014-02-02 19:32:42 +01:00
Patrick Ohly da6dab0d3b testing: wait for background daemon in wrappercheck
When starting a daemon via wrappercheck, optionally wait for the
daemon to write a certain message to its log file. The message is
searched for with "grep -e", so regular expressions matching one line
are acceptable. Only works in combination with writing that log file.

This will be used to wait for syncevo-http-server to confirm that it
is running and ready to accept connections.
2014-02-02 19:32:42 +01:00
Patrick Ohly d747fc1e14 testing: wait for background daemon in wrappercheck
When starting a daemon via wrappercheck, optionally wait for the
daemon to write a certain message to its log file. The message is
searched for with "grep -e", so regular expressions matching one line
are acceptable. Only works in combination with writing that log file.

This will be used to wait for syncevo-http-server to confirm that it
is running and ready to accept connections.
2014-02-02 19:32:42 +01:00
Patrick Ohly 88ac5872a5 testing: more resilient resultchecker.py
Don't assume that each server actually has an entry in the result
list. In case of a failure to write that, treat the server as failed
to highlight the problem instead of failing in the resultchecker.py
script.
2014-02-02 19:32:42 +01:00
Patrick Ohly 3bde1fe9bd D-Bus testing: fix and enhance TestHTTP
Picking a port dynamically was broken: if 9999 was in use, the test script
connected to the wrong process and then incorrectly continued, instead of
detecting that syncevo-http-server failed. Use the auto-alloc feature
of syncevo-http-server (port == 0) instead and get the actual port
from the output.

Now that we redirect that output into a file, it makes sense to also include
that log in test failure reports.
2014-01-17 16:15:16 +01:00
Patrick Ohly c1384c9279 syncevo-http-server: log port which is used
This is particularly useful in combination with an URL that
has "0" as port number, because then Twisted will automatically pick
a port.
2014-01-17 16:15:16 +01:00
Patrick Ohly ca0b2db58c testing: help scan-tool by adding noreturn annotations
When an assert triggers, the following code does not get executed.
clang's scan-tool could not detect that because CppUnit's templates
are not annotated with the "noreturn" attribute. We already use
wrappers around CppUnit, so we can fairly easily add a fake "noreturn"
call to exit() to the assertion failure path.

While at it, avoid unnecessary inlining and update the macros to
handle parameters with commans (the necessary brackets were missing).

With this and the preceeding changes, a build with most SyncEvolution features
enabled passes scan-build without errors. There are still errors in
libsynthesis, though. See https://bugs.freedesktop.org/show_bug.cgi?id=73393
2014-01-17 16:15:16 +01:00
Patrick Ohly 7292332027 testing: avoid false scan-tool warning
clang's scan-tool fails to detect that the variable is bound
to a boost::lambda expression and indeed does get read later on.
Hide the write via ifdefs to suppress the warning when doing
static code analysis.
2014-01-17 16:15:16 +01:00
Patrick Ohly 69d77b30d2 testing: include cppcheck
The new runtest.py --cppcheck flag can be used in combination with
sources checked out earlier. The source checkout actions then
run cppcheck on each source tree and fail if cppcheck finds any
non-suppressed problems.

A wrapper around cppcheck must be used because --error-exitcode caused
non-zero exit codes also when errors where suppressed, at least in cppcheck
1.61.

We check the SyncEvolution source a bit more thoroughly than the rest because
we can fix or suppress issues inline, which might not be acceptable for
libsynthesis or activesyncd.
2014-01-17 16:15:16 +01:00
Patrick Ohly fa6db3eba7 cppcheck: suppress warnings
The remaining warnings are either not valid or refer to code which
is intentionally broken. Suppress these warnings.

SyncEvolution now passes scanning with cppcheck 1.61 without warnings.
2014-01-17 16:15:16 +01:00
Patrick Ohly edc21305af testing: fix naming of log files in doCopy()
The log file guard instance which should have added a "copy" part to log files
was deleted again before it could have the desired effect.  Found by cppcheck
("Instance of 'SyncPrefix' object is destroyed immediately.").
2014-01-17 16:15:16 +01:00
Patrick Ohly cee4265d94 testing: cppcheck redundant assignment
cppcheck correctly identified a redundant assignment which can be removed.
2014-01-17 16:15:15 +01:00
Patrick Ohly 5fed9ef3e6 testing: avoid unitialized members after constructor
cppcheck warned about this. This wasn't actually a problem (one member
was not used at all, the other was set later), but for the sake of
clean cppcheck scans let's fix it.
2014-01-17 16:15:15 +01:00
Patrick Ohly 1e6bad0cfe D-Bus testing: use different ports for http server tests
The tests must use different ports, otherwise they cannot run in
parallel.
2014-01-17 16:15:15 +01:00
Patrick Ohly 70bca00073 testing: separate distcheck
"dist" must complete before being able to install and test packages on
different platforms. By running "make distcheck" separately, we can
start with parallel testing sooner and separately enable/disable
distcheck testing.
2014-01-17 16:15:15 +01:00
Patrick Ohly 333b282b9b testing: do not rely on "compile" being enabled
This fixes a problem during source checkout.
2014-01-17 16:15:15 +01:00
Patrick Ohly edda92b352 testing: allow invoking runtest.py multiple times for the same platform
When run with an existing resultdir, do not remove the resultdir
and append to output.txt. This is useful for splitting compilation and
testing into two separate phases where testing on other platforms
can be started in parallel once compilation is complete.

Depends on the enhanced resultchecker.py.
2014-01-17 16:15:14 +01:00
Patrick Ohly a0863378d9 testing: log PID of runtests.py
Tracking of PIDs becomes relevant when parallelizing testing. The message
also shows when a particular runtest.py run started.
2014-01-17 16:15:14 +01:00
Patrick Ohly ed3cf97a87 testing: handle output.txt files with multiple entries per action
Compilation and actual testing will be split into two runtest.py invocations
to support parallelizing of testing. resultchecker.py must handle the
resulting output.txt, which will have multiple entries for for each action:
first compilation followed by skipped testing, then skipped compilation
followed by testing. resultcheckper.py must report the non-skipped
results and only fall back to "skipped" if none are found.

In addition, make it clear that the initial steps are about the source code by
renaming the step in the report with a "-source" suffix.
2014-01-17 16:15:14 +01:00
Patrick Ohly b37eadf203 testing: support result checking in platforms which have no pkg-config
When testing pre-compiled binaries it may happen that we cannot
determine library versions with pkg-config because development
files are not installed. Ignore these errors and skip adding
library version numbers.
2014-01-17 16:15:14 +01:00
Patrick Ohly 958c240857 testing: be more careful when cleaning up D-Bus session
When already started with D-Bus env variables, do not kill those
daemons. When killing daemons, report it on stderr so that it can
be tracked down who killed which processes.
2014-01-17 16:15:14 +01:00
Patrick Ohly 55b4056f0c testing: compile with lower priority
Compile jobs are not timing sensitive, so run them with lower priority than
test jobs. This becomes relevant when multiple runtests.py instances are
active.
2014-01-17 16:15:14 +01:00
Patrick Ohly 9a1fbcab5e testing: fix source checkout
Reordering the command line just cannot cope with the complex command line
setup for checking out source code. Disable the reordering for that command.
2014-01-17 16:15:14 +01:00