Skip to content
Snippets Groups Projects
Commit 06f6049d authored by Francois Henrotte's avatar Francois Henrotte
Browse files

loader as a test native client

parent aeeaf614
No related branches found
No related tags found
No related merge requests found
...@@ -1676,4 +1676,6 @@ void MetaModel::client_sentence(const std::string &name, ...@@ -1676,4 +1676,6 @@ void MetaModel::client_sentence(const std::string &name,
OLMsg::Error("Unknown client <%s>", name.c_str()); OLMsg::Error("Unknown client <%s>", name.c_str());
} }
} }
else
OLMsg::Error("Unknown action <%s>", action.c_str());
} }
...@@ -236,6 +236,7 @@ int main(int argc, char *argv[]){ ...@@ -236,6 +236,7 @@ int main(int argc, char *argv[]){
launchMenu=true; launchMenu=true;
} }
else if(!strcmp(argv[i] + 1, "lol")) { else if(!strcmp(argv[i] + 1, "lol")) {
//loader used to call non-native clients (type=encapsulated)
std::string clientName=argv[i+1]; std::string clientName=argv[i+1];
client = new onelab::remoteNetworkClient(clientName,argv[i+2]); client = new onelab::remoteNetworkClient(clientName,argv[i+2]);
if(client){ if(client){
...@@ -265,6 +266,37 @@ int main(int argc, char *argv[]){ ...@@ -265,6 +266,37 @@ int main(int argc, char *argv[]){
} }
exit(1); exit(1);
} }
else if(!strcmp(argv[i] + 1, "onelab")) {
//loader used as a test native client
client = new onelab::remoteNetworkClient(argv[i+1],argv[i+2]);
if(!client){
std::cout << "I have no client\n";
exit(1);
}
std::vector<onelab::string> strings;
client->get(strings,client->getName()+"/9CheckCommand");
if(strings.empty()){ // initialize
onelab::string s(client->getName()+"/9CheckCommand","-a");
client->set(s);
onelab::number o(client->getName()+"/Initialized",1);
client->set(o);
}
else{
std::cout << "I am initialized: CheckCommand=<"
<< strings[0].getValue() << ">" << std::endl;
onelab::number o("alpha",123456);
client->set(o);
client->get(strings,"MESSAGE");
if(strings.size()){
std::cout << "I have to tell you: " << strings[0].getValue() << std::endl;
}
std::cout << "Now sleeping for 5s\n";
SleepInSeconds(5);
std::cout << "Awake again\n";
}
delete client;
return 0;
}
else if(!strcmp(argv[i] + 1, "v")) { else if(!strcmp(argv[i] + 1, "v")) {
i++; i++;
if(argv[i]) if(argv[i])
......
...@@ -184,7 +184,7 @@ int SystemCall(const std::string &command, bool blocking) ...@@ -184,7 +184,7 @@ int SystemCall(const std::string &command, bool blocking)
PROCESS_INFORMATION prInfo; PROCESS_INFORMATION prInfo;
memset(&suInfo, 0, sizeof(suInfo)); memset(&suInfo, 0, sizeof(suInfo));
suInfo.cb = sizeof(suInfo); suInfo.cb = sizeof(suInfo);
//OLMsg::Info("Calling <%s>", command.c_str()); OLMsg::Info("Calling <%s>", command.c_str());
if(blocking){ if(blocking){
CreateProcess(NULL, (char*)command.c_str(), NULL, NULL, FALSE, CreateProcess(NULL, (char*)command.c_str(), NULL, NULL, FALSE,
NORMAL_PRIORITY_CLASS, NULL, NULL, NORMAL_PRIORITY_CLASS, NULL, NULL,
...@@ -210,7 +210,7 @@ int SystemCall(const std::string &command, bool blocking) ...@@ -210,7 +210,7 @@ int SystemCall(const std::string &command, bool blocking)
} }
std::string cmd(command); std::string cmd(command);
if(!blocking) cmd += " &"; if(!blocking) cmd += " &";
//OLMsg::Info("Calling <%s>", cmd.c_str()); OLMsg::Info("Calling <%s>", cmd.c_str());
return system(cmd.c_str()); return system(cmd.c_str());
#endif #endif
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment