|
@@ -18,7 +18,7 @@
|
|
|
const char *ORCHESTRATOR = "bin/orchestrator";
|
|
|
const char *SHUT_DOWN = "scripts/bringDownTestServers.sh";
|
|
|
const int INPUT_BUFFER_LEN = 133;
|
|
|
-char whichTest[INPUT_BUFFER_LEN];
|
|
|
+char whichTest[INPUT_BUFFER_LEN+2];
|
|
|
int currPid = 0;
|
|
|
bool stopSignaled = false;
|
|
|
|
|
@@ -29,8 +29,8 @@ void exitInterruptHandler(int signum)
|
|
|
kill(-currPid, SIGINT);
|
|
|
|
|
|
char *argv[3];
|
|
|
- char shutdownBuffer[INPUT_BUFFER_LEN];
|
|
|
- strncpy(shutdownBuffer, SHUT_DOWN, INPUT_BUFFER_LEN);
|
|
|
+ char shutdownBuffer[INPUT_BUFFER_LEN+2];
|
|
|
+ strncpy(shutdownBuffer, SHUT_DOWN, INPUT_BUFFER_LEN+1);
|
|
|
|
|
|
argv[0] = shutdownBuffer;
|
|
|
argv[1] = whichTest;
|
|
@@ -60,7 +60,7 @@ int main(int argc, char* argv[])
|
|
|
signal(SIGINT, exitInterruptHandler);
|
|
|
signal(SIGTSTP, gentleInterruptHandler);
|
|
|
|
|
|
- char inputBuffer[INPUT_BUFFER_LEN];
|
|
|
+ char inputBuffer[INPUT_BUFFER_LEN+2];
|
|
|
std::ifstream configFile("cfg/queue.cfg");
|
|
|
while (!stopSignaled && !configFile.eof())
|
|
|
{
|
|
@@ -70,12 +70,12 @@ int main(int argc, char* argv[])
|
|
|
char *helper = strtok(inputBuffer, " ");
|
|
|
char *argv[6];
|
|
|
|
|
|
- char orchestratorBuffer[INPUT_BUFFER_LEN];
|
|
|
- strncpy(orchestratorBuffer, ORCHESTRATOR, INPUT_BUFFER_LEN);
|
|
|
+ char orchestratorBuffer[INPUT_BUFFER_LEN+2];
|
|
|
+ strncpy(orchestratorBuffer, ORCHESTRATOR, INPUT_BUFFER_LEN+1);
|
|
|
argv[0] = orchestratorBuffer;
|
|
|
argv[1] = helper;
|
|
|
|
|
|
- strncpy(whichTest, helper, INPUT_BUFFER_LEN);
|
|
|
+ strncpy(whichTest, helper, INPUT_BUFFER_LEN+1);
|
|
|
|
|
|
size_t i = 2;
|
|
|
while (helper != NULL && i < 6)
|
|
@@ -98,7 +98,21 @@ int main(int argc, char* argv[])
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- waitpid(currPid, NULL, 0);
|
|
|
+ int status;
|
|
|
+ waitpid(currPid, &status, 0);
|
|
|
+ if (WIFEXITED(status))
|
|
|
+ {
|
|
|
+ if (WEXITSTATUS(status) != 0)
|
|
|
+ {
|
|
|
+ std::cerr << "Something went wrong in previous run, aborting." << std::endl;
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (WIFSIGNALED(status))
|
|
|
+ {
|
|
|
+ std::cerr << "Signal terminated previous run, aborting." << std::endl;
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
}
|
|
|
currPid = 0;
|
|
|
}
|