未验证 提交 be152567 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #4992 from taosdata/feature/sim

Feature/sim
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#undef TAOS_MEM_CHECK #undef TAOS_MEM_CHECK
bool simAsyncQuery = false; bool simAsyncQuery = false;
bool simExecSuccess = false;
void simHandleSignal(int32_t signo) { void simHandleSignal(int32_t signo) {
simSystemCleanUp(); simSystemCleanUp();
...@@ -62,5 +63,8 @@ int32_t main(int32_t argc, char *argv[]) { ...@@ -62,5 +63,8 @@ int32_t main(int32_t argc, char *argv[]) {
simScriptList[++simScriptPos] = script; simScriptList[++simScriptPos] = script;
simExecuteScript(script); simExecuteScript(script);
return 0; int32_t ret = simExecSuccess ? 0 : -1;
simError("execute result %d", ret);
return ret;
} }
\ No newline at end of file
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "ttimer.h" #include "ttimer.h"
#include "tutil.h" #include "tutil.h"
#include "tsocket.h" #include "tsocket.h"
#include "taoserror.h"
#undef TAOS_MEM_CHECK #undef TAOS_MEM_CHECK
SScript *simScriptList[MAX_MAIN_SCRIPT_NUM]; SScript *simScriptList[MAX_MAIN_SCRIPT_NUM];
...@@ -31,6 +32,8 @@ int32_t simDebugFlag = 135; ...@@ -31,6 +32,8 @@ int32_t simDebugFlag = 135;
void simCloseTaosdConnect(SScript *script); void simCloseTaosdConnect(SScript *script);
char simHostName[128]; char simHostName[128];
extern bool simExecSuccess;
char *simParseArbitratorName(char *varName) { char *simParseArbitratorName(char *varName) {
static char hostName[140]; static char hostName[140];
sprintf(hostName, "%s:%d", simHostName, 8000); sprintf(hostName, "%s:%d", simHostName, 8000);
...@@ -118,10 +121,12 @@ SScript *simProcessCallOver(SScript *script) { ...@@ -118,10 +121,12 @@ SScript *simProcessCallOver(SScript *script) {
if (script->type == SIM_SCRIPT_TYPE_MAIN) { if (script->type == SIM_SCRIPT_TYPE_MAIN) {
simDebug("script:%s, is main script, set stop flag", script->fileName); simDebug("script:%s, is main script, set stop flag", script->fileName);
if (script->killed) { if (script->killed) {
simExecSuccess = false;
simInfo("script:" FAILED_PREFIX "%s" FAILED_POSTFIX ", " FAILED_PREFIX "failed" FAILED_POSTFIX ", error:%s", simInfo("script:" FAILED_PREFIX "%s" FAILED_POSTFIX ", " FAILED_PREFIX "failed" FAILED_POSTFIX ", error:%s",
script->fileName, script->error); script->fileName, script->error);
return NULL; return NULL;
} else { } else {
simExecSuccess = true;
simInfo("script:" SUCCESS_PREFIX "%s" SUCCESS_POSTFIX ", " SUCCESS_PREFIX "success" SUCCESS_POSTFIX, simInfo("script:" SUCCESS_PREFIX "%s" SUCCESS_POSTFIX ", " SUCCESS_PREFIX "success" SUCCESS_POSTFIX,
script->fileName); script->fileName);
simCloseTaosdConnect(script); simCloseTaosdConnect(script);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册