Merge pull request #13934 from taosdata/fix/ZhiqiangWang/TD-16357-fix-sim-udf-test-error
test: fix sim udf test error
This commit is contained in:
commit
4df4b2d145
|
@ -761,11 +761,12 @@ static int32_t mndRetrieveDnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
|||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)&pDnode->createdTime, false);
|
||||
|
||||
char b[tListLen(offlineReason) + VARSTR_HEADER_SIZE] = {0};
|
||||
char *b = taosMemoryCalloc(VARSTR_HEADER_SIZE + strlen(offlineReason[pDnode->offlineReason]) + 1, 1);
|
||||
STR_TO_VARSTR(b, online ? "" : offlineReason[pDnode->offlineReason]);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, b, false);
|
||||
taosMemoryFreeClear(b);
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pDnode);
|
||||
|
|
|
@ -72,6 +72,9 @@ int32_t taosEnvToCfg(const char *envStr, char *cfgStr) {
|
|||
if (cfgNameLen > 0) {
|
||||
memcpy(cfgStr, buf, cfgNameLen);
|
||||
memset(&cfgStr[cfgNameLen], ' ', p - cfgStr - cfgNameLen + 1);
|
||||
} else {
|
||||
*cfgStr = '\0';
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return strlen(cfgStr);
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
@echo off
|
||||
|
||||
echo Executing copy_udf.bat
|
||||
set SCRIPT_DIR=%cd%
|
||||
echo SCRIPT_DIR: %SCRIPT_DIR%
|
||||
|
||||
cd ..\..\..
|
||||
set TAOS_DIR=%cd%
|
||||
echo find udf library in %TAOS_DIR%
|
||||
set UDF1_DIR=%TAOS_DIR%\debug\build\lib\udf1.dll
|
||||
set UDF2_DIR=%TAOS_DIR%\debug\build\lib\udf2.dll
|
||||
|
||||
echo %UDF1_DIR%
|
||||
echo %UDF2_DIR%
|
||||
|
||||
set UDF_TMP=C:\Windows\Temp\udf
|
||||
rm -rf %UDF_TMP%
|
||||
mkdir %UDF_TMP%
|
||||
|
||||
echo Copy udf shared library files to %UDF_TMP%
|
||||
|
||||
cp %UDF1_DIR% %UDF_TMP%
|
||||
cp %UDF2_DIR% %UDF_TMP%
|
|
@ -19,8 +19,14 @@ sql show databases;
|
|||
sql create table t (ts timestamp, f int);
|
||||
sql insert into t values(now, 1)(now+1s, 2);
|
||||
|
||||
system_content printf %OS%
|
||||
if $system_content == Windows_NT then
|
||||
sql create function udf1 as 'C:\\Windows\\Temp\\udf1.dll' outputtype int bufSize 8;
|
||||
sql create aggregate function udf2 as 'C:\\Windows\\Temp\\udf2.dll' outputtype double bufSize 8;
|
||||
else
|
||||
sql create function udf1 as '/tmp/udf/libudf1.so' outputtype int bufSize 8;
|
||||
sql create aggregate function udf2 as '/tmp/udf/libudf2.so' outputtype double bufSize 8;
|
||||
endi
|
||||
sql show functions;
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
|
|
|
@ -458,11 +458,17 @@ bool simExecuteSystemContentCmd(SScript *script, char *option) {
|
|||
char buf[4096] = {0};
|
||||
char buf1[4096 + 512] = {0};
|
||||
char filename[400] = {0};
|
||||
sprintf(filename, "%s/%s.tmp", simScriptDir, script->fileName);
|
||||
sprintf(filename, "%s" TD_DIRSEP "%s.tmp", simScriptDir, script->fileName);
|
||||
|
||||
#ifdef WINDOWS
|
||||
sprintf(buf, "cd %s && ", simScriptDir);
|
||||
simVisuallizeOption(script, option, buf + strlen(buf));
|
||||
sprintf(buf1, "%s > %s 2>nul", buf, filename);
|
||||
#else
|
||||
sprintf(buf, "cd %s; ", simScriptDir);
|
||||
simVisuallizeOption(script, option, buf + strlen(buf));
|
||||
sprintf(buf1, "%s > %s 2>/dev/null", buf, filename);
|
||||
#endif
|
||||
|
||||
sprintf(script->system_exit_code, "%d", system(buf1));
|
||||
simStoreSystemContentResult(script, filename);
|
||||
|
|
|
@ -206,7 +206,7 @@ SScript *simParseScript(char *fileName) {
|
|||
|
||||
for (int32_t i = 0; i < cmdlen; ++i) {
|
||||
if (buffer[i] == '\r' || buffer[i] == '\n') {
|
||||
buffer[i] = ' ';
|
||||
buffer[i] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue