summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2016-09-20 07:38:43 -0700
committerPatrick Ohly <patrick.ohly@intel.com>2016-09-26 12:58:26 +0200
commit941774a1d19c51ccbb0a56e56233552b217fe4f8 (patch)
tree0d2d7fc1049698660e0e09ebbe17702ebb81f662 /src
parentc1ba1030597657d0f29f22d85ea8bfda8e231093 (diff)
D-Bus testing: fix slowing down file sources
Recent shells filter out environment variables that are not valid shell variables, so for example, SYNCEVOLUTION_FILE_SOURCE_DELAY_OPEN_addressbook-slow-server did not get passed through to syncevo-dbus-server because of the hyphen. As a result, the tests became unreliable (non-deterministic timing) or outright failed. Now we ensure that these variables are valid also in a shell and in addition, make the test stricter such that it detects when the file backend did not wait.
Diffstat (limited to 'src')
-rw-r--r--src/backends/file/FileSyncSource.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/backends/file/FileSyncSource.cpp b/src/backends/file/FileSyncSource.cpp
index 2c9514f9..995d27b6 100644
--- a/src/backends/file/FileSyncSource.cpp
+++ b/src/backends/file/FileSyncSource.cpp
@@ -104,6 +104,7 @@ void FileSyncSource::open()
bool createDir = false;
std::string varname = StringPrintf("SYNCEVOLUTION_FILE_SOURCE_DELAY_OPEN_%s", getDisplayName().c_str());
+ boost::replace_all(varname, "-", "_");
const char *delay = getenv(varname.c_str());
if (delay) {
int seconds = atoi(delay);
@@ -187,6 +188,7 @@ void FileSyncSource::listAllItems(RevisionMap_t &revisions)
ReadDir dirContent(m_basedir);
std::string varname = StringPrintf("SYNCEVOLUTION_FILE_SOURCE_DELAY_LISTALL_%s", getDisplayName().c_str());
+ boost::replace_all(varname, "-", "_");
const char *delay = getenv(varname.c_str());
if (delay) {
int seconds = atoi(delay);