udfd: coverage
This commit is contained in:
parent
1cc8c6d6cc
commit
50dbfdd4a3
|
@ -1667,7 +1667,6 @@ static int32_t udfdGlobalDataInit() {
|
|||
}
|
||||
|
||||
static void udfdGlobalDataDeinit() {
|
||||
taosHashCleanup(global.udfsHash);
|
||||
uv_mutex_destroy(&global.udfsMutex);
|
||||
uv_mutex_destroy(&global.scriptPluginsMutex);
|
||||
taosMemoryFreeClear(global.loop);
|
||||
|
@ -1720,8 +1719,11 @@ void udfdDeinitResidentFuncs() {
|
|||
SUdf **udfInHash = taosHashGet(global.udfsHash, funcName, strlen(funcName));
|
||||
if (udfInHash) {
|
||||
SUdf *udf = *udfInHash;
|
||||
int32_t code = udf->scriptPlugin->udfDestroyFunc(udf->scriptUdfCtx);
|
||||
fnDebug("udfd destroy function returns %d", code);
|
||||
int32_t code = 0;
|
||||
if (udf->scriptPlugin->udfDestroyFunc) {
|
||||
code = udf->scriptPlugin->udfDestroyFunc(udf->scriptUdfCtx);
|
||||
fnDebug("udfd %s destroy function returns %d", funcName, code);
|
||||
}
|
||||
if(taosHashRemove(global.udfsHash, funcName, strlen(funcName)) != 0)
|
||||
{
|
||||
fnError("udfd remove resident function %s failed", funcName);
|
||||
|
@ -1729,6 +1731,7 @@ void udfdDeinitResidentFuncs() {
|
|||
taosMemoryFree(udf);
|
||||
}
|
||||
}
|
||||
taosHashCleanup(global.udfsHash);
|
||||
taosArrayDestroy(global.residentFuncs);
|
||||
fnInfo("udfd resident functions are deinit");
|
||||
}
|
||||
|
@ -1838,15 +1841,15 @@ int main(int argc, char *argv[]) {
|
|||
fnInfo("udfd exit normally");
|
||||
|
||||
removeListeningPipe();
|
||||
udfdDeinitScriptPlugins();
|
||||
|
||||
_exit:
|
||||
if (globalDataInited) {
|
||||
udfdGlobalDataDeinit();
|
||||
}
|
||||
if (residentFuncsInited) {
|
||||
udfdDeinitResidentFuncs();
|
||||
}
|
||||
udfdDeinitScriptPlugins();
|
||||
if (globalDataInited) {
|
||||
udfdGlobalDataDeinit();
|
||||
}
|
||||
if (udfSourceDirInited) {
|
||||
udfdDestroyUdfSourceDir();
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ import sys
|
|||
import time
|
||||
import os
|
||||
import platform
|
||||
import random
|
||||
import string
|
||||
|
||||
from util.log import *
|
||||
from util.sql import *
|
||||
|
@ -12,7 +14,7 @@ from util.dnodes import *
|
|||
import subprocess
|
||||
|
||||
class TDTestCase:
|
||||
|
||||
updatecfgDict = {'udfdResFuncs': "udf1,udf2"}
|
||||
def init(self, conn, logSql, replicaVar=1):
|
||||
self.replicaVar = int(replicaVar)
|
||||
tdLog.debug(f"start to excute {__file__}")
|
||||
|
@ -652,10 +654,20 @@ class TDTestCase:
|
|||
tdDnodes.start(1)
|
||||
time.sleep(2)
|
||||
|
||||
def test_udfd_cmd(self):
|
||||
tdLog.info(" test udfd -V ")
|
||||
os.system("udfd -V")
|
||||
tdLog.info(" test udfd -c ")
|
||||
os.system("udfd -c")
|
||||
|
||||
letters = string.ascii_letters + string.digits + '\\'
|
||||
path = ''.join(random.choice(letters) for i in range(5000))
|
||||
|
||||
def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring
|
||||
os.system(f"udfd -c {path}")
|
||||
|
||||
def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring
|
||||
print(" env is ok for all ")
|
||||
self.test_udfd_cmd()
|
||||
self.prepare_udf_so()
|
||||
self.prepare_data()
|
||||
self.create_udf_function()
|
||||
|
|
|
@ -11,7 +11,7 @@ from util.dnodes import *
|
|||
import subprocess
|
||||
|
||||
class TDTestCase:
|
||||
|
||||
updatecfgDict = {'udfdResFuncs': "udf1,udf2"}
|
||||
def init(self, conn, logSql, replicaVar=1):
|
||||
self.replicaVar = int(replicaVar)
|
||||
tdLog.debug(f"start to excute {__file__}")
|
||||
|
|
Loading…
Reference in New Issue