summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2020-03-02 05:05:32 -0800
committerPatrick Ohly <patrick.ohly@intel.com>2020-08-09 16:26:42 +0200
commitc78bcbb0763dcdbc19ad28e250d4c0c6fb1f1a1d (patch)
tree6b655088770722b2b0b91ba30c0a8486375c6bd7
parent83782724122c34ae45b57b8bc803b23f039475e7 (diff)
D-Bus server: fix server restarting
After moving to different pre-built testing, the wrong syncevo-dbus-server binary was getting started (/usr/lib instead from the test directory). We must find the binary via normal PATH lookup and also deal with symlinks before comparing. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
-rw-r--r--src/dbus/server/restart.h3
-rwxr-xr-xtest/test-dbus.py5
2 files changed, 6 insertions, 2 deletions
diff --git a/src/dbus/server/restart.h b/src/dbus/server/restart.h
index 00a86333..2c785827 100644
--- a/src/dbus/server/restart.h
+++ b/src/dbus/server/restart.h
@@ -72,7 +72,8 @@ public:
boost::scoped_array<const char *> argv(createArray(m_argv));
boost::scoped_array<const char *> env(createArray(m_env));
LogRedirect::reset();
- if (execve(argv[0], (char *const *)argv.get(), (char *const *)env.get())) {
+ SE_LOG_INFO(NULL, "restarting server binary %s", argv[0]);
+ if (execvpe(argv[0], (char *const *)argv.get(), (char *const *)env.get())) {
SE_THROW(StringPrintf("restarting syncevo-dbus-server failed: %s", strerror(errno)));
}
}
diff --git a/test/test-dbus.py b/test/test-dbus.py
index 3672eb17..174d6f49 100755
--- a/test/test-dbus.py
+++ b/test/test-dbus.py
@@ -1037,7 +1037,10 @@ Use check=lambda: (expr1, expr2, ...) when more than one check is needed.
# must be syncevo-dbus-server
res = match.group(1)
if 'syncevo-dbus-server' in res:
- return (res, pid)
+ # We sometimes seemed to get symlinks listed in /proc/*/maps
+ # that were gone when the binary restarted itself, which broke
+ # TestFileNotify.testRestart. Normalizing the path avoids this.
+ return (os.path.realpath(res), pid)
# not found, try children
for process in os.listdir('/proc'):
try: