summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAge
* glib: stricter ref countingPatrick Ohly2013-05-16
| | | | | | | | | | | | | | | | Following the boost::instrusive_ptr example and making "add_ref = true" the default in our CXX GLib and GObject wrappers led to some memory leaks because it didn't enforce thinking about whether the plain pointer is already owned by us or not. It is better to use a mandatory enum value, ADD_REF and TRANSFER_REF, and force explicit construction. Doing that revealed that the assignment operator was implemented as constructing a CXX instance with increased ref count and/or that in some places, a real leak was caused by increasing the ref count unnecessarily. Running under valgrind gave a false sense of security. Some of the real leaks only showed up randomly in tests.
* Funambol: avoid testing slow sync modePatrick Ohly2013-05-16
| | | | | | Funambol reacts with a 407 "retry later" very quickly when clients to slow syncs. Avoid that, because it pretty much prevents getting any of the tests to run.
* D-Bus testing: remove timeout in TestSessionAPIsDummy.testInteractivePasswordPatrick Ohly2013-05-13
| | | | | The timeout kept firing and showed up in other tests when those timed out, which was very confusing. Had no negative impact otherwise.
* D-Bus testing: implement removal of glib timeoutPatrick Ohly2013-05-13
| | | | | | Use type checking to determine whether a timeout was done via glib or signals. Without removal of a glib timeout, a periodic timeout keeps firing in other tests.
* D-Bus testing: abort server with background threadPatrick Ohly2013-05-13
| | | | | | Ensure that server is currently waiting for background thread, then abort via Session.Abort(). Needs to be detected by backend and the lead to normal session shutdown.
* testing: add EDS<->EDS syncing via HTTPPatrick Ohly2013-05-13
| | | | | | | Running EDS on the server side is a relevant use case and may have its own share of problems, in particular when the server runs the EDS code in a background thread. Better test that with libebook and libecal...
* engine: eliminate virtual checkForSuspend/Abort()Patrick Ohly2013-05-13
| | | | | | | | | | Since the introduction of SuspendFlags, the ony remaining user of the virtual aspect of checkForSuspend/checkForAbort() was the testing code. By using the suspend/abort request mechanism in SuspendFlags, it becomes possible to move checkForSuspend/Abort() into SuspendFlags itself. This will be useful to use it outside of a SyncContext member.
* D-Bus testing: cover implicit URIPatrick Ohly2013-05-13
| | | | | The local source name is the default for the URI value, test that for "calendar".
* D-Bus testing: cover multithreading and HTTPPatrick Ohly2013-05-13
| | | | | | | | | | | | | | | | | test-dbus.py now knows how to start syncevo-http-server. Therefore it can test normal HTTP-based syncing as well as several scenarios which fail or succeed with a slow server depending on the server's ability to send SyncML messages while still initializing the storage. To make the server slow, env variables are checked by the file backend. It may matter whether open() or listAll() are slow, so test both. The tests expecting the 2 minute default must check whether the feature is enabled at all in the binary that they are testing. If not, the test cannot run. All other tests work, albeit somewhat unsafely because they force the engine to run multithreaded when the engine was compiled without mutex locking of global data structures.
* D-Bus testing: improved running of command line toolPatrick Ohly2013-05-13
| | | | | | | | | | | | | | | | | | | Refactored the code into a new utility base class for use in other tests. Replace pipes with temporary files, using the same base name as the traditional .syncevo.log and .dbus.log. They are numbered (because the command line might be run multiple times per test) and use .out, .err, or .outerr as suffix depending on what kind of output they contain. The advantage is that the output gets recorded permanently. Use that when waiting for command completion times out: in that case, the content of the output file(s) gets added to the exception. The subprocess handle returned by startCmdline() is extended with information about output redirection that is then used by finishCmdline(). This makes one parameter of finishCmdline() redundant.
* Google: ignore loss of TRANSP propertyPatrick Ohly2013-05-13
| | | | | Google Calendar currently drops the TRANSP property. This is a regression that was reported to Google. While waiting for a fix ignore the problem.
* Logging: thread-safePatrick Ohly2013-05-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Logging must be thread-safe, because the glib log callback may be called from arbitrary threads. This becomes more important with EDS 3.8, because it shifts the execution of synchronous calls into threads. Thread-safe logging will also be required for running the Synthesis engine multithreaded, to overlap SyncML client communication with preparing the sources. To achieve this, the core Logging module protects its global data with a recursive mutex. A recursive mutes is used because logging calls themselves may be recursive, so ensuring single-lock semantic would be hard. Ref-counted boost pointers are used to track usage of Logger instances. This allows removal of an instance from the logging stack while it may still be in use. Destruction then will be delayed until the last user of the instance drops it. The instance itself must be prepared to handle this. The Logging mutex is available to users of the Logging module. Code which holds the logging mutex should not lock any other mutex, to avoid deadlocks. The new code is a bit fuzzy on that, because it calls other modules (glib, Synthesis engine) while holding the mutex. If that becomes a problem, then the mutex can be unlocked, at the risk of leading to reordered log messages in different channels (see ServerLogger). Making all loggers follow the new rules uses different approaches. Loggers like the one in the local transport child which use a parent logger and an additional ref-counted class like the D-Bus helper keep a weak reference to the helper and lock it before use. If it is gone already, the second logging part is skipped. This is the recommended approach. In cases where introducing ref-counting for the second class would have been too intrusive (Server and SessionHelper), a fake boost::shared_ptr without a destructor is used as an intermediate step towards the recommended approach. To avoid race conditions while the instance these fake pointers refer to destructs, an explicit "remove()" method is necessary which must hold the Logging mutex. Using the potentially removed pointer must do the same. Such fake ref-counted Loggers cannot be used as parent logger of other loggers, because then remove() would not be able to drop the last reference to the fake boost::shared_ptr. Loggers with fake boost::shared_ptr must keep a strong reference, because no-one else does. The goal is to turn this into weak references eventually. LogDir must protect concurrent access to m_report and the Synthesis engine. The LogRedirectLogger assumes that it is still the active logger while disabling itself. The remove() callback method will always be invoked before removing a logger from the stack.
* Logging: merge Logger and LoggerBasePatrick Ohly2013-05-06
| | | | | Having two separate classes had little (no?!) benefit and just caused confusion.
* Logging: eliminate _instance from SE_LOG* macrosPatrick Ohly2013-05-06
| | | | | With the _instance parameter always being NULL thanks to the previous patch, it can be removed completely.
* D-Bus testing: increase message bus timeoutPatrick Ohly2013-05-06
| | | | | | For interactive debugging it is better to have an infinite timeout of the D-Bus method call. The overall test will still time out as quickly as it did before.
* testing: avoid system-wide killing of valgrind in valgrindcheck.shPatrick Ohly2013-05-06
| | | | | | | | | | | When running EDS under valgrindcheck.sh in parallel to running syncevo-dbus-server under valgrindcheck.sh, then cleaning up after syncevo-dbus-server must not kill EDS. To achieve this, look at all log files created for us and extract the pid from each file. Also fix sending INT/TERM vs. KILL signals to these processes.
* D-Bus testing: improve TestSessionAPIsDummy.testInteractivePasswordPatrick Ohly2013-05-06
| | | | The invocation of killall was unnecessarily complex.
* D-Bus testing: SYNCEVOLUTION_DEBUG skips output redirectionPatrick Ohly2013-05-06
| | | | | | | When running test-dbus.py or testpim.py with SYNCEVOLUTION_DEBUG set, they now skip the redirection of syncevo-dbus-server output into a file. Useful when doing interactive debugging without running under a debugger.
* testing: apply valgrind to EDS when running test-dbus.py and testpim.pyPatrick Ohly2013-05-06
| | | | | | | | When starting a D-Bus session for test-dbus.py and testpim.py, valgrind gets injected via an env variable and the older check of the program to be started did not match. Need to check the environment in addition to the command line, otherwise EDS gets started by the D-Bus daemon and we never see its output nor does it get checked by valgrind.
* testing: add missing rule namesPatrick Ohly2013-05-06
| | | | | This allows grepping the "valgrind -v" output for new suppressions. Without this change, grep finds statistics about the known suppressions.
* testing: remove suppression for EDS leakPatrick Ohly2013-05-06
| | | | | | The problem has been fixed in the meantime (00f566 "sqlite addressbook: fix memory corruption in get_revision") and no longer occurs in an release we test against.
* D-Bus testing: set locale in some more testsPatrick Ohly2013-05-06
| | | | | Run some more tests with the right locale. The tests check for a localized error message ("The connection is closed").
* PIM testing: ignore folks rec mutex leakPatrick Ohly2013-05-06
| | | | New variant of an older, minor leak.
* D-Bus testing: start EDS also for testpim.pyPatrick Ohly2013-05-06
| | | | | | Manually start EDS also when testing with testpim.py, to see the output of the factory processes and allow running them from places where the D-Bus daemon would not find them.
* testing: read env variable only oncePatrick Ohly2013-03-19
| | | | | | Klocwork failed to detect that the result of getenv() was checked. Keep Klocwork happy by assigning the result to a temporary variable and checking that.
* testing: avoid unlikely fd leakPatrick Ohly2013-03-19
| | | | | | If opening the server log file returned 0 as fd, the writing was skipped and the file was not closed. Found by Klocwork, unrealistic in practice.
* testing: mark ClientTest non-copyablePatrick Ohly2013-03-19
| | | | | Fixes a correct Klocwork warning about a memory leak when using the default copy operator - never happens in practice, though.
* Revert "testing: ignore GIO D-Bus leak"Patrick Ohly2013-03-07
| | | | | | | | | | | This reverts commit 3c0396abcfc956ab140b0836980cfb6a1c328df5. Conflicts: test/evo.supp Memory leak is fixed in SyncEvolution now. However, glib itself also leaks the GDBusMethodInfo when the method gets called. See https://bugzilla.gnome.org/show_bug.cgi?id=695376
* testing: temporarily ignore neon + gnutls leakPatrick Ohly2013-03-06
| | | | Tracked as FDO #61851.
* D-Bus testing: kill partially terminated processesPatrick Ohly2013-03-06
| | | | | | | | | | | | | | | | | | | | | | | When running syncevo-dbus-server under valgrindcheck.sh, the following happened occasionally: - syncevo-dbus-server main thread quits, some threads keep running => ps shows the process as <defunct> with ppid = 1 = init - valgrindcheck.sh notices that the process is done, reports status and quits - test-dbus.py fails to wait for the syncevo-dbus-server process (because it is not the parent) and assumes that the process is gone At this point there is a lingering process which occupies the well-known D-Bus name (= all further tests fail) and which prevents unmounting the chroot. It's unknown how the syncevo-dbus-server gets into that state. Could be valgrind 3.7.0 or the kernel 3.4.28-2.20-xen. As a workaround, let test-dbus.py collect the pids of all processed that it couldn't wait for and send them SIGKILLs until that returns with "not found".
* wrappercheck.sh: more resilient against race conditionsPatrick Ohly2013-03-04
| | | | Killing the helper shell may fail when the shell already quit.
* D-Bus testing: more logging in auto start testPatrick Ohly2013-03-04
| | | | | Capture output and include it error report. Helped to track down the reason why startup failed in the jhbuild environment.
* D-Bus testing: fix auto start test when using jhbuildPatrick Ohly2013-03-04
| | | | | The test must not overwrite XDG_DATA_DIRS, because jhbuild sets essential values there. Instead append.
* D-Bus testing: catch server startup failurePatrick Ohly2013-03-04
| | | | | | | | | | | | | When starting the server fails, an exception gets thrown when trying to determine its pid. This used to abort the whole test script without recording much information. In particular the server's output was not included. Now the exception is caught, recorded as error and testing continues with the next test. This did not fix the root cause (a stuck process occupied the D-Bus name) but at least it helped to identify the problem.
* testing: add debug output for importing test casesPatrick Ohly2013-03-04
| | | | | | With all the interaction between Client::Sync, Client::Source and CLIENT_TEST_SERVER it can be hard to figure out which test case file gets used. Log that explicitly.
* Google CalDAV testing: avoid multiple detached recurrences, IIPatrick Ohly2013-03-04
| | | | | | | | | | | | | | Because of Google issue with detached recurrences without parent (http://code.google.com/p/google-caldav-issues/issues/detail?id=58) and the SyncEvolution workaround (replacing RECURRENCE-ID with X-SYNCEVOLUTION-RECURRENCE-ID) only one detached recurrence per UID can be stored. Removing the second modified recurrence from the test cases for Google. Somehow the second modified recurrence made its way back into the test data while rewriting the generic eds_event.ics.
* EDS: temporarily ignore a minor leak (BGO #694730)Patrick Ohly2013-02-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | See https://bugzilla.gnome.org/show_bug.cgi?id=694730 ==18552== 25 bytes in 1 blocks are definitely lost in loss record 2,353 of 6,616 ==18552== at 0x4C28BED: malloc (vg_replace_malloc.c:263) ==18552== by 0xADC3D40: g_malloc (gmem.c:159) ==18552== by 0xADDA3BB: g_strdup (gstrfuncs.c:364) ==18552== by 0x1146400B: get_string_cb (e-book-backend-sqlitedb.c:255) ==18552== by 0x854F1CE: sqlite3_exec (in /usr/lib/x86_64-linux-gnu/libsqlite3.so.0.8.6) ==18552== by 0x114665A2: book_backend_sql_exec_real (e-book-backend-sqlitedb.c:301) ==18552== by 0x1146666F: book_backend_sql_exec (e-book-backend-sqlitedb.c:391) ==18552== by 0x11469FC6: e_book_backend_sqlitedb_get_revision (e-book-backend-sqlitedb.c:3995) ==18552== by 0x1F90480E: e_book_backend_file_open (e-book-backend-file.c:656) ==18552== by 0x1146C229: book_backend_open (e-book-backend-sync.c:397) ==18552== by 0x11473F26: operation_thread (e-data-book.c:292) ==18552== by 0xADE2181: g_thread_pool_thread_proxy (gthreadpool.c:309) ==18552== by 0xADE1964: g_thread_proxy (gthread.c:797) ==18552== by 0x8E34B4F: start_thread (pthread_create.c:304) ==18552== by 0xB90F70C: clone (clone.S:112)
* D-Bus testing: merge with truncated D-Bus logPatrick Ohly2013-02-26
|
* testing: more workarounds for Google CalDAV + unique IDsPatrick Ohly2013-02-26
| | | | | | | | | | | | | Google became even more strict about checking REV. Tests which reused a UID after deleting the original item started to fail sometime since middle of December 2012. To fix this, tests must differentiate reuse of an item by adding a suffix ("-A", "-B", etc.). If CLIENT_TEST_UNIQUE_UID has a value >= 2, that suffix will be used when mangling the input item. Otherwise the suffix is ignored and nothing changes. For testing Google, CLIENT_TEST_UNIQUE_UID=2 is used.
* D-Bus testing: enhanced checking of D-Bus and stdout logPatrick Ohly2013-02-26
| | | | | | | 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.
* D-Bus testing: improved loggingPatrick Ohly2013-02-26
| | | | | | | | | 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.
* D-Bus testing: optionally use gzipPatrick Ohly2013-02-26
| | | | | | 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.
* D-Bus testing: more efficient runUntilPatrick Ohly2013-02-26
| | | | | | | | | | | | 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.
* D-Bus server: reduce D-Bus log messagesPatrick Ohly2013-02-26
| | | | | | | | | | | | | | | | | | | 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.
* D-Bus testing: avoid extranuous message about SIGTERMPatrick Ohly2013-02-26
| | | | | The message was printed also when there were no children to kill that way. Now also include the process list of hanging children.
* D-Bus testing: TEST_DBUS_VERBOSE shows logging messagesPatrick Ohly2013-02-26
| | | | | | 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.
* PIM: support location = GEO property (FDO #60373)Patrick Ohly2013-02-26
| | | | | | | | | 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.
* engine: support GEO property (part of FDO #60374)Patrick Ohly2013-02-26
| | | | | | 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).
* testing: support --enable dist=<configure flags>Patrick Ohly2012-12-07
| | | | | | | 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.
* debugging: revise suppression rulePatrick Ohly2012-12-07
| | | | | | The old suppression rule for a problem with ESourceRegistry no longer matched after introducing EDSRegistryLoader. Support old and new flavor.