summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2020-01-17 20:49:38 +0000
committerMichael Meeks <michael.meeks@collabora.com>2020-01-21 15:07:54 +0000
commit9dfac6dab13f59e418e81933be4c02396dd46c40 (patch)
tree2909b18be0689d56308b88595c35bd3c1a4c3dd0 /common
parentcopyFile: de-poco-ize and handle EINTR and short writes. (diff)
downloadonline-9dfac6dab13f59e418e81933be4c02396dd46c40.tar.gz
online-9dfac6dab13f59e418e81933be4c02396dd46c40.zip
test: switch to parallel tests based on Unit framework.
Increase a few timeouts, bin old-style standalone unit tests, fix a number of bugs. Change-Id: Ia3d59466ecb9a9443807ba3445d04dd5f77e3dba
Diffstat (limited to 'common')
-rw-r--r--common/Unit.cpp5
-rw-r--r--common/Unit.hpp8
2 files changed, 11 insertions, 2 deletions
diff --git a/common/Unit.cpp b/common/Unit.cpp
index 5dc01d4eae..875c976866 100644
--- a/common/Unit.cpp
+++ b/common/Unit.cpp
@@ -26,7 +26,7 @@
#include <common/SigUtil.hpp>
UnitBase *UnitBase::Global = nullptr;
-
+char * UnitBase::UnitLibPath;
static std::thread TimeoutThread;
static std::atomic<bool> TimeoutThreadRunning(false);
std::timed_mutex TimeoutThreadMutex;
@@ -41,6 +41,9 @@ UnitBase *UnitBase::linkAndCreateUnit(UnitType type, const std::string &unitLibP
return nullptr;
}
+ // avoid std:string de-allocation during failure / exit.
+ UnitLibPath = strdup(unitLibPath.c_str());
+
const char *symbol = nullptr;
switch (type)
{
diff --git a/common/Unit.hpp b/common/Unit.hpp
index 63975514b9..c403100c2f 100644
--- a/common/Unit.hpp
+++ b/common/Unit.hpp
@@ -138,11 +138,17 @@ public:
return *Global;
}
+ static std::string getUnitLibPath() { return std::string(UnitLibPath); }
+
private:
- void setHandle(void *dlHandle) { _dlHandle = dlHandle; }
+ void setHandle(void *dlHandle)
+ {
+ _dlHandle = dlHandle;
+ }
static UnitBase *linkAndCreateUnit(UnitType type, const std::string& unitLibPath);
void *_dlHandle;
+ static char *UnitLibPath;
bool _setRetValue;
int _retValue;
int _timeoutMilliSeconds;