#include #include #include #include #include #include #include #include "CSlim/SlimUtil.h" #include "CSlim/SlimList.h" #include "CSlim/Fixtures.h" #include "CSlimTools.hh" struct ConnectToDDServer { ConnectToDDServer() : _buildType("Debug"), _execPath("../build/Debug/bin/"), _workingDirectory("app-debug") { const char* lBuildType = getenv("BUILD_TYPE"); if ( lBuildType && (strcmp(lBuildType,"Release")==0)) { _buildType=lBuildType; _execPath="../build/Release/bin/"; _workingDirectory="app-release"; } chdir(_workingDirectory.c_str()); } static ConnectToDDServer* From(void *fixtureStorage) { return reinterpret_cast(fixtureStorage); } std::string _buildType; std::string _execPath; std::string _workingDirectory; }; extern "C" { void* ConnectToDDServer_Create(StatementExecutor* /*errorHandler*/, SlimList* /*args*/) { setenv("DDPATH", ".", 1); return new ConnectToDDServer; } void ConnectToDDServer_Destroy(void *fixture) { delete ConnectToDDServer::From(fixture); } static char* login(void */*fixture*/, SlimList */*args*/) { int ret = system("../script/loginDD_Server.sh"); return CSlimTools::traitReturnSystem(ret); } SLIM_CREATE_FIXTURE(ConnectToDDServer) SLIM_FUNCTION(login) SLIM_END }