Fix how test deals with terminating rdcd
Previously we would return -1 if we detected rdcd was still running. But the rdcd process ID is alive as long as the test is running. So now we return 0, and the rdcd process ends, allowing the test to end cleanly. Change-Id: I98a5aa0a03d14127824b86e1190047c9f9d2edb7
This commit is contained in:
@@ -158,17 +158,17 @@ static int killRDCD(int pid = 0) {
|
||||
}
|
||||
// Try several times; it may take some time for rdcd to clean up.
|
||||
for (int i = 0; i < 20; ++i) {
|
||||
sleep(1);
|
||||
sleep(0.01);
|
||||
|
||||
pid = getPIDFromName("rdcd");
|
||||
|
||||
if (pid == -1) {
|
||||
return 0;
|
||||
}
|
||||
ret = kill(pid, SIGTERM);
|
||||
}
|
||||
|
||||
std::cout << "ERROR: Failed to kill existing rdcd instance." << std::endl;
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int startRDCD(std::string *rdcd_path, char *envp[]) {
|
||||
@@ -178,7 +178,9 @@ static int startRDCD(std::string *rdcd_path, char *envp[]) {
|
||||
|
||||
if (pid == 0) {
|
||||
if (-1 == execve(rdcd_cl[0], (char **)rdcd_cl , envp)) { // NOLINT
|
||||
perror("ERROR: Child process failed to start rdcd");
|
||||
std::string err_msg = "ERROR: Child process failed to start ";
|
||||
err_msg += *rdcd_path;
|
||||
perror(err_msg.c_str());
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user