Commit graph

1765 commits

Author SHA1 Message Date
Patrick Ohly
b73e9e8b64 synevo-dbus-server: Session.Sync() signature fix
The Session::sync() prototype was changed without taking into
account that the method has to match the Session.Sync() signature.
Automaticly generated D-Bus bindings are a double-edged sword...

This was caught by the test-dbus.py TestDBusSync test. We really
need to run that more often and eventually nightly.
2009-11-05 19:25:18 +01:00
Patrick Ohly
a272d747f9 test-dbus.py: added Connection tests
The new TestConnection suite covers some Connection API related
aspects:
- creating a connection and closing it
- sending an invalid message
- sending a valid message

Right now these tests assume that a "syncevolution_server" config
exists. They depend on getting one Abort signal per connection
to shut down each test.

The signal recording code from TestDBusSync was moved into DBusUtil
so that the different tests can share this utility code.

Some sleeps are necessary after sync sessions because SIGTERM might
get caught without properly shutting down synevo-dbus-server (MB#7555).
2009-11-05 19:23:10 +01:00
Patrick Ohly
aa15620845 test-dbus.py: more reliable process handling
First, kill all running syncevo-dbus-server instances. Having
one running was one way how the tests could have failed because
it wasn't running with the right environment.

Second, use files for output instead of in-memory pipes. The latter
might have caused deadlocks when a process writes large amount of
data.

syncevo.log and dbus.log in the current directory are used. The
additional benefit is that these files can be read while the test
runs, for example when it is deadlocked for some other reason.

Third, when syncevo-dbus-server returns with a non-zero error code,
give dbus-monitor time to settle down before stopping it. Otherwise
the final D-Bus traffic might not get recorded.
2009-11-05 19:08:51 +01:00
Patrick Ohly
b704d06a12 D-Bus API + syncev-dbus-server: Connection.Abort signal only sent once
The API spec now guarantees that the signal is only raised once for
each connection. This was unspecified earlier. This change was made
to simplify clients and make the server more deterministic.

A new test in the test-dbus.py will depend on this behavior.
2009-11-05 17:55:02 +01:00
Patrick Ohly
7cc397aae7 syncevo-dbus-server: use unbuffered output
The syncevolution binary uses unbuffered stdio. Do the same in
the syncevo-dbus-server, just to be sure. Most of our code
does explicit fflush().
2009-11-05 17:53:32 +01:00
Patrick Ohly
af46ffb4ed syncevo-dbus-server: use random session IDs
In a transport which anyone can send messages to (like in a HTTP
server), a random session ID protects a bit against someone
inserting unwanted messages into a regular session.

This patch uses the usec part of gettimeofday() to initialize
the libc random number generator. Better (and more complex)
approaches are of course possible...

The reason for implementing this now is that automated testing via
test-dbus.py also had a problem with non-unique IDs: when the
server was restarted, separate runs ended up using the same
session ID because they were initialized with the current system time
in seconds. This confused signal listeners which checked the ID.
2009-11-05 17:51:05 +01:00
Patrick Ohly
e881031cbf test-dbus.py: removed dependency on Python 2.6 and python-gobject >= 2.16
Running the script failed on Debian Lenny failed because Python
and python-gobject are too old. Python 2.6 was required because
of subprocess.terminate(), replaced with os.kill(). python-gobject
2.16 was needed for glib, which is used in some tests to run
the event loop for a short while. These tests now fail if glib
is not available, while the rest of the tests can be run normally.
2009-11-05 13:13:17 +01:00
Patrick Ohly
529c208681 client-test: unit tests not included when building statically
Due to a typo in the src/syncevolution -> src/syncevo transition,
unit tests inside libsyncevolution.a were not included in the
client-test executable. The check of libsyncevolution.a searched
for the library in synccevo instead of syncevo.
2009-11-05 13:05:30 +01:00
Patrick Ohly
c292458086 SyncML server: don't check client credentials if not required
The "mustAuthenticate" parameter in the D-Bus Server.Connect()
call was ignored, valid credentials were always required unless
username and password in the server configuration were empty.
Now this parameter is passed through and used
- to configure the Synthesis engine correctly
- to suppress asking for our password if not needed

Note that we rely on a patch that turns <requiredauth>none</requiredauth>
into "accept invalid credentials". Without that patch, the client would
have to provide no credentials at all (which SyncEvolution doesn't support).
2009-11-04 17:02:24 +01:00
Patrick Ohly
9c7b8718c6 syncevolution-http-server.py: clients must authenticate
The "must authenticate" parameter for Server.Connect() had no
effect so far. Netherless, HTTP clients should have been required
to authenticate from the beginning.
2009-11-04 17:02:24 +01:00
Patrick Ohly
28bff38747 Synthesis server: session auth and device admin
Starting with this commit, SyncEvolution implements the
Synthesis session authentication and device administration
itself. The goal is to have better control over these steps
and become independent of the SDK_textdb which implemented
this before.

The SDK_textdb works, but it has several limitations, among
them the inability to choose a password. It is also called
"demo" in the source code, which raises some doubts about
its stability.

Because the Synthesis DB interface is now used both for database
access and for session handling, the Module_CreateContext() function
can not always select a source as context. When used as session
plugin, the global context pointer is NULL.

The Synthesis engine calls us at various points to save information.
Because it is not exactly clear how long we can buffer this
information in memory, it is always flushed to disk immediately.
2009-11-04 17:02:24 +01:00
Patrick Ohly
428375c20f logging + XML config: print config when it cannot be parsed
To track down internal errors the generated XML configuration
is now printed whenever the Synthesis engine cannot parse it.
2009-11-04 17:02:24 +01:00
Patrick Ohly
082485a232 SafeConfigNode::escape(): did not work correctly for strings with ! in them
The ! sign was used as escape character and thus has to be escaped
itself. In the less strict mode this wasn't done. Shouldn't affect
SyncEvolution 0.9.1 where the code was used in strict mode for
change tracking nodes, but broke the new nonce saving.
2009-11-04 17:02:24 +01:00
Patrick Ohly
f33a48a9e7 adding templates: also need to go into test/test-dbus.py
Part of the D-Bus API testing is checking of the GetConfigs()
call for templates. So when adding a new server template, that
test must also be updated.
2009-11-04 17:02:24 +01:00
Zhu, Yongsheng
f71bb52564 syncevo-dbus-server: implement progress (bug #7134)
Calculate progress information according to progress
event from synthesis library.

Considering the most common scenario and profiling data,
current implementation will partition a sync session into
3 *big* steps: SYNC_INIT, SYNC_DATA, SYNC_UNINIT
Typically each step contains one message send and receive,
thus occupies a specified proportion.
By default, 5 data items are supposed in calculating
proportions, which affect SYNC_DATA and SYNC_UNINIT.
The main idea of dynamically adjustment is that based on
the common scenario, if there are extra operations,
such as message send/receive or many data items,
adjust proportions by re-calculate operations of each
remaining step.
Typcially possible extra operations are more than one-time
message send/receive in a step and the number
of data items is not 5. Then we re-calculate proportions
for remaing steps according to future's operations
with the remaining proportion.
2009-11-04 17:01:36 +01:00
Patrick Ohly
5acf33ff61 SQLite backend: added server admin calls
The recently introduced enableServerMode() and serverModeEnabled()
calls must be implemented by all sync sources not derived from
TrackingSyncSource. This patch adds the calls to the SQLiteContactSource,
using the default mechanism provided for it in SyncSourceAdmin.
2009-11-03 18:28:03 +01:00
Patrick Ohly
0ecef765e3 gen-autotools.sh: avoid GNU find -printf
Compilation on Mac OS X fails when using the GNU find specific
-printf command line option, so avoid it.
2009-11-03 18:25:44 +01:00
Patrick Ohly
807212d7b6 testing: Client::Sync broke when removing the source array in the sync() method
The active sources must be set before calling sync(), doing it in
prepare() is too late. The right way to do it with the revised
API is via source filters: disable all sources with a filter that
applies to all sources, then enable the desired one(s) with the
right mode with a more specific filter.
2009-10-29 16:08:57 +01:00
Patrick Ohly
999a0c6099 D-Bus testing: adapted to fully implemented GetConfigs()
Now that GetConfigs() correctly returns the actual templates
list instead of a hard-coded "google", the test had to be adapted.
2009-10-29 11:03:39 +01:00
Patrick Ohly
a3bf147726 D-Bus testing: set up environment also for running under debugger
The environment with XDG_ redirected into a local directory
also needs to be passed to gdb when debugging interactively.
Otherwise the tests would not run as without gdb.
2009-10-29 11:02:31 +01:00
Patrick Ohly
6cf1e71c33 syncevo-dbus-server: fixed compiler warning
The recently merged signal timeout code initialized members
in a different order than in the class, which g++ warns about.
2009-10-29 11:00:33 +01:00
Zhu, Yongsheng
62d82e4414 syncevo-dbus-server: use enum values to represent sync statuses
Use 5 enum values to represent sync statuses,
SYNC_IDLE, SYNC_RUNNING, SYNC_ABORTING,
SYNC_SUSPENDING, SYNC_DONE
So we could use one enum variable instead of
previously 3 boolean values
2009-10-29 10:08:27 +01:00
Zhu, Yongsheng
84f6cd7a03 syncevo-dbus-server: add test script for getConfigs
Add test script in test/dbus-server-config.py to test
getConfigs, usage:
python dbus-server-config.py [servername] --getconfigs
[null or any characters]
2009-10-29 10:08:27 +01:00
Zhu, Yongsheng
8faa1908eb syncevo-dbus-server: implement getConfigs
Get available configuration templates and configured
servers in getConfigs
2009-10-29 10:08:27 +01:00
Zhu, Yongsheng
84e3bcb8e0 syncevo-dbus-server: hook up checkForSuspend and checkForAbort
Hook up checkForSuspend and checkForAbort in dbus server
and implement sleep function but not suspend and
abort when CTRL-C is entered for often sync dbus server
runs as a daemonease enter the commit message for your changes.
2009-10-29 10:08:27 +01:00
Zhu, Yongsheng
e49e79b8c1 syncevo-dbus-server: add timeout mechanism for status and progress
For status and progress, we need a timer to record when
the last signal was triggered.
Here implement a 'Timer' class and add 2 timers in session
to keep time track of emitting signals for status and progress
2009-10-29 10:08:27 +01:00
Zhu, Yongsheng
42a01c0f31 syncevo-dbus-server: change checkSource and getDatabases
when the config doesn't exist, raising an error
instead of creating server template.
2009-10-29 10:08:27 +01:00
Zhu, Yongsheng
305dc790cc syncevo-dbus-server setConfig: reserve meta information
Previous impl removes necessary meta information, such
as global synthesis and source meta.

This patch is only to remove un-set sources and don't remove
meta information for global synthesis and sources which aren't be
removed
2009-10-29 10:08:27 +01:00
GLSQA
f01a7765e2 l10n: Updates to Finnish (fi) translation
Transmitted-via: Transifex (translate.moblin.org)
2009-10-26 15:57:39 -07:00
Patrick Ohly
d80acf6e60 SyncSourceAdmin::insertMapItem(): silently update existing items
It seems the engine calls this for existing items and expects it
to succeed, in contrast to what sync_dbapi.h says. SDK_textdb
also doesn't seem to check for existance before writing, so do
the same.
2009-10-23 15:00:48 +02:00
Patrick Ohly
33464b0c3a Synthesis DB interface: logging of local operations
Replaced the DEBUG_DB() macros from the SDK with our own
logging macros, so now the output really goes into our logfile.
DEBUG_DB() seemed to be disabled or inactive.

Also moved the logging around a bit so that the return code is logged.
2009-10-23 13:36:29 +02:00
Patrick Ohly
6946aabdd8 Merge commit 'origin/master' into dbus-api 2009-10-23 11:06:28 +02:00
ZhuYanhai
1aebbfb61f l10n: Updates to Chinese (China) (zh_CN) translation
Transmitted-via: Transifex (translate.moblin.org)
2009-10-20 20:34:02 -07:00
ZhuYanhai
ef45d55084 l10n: Updates to Chinese (China) (zh_CN) translation
Transmitted-via: Transifex (translate.moblin.org)
2009-10-20 19:42:19 -07:00
Patrick Ohly
607b54860d Merge branch 'master' into dbus-api 2009-10-20 14:32:40 +02:00
Patrick Ohly
e89593f3df NEWS, version: updated for 0.9.1 beta 2 2009-10-19 15:42:13 +02:00
Patrick Ohly
8d0f6dca03 client-test: added testManyDeletes, improved testManyItems
testManyItems now checks that the statistics are correct. This
is based on the assumption that all active sources use the same
number of test items.

The new testManyDeletes triggers a problem with 222 loop detection:
when the message to the server contains many deletes, the server
may require so many reply messages, that the client has to send
5 Alert 222 messages in a row and incorrectly treats this as a loop
that has to be aborted.
2009-10-16 18:16:46 +02:00
Zhu, Yongsheng
be81c952c2 valgrindcheck.sh: return 100 when valgrind finds a problem
Previously the error code of the underlying program was
returned if non-zero. 1 was returned when the program
succeeded and valgrind found a problem.

Now the script always checks for valgrind problems and
returns 100 when one is found.
2009-10-16 14:25:32 +02:00
Congwu Chen
6d2be17e6f runtests.py: added configuration of Resend test
This change was originally committed a while back to the
runtest.py used in the nightly testing. Now we are merging
it back to the public runtest.py.

This patch adds the "Resend" test to various _SKIP and
_FAILURES lists and adds CLIENT_TEST_RESEND_TIMEOUT and
CLIENT_TEST_INTERRUPT_AT.
2009-10-16 14:25:32 +02:00
Patrick Ohly
00cb014971 runtests.py: reformatted source code to split up long lines
The long and unreadable environment strings for client-test
are now in the Python code as multiple independent strings
which get concatenated by Python:
function("foo"
         "bar")
2009-10-16 14:25:32 +02:00
Patrick Ohly
ddaf76ec1b runtests.py: build RPMs in addition to DEBs
checkinstall *does* work on a Debian system, even under fakeroot.
The trick is to make /usr/src/rpm/RPMS writable for normal users.
The Makefile then copies the resulting .rpm back to the current
working directory.
2009-10-16 14:25:32 +02:00
Patrick Ohly
1cffe8fe6f runtests.py: fixed "prebuilt" tests
The invocation of the Client::Source tests for prebuilts binaries
was incorrect, the new source arraty was missing.
2009-10-16 14:25:32 +02:00
Patrick Ohly
fd40f4f87a runtests.py: fixed building lpia .deb
The "lpia" (Low Power Intel Architecture) .debs are our normal
x86 binaries packaged with a different architecture name. The check
whether runtests.py was building for x86 broke when moving to an
64 bit bost. It must be run inside the build environment.
2009-10-16 14:25:32 +02:00
Zhu, Yongsheng
a10a809d9c Testing: add valgrind result checking and generate result in html output
Check valgrind result code and generate corresponding result
in the html outpu
2009-10-16 14:25:31 +02:00
Zhu, Yongsheng
a2cd73595b Testing: add nightly test for memotoo
Memotoo is ready to test so enable it
2009-10-16 14:25:31 +02:00
Chen Congwu
a2b079298e Testing: add time info for mail title
add time info for mail title for the purpose
of clear report
2009-10-16 14:25:31 +02:00
Chen Congwu
d1e9e24721 Testing: change know failures to skip for google testing
Change CLIENT_TEST_FAIURES to CLIENT_TEST_SKIP for google
testing
2009-10-16 14:25:31 +02:00
Chen Congwu
06fd773fd9 Testing: add valgrind check result and backend scan dir
1)Get return code from valgrind check result
2)Add environment variable SYNCEVOLUION_BACKEND_DIR when starting testing
2009-10-16 14:25:31 +02:00
Chen Congwu
950e9251c2 Testing: add valgrind check result and backend scan dir
Change failure to skip for google known failures
Change report title to have more acurate time information
2009-10-16 14:25:31 +02:00
Patrick Ohly
53c5312828 fixed typo: Aboring -> Aborting
Found by Yongsheng and fixed in the D-Bus branch.
2009-10-16 11:49:37 +02:00