Dev: fix py virtual test (#846)

* draft to fix virtual test when it fails

* catching errors in tests and removing sigchild ignore so servers (process in background) executing commands will not fail (pclose no child processes, if sigchld is ignored) fixed

* uncommented python loading config

* somehow killal slsReciever in second detector test fails even though no receiver running

* fixing script for virtual simlator test:fixed issue with check if process running, fixed moench tests
This commit is contained in:
2023-11-07 09:30:46 +01:00
committed by GitHub
parent 314a8a0daa
commit 397e846509
14 changed files with 200 additions and 74 deletions

View File

@ -17,7 +17,7 @@ const char *getRetName();
void function_table();
void functionNotImplemented();
void modeNotImplemented(char *modename, int mode);
int executeCommand(char *command, char *result, enum TLogLevel level);
void executeCommand(char *command, char *result, enum TLogLevel level);
int M_nofunc(int);
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
void rebootNiosControllerAndFPGA();

View File

@ -516,7 +516,7 @@ void modeNotImplemented(char *modename, int mode) {
LOG(logERROR, (mess));
}
int executeCommand(char *command, char *result, enum TLogLevel level) {
void executeCommand(char *command, char *result, enum TLogLevel level) {
ret = OK;
memset(mess, 0, sizeof(mess));
@ -532,6 +532,11 @@ int executeCommand(char *command, char *result, enum TLogLevel level) {
fflush(stdout);
FILE *sysFile = popen(cmd, "r");
if (sysFile == NULL) {
ret = FAIL;
sprintf(mess, "Executing cmd[%s] failed\n", cmd);
return;
}
while (fgets(temp, tempsize, sysFile) != NULL) {
// size left excludes terminating character
size_t sizeleft = MAX_STR_LENGTH - strlen(result) - 1;
@ -547,17 +552,14 @@ int executeCommand(char *command, char *result, enum TLogLevel level) {
if (strlen(result) == 0) {
strcpy(result, "No result");
}
int retval = OK;
int success = pclose(sysFile);
if (success) {
retval = FAIL;
LOG(logERROR, ("Executing cmd[%s]:%s\n", cmd, result));
if (success == -1) {
ret = FAIL;
strcpy(mess, result);
LOG(logERROR, ("Executing cmd[%s] failed:%s\n", cmd, mess));
} else {
LOG(level, ("Result:\n[%s]\n", result));
}
return retval;
}
int M_nofunc(int file_des) {
@ -585,7 +587,7 @@ int exec_command(int file_des) {
// set
if (Server_VerifyLock() == OK) {
ret = executeCommand(cmd, retval, logINFO);
executeCommand(cmd, retval, logINFO);
}
return Server_SendResult(file_des, OTHER, retval, sizeof(retval));
}