13: testName(std::move(setTestName)), verbose(setVerbose) {
31 catch(std::runtime_error&) {
47 if(
verbose || std::getenv(
"TANGO_TESTS_VERBOSE") !=
nullptr) {
48 argv.emplace_back(
"-v5");
53 argv.emplace_back(
"-nodb");
54 argv.emplace_back(
"-dlist");
60 argv.emplace_back(
"-ORBendPoint");
61 argv.emplace_back(
"giop:tcp:127.0.0.1:" +
port());
71 url.replace(url.find(
"%23"), 3,
"#");
72 auto start = std::chrono::steady_clock::now();
75 std::this_thread::sleep_for(std::chrono::milliseconds(500));
76 remoteProxy = std::make_shared<Tango::DeviceProxy>(url);
80 catch(CORBA::Exception& ex) {
81 if(
auto now = std::chrono::steady_clock::now(); now >
start + std::chrono::seconds(10)) {
82 Tango::Except::print_exception(ex);
95 kill(remotePid, SIGINT);
102 static std::string corbaPort;
103 if(corbaPort.empty()) {
104 std::random_device rd;
105 std::uniform_int_distribution<int> dist(10000, 50000);
106 corbaPort = std::to_string(dist(rd));
115 return "tango://localhost:" +
port() +
"/" +
device() +
"%23dbase=no";
145 auto sourceTemplate = basePath +
"_template.db";
147 std::filesystem::copy_file(sourceTemplate,
offlineDatabase, std::filesystem::copy_options::overwrite_existing);
149 catch(std::runtime_error& err) {
150 std::cerr << err.what() << std::endl;
boost::process::child tangoServerProcess
TangoServerLauncher(std::string setTestName="Unified", bool setVerbose=false)
std::vector< std::string > argv
std::string getClientUrl() const
An URL that can be used by the Tango::DeviceProxy to connect to this server.
const std::string & device() const
The Tango device name.
TangoServerLauncher & setCreateOfflineDatabase(bool create)
std::string offlineDatabase
TangoServerLauncher & overrideNames(const std::string &newNames)
void stop()
Shut down the Tango server.
static TangoServerLauncher * self
TangoServerLauncher & setKeepOfflineDatabase(bool keep)
std::shared_ptr< Tango::DeviceProxy > remoteProxy
static std::string port()
Get the port used for CORBA commuication.
bool createOfflineDatabase
TangoServerLauncher & setOfflineDatabase(const std::string &basePath)
Configure the Tango server to run against an offline database.