提交 2793effa 编写于 作者: J jiacy-jcy

[TS-293]<test>:add test case

上级 f253be59
......@@ -7,8 +7,7 @@ LFLAGS = '-Wl,-rpath,/usr/local/taos/driver/' -ltaos -lpthread -lm -lrt
CFLAGS = -O3 -g -Wall -Wno-deprecated -fPIC -Wno-unused-result -Wconversion \
-Wno-char-subscripts -D_REENTRANT -Wno-format -D_REENTRANT -DLINUX \
-Wno-unused-function -D_M_X64 -I/usr/local/taos/include -std=gnu99 \
-I../../../deps/cJson/inc -I../../../src/os/inc -I../../../src/inc \
-I../../../src/util/inc -I../../../src/common/inc
-I../../../deps/cJson/inc
all: $(TARGET)
exe:
......@@ -18,11 +17,7 @@ exe:
gcc $(CFLAGS) ./stream.c -o $(ROOT)stream $(LFLAGS)
gcc $(CFLAGS) ./subscribe.c -o $(ROOT)subscribe $(LFLAGS)
gcc $(CFLAGS) ./apitest.c -o $(ROOT)apitest $(LFLAGS)
gcc $(CFLAGS) ./clientcfgtest.c -o $(ROOT)clientcfgtest $(LFLAGS)
gcc $(CFLAGS) ./clientcfgtest-wrongtype.c -o $(ROOT)clientcfgtest-wrongtype $(LFLAGS)
gcc $(CFLAGS) ./clientcfgtest-wrongjson.c -o $(ROOT)clientcfgtest-wrongjson $(LFLAGS)
gcc $(CFLAGS) ./clientcfgtest-wrongvalue.c -o $(ROOT)clientcfgtest-wrongvalue $(LFLAGS)
gcc $(CFLAGS) ./clientcfgtest-taosd.c -o $(ROOT)clientcfgtest-taosd $(LFLAGS)
clean:
......@@ -33,9 +28,5 @@ clean:
rm $(ROOT)stream
rm $(ROOT)subscribe
rm $(ROOT)apitest
rm $(ROOT)clientcfgtest
rm $(ROOT)clientcfgtest-wrongtype
rm $(ROOT)clientcfgtest-wrongjson
rm $(ROOT)clientcfgtest-wrongvalue
rm $(ROOT)clientcfgtest-taosd
// The test case to verfy TS-293
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <taos.h>
#include "os.h"
#include "taosdef.h"
#include "taoserror.h"
#include "tconfig.h"
#include "tglobal.h"
#include "tulog.h"
#include "tsocket.h"
#include "tutil.h"
extern SGlobalCfg *taosGetConfigOption(const char *option) ;
int main( int argc, char *argv[]){
printf("start to test\n");
//case1:
//Test config firstEp success
const char config1[128] = "{\"firstEp\":\"BCC-2:6030\",\"debugFlag\":\"135\"}";//input the parameter which want to be configured
taos_set_config(config1); //configure the parameter
SGlobalCfg *cfg ;
cfg = taosGetConfigOption("firstEp");//check the option result
if(cfg->cfgStatus != 3){ //If cfgStatus is 3,it means configure is success
printf("config firstEp 'BCC-2:6030'failures!\n");
exit(1);
}
cfg = taosGetConfigOption("debugFlag");//check the option result
if(cfg->cfgStatus != 3){
printf("config debugFlag '135' failures!\n");
exit(1);
}
//case2:
//Test config only useful at the first time
//The result is failure
const char config2[128] = "{\"fqdn\":\"BCC-3\"}";
taos_set_config(config2); //configure the parameter
cfg = taosGetConfigOption("fqdn");//check the option result
if(cfg->cfgStatus == 3){
printf("config firstEp to 'BCC-3' failures!\n");
exit(1);
}
else{
printf("test case success!\n");
exit(0);
}
return 0 ;
}
......@@ -4,10 +4,12 @@
ROOT=./
TARGET=exe
LFLAGS = '-Wl,-rpath,/usr/local/taos/driver/' -ltaos -lpthread -lm -lrt
CFLAGS = -O0 -g -Wall -Wno-deprecated -fPIC -Wno-unused-result -Wconversion \
CFLAGS = -O3 -g -Wall -Wno-deprecated -fPIC -Wno-unused-result -Wconversion \
-Wno-char-subscripts -D_REENTRANT -Wno-format -D_REENTRANT -DLINUX \
-Wno-unused-function -D_M_X64 -I/usr/local/taos/include -std=gnu99 \
-fsanitize=address
-I../../../deps/cJson/inc\
-I../../../src/os/inc/ -I../../../src/inc -I../../../src/util/inc \
-I../../../src/common/inc
all: $(TARGET)
......@@ -16,9 +18,11 @@ exe:
gcc $(CFLAGS) ./stmtBatchTest.c -o $(ROOT)stmtBatchTest $(LFLAGS)
gcc $(CFLAGS) ./stmtTest.c -o $(ROOT)stmtTest $(LFLAGS)
gcc $(CFLAGS) ./stmt_function.c -o $(ROOT)stmt_function $(LFLAGS)
gcc $(CFLAGS) ./clientcfgtest.c -o $(ROOT)clientcfgtest $(LFLAGS)
clean:
rm $(ROOT)batchprepare
rm $(ROOT)stmtBatchTest
rm $(ROOT)stmtTest
rm $(ROOT)stmt_function
rm $(ROOT)clientcfgtest
......@@ -233,6 +233,7 @@ totalPyFailed=0
totalJDBCFailed=0
totalUnitFailed=0
totalExampleFailed=0
totalApiFailed=0
if [ "${OS}" == "Linux" ]; then
corepath=`grep -oP '.*(?=core_)' /proc/sys/kernel/core_pattern||grep -oP '.*(?=core-)' /proc/sys/kernel/core_pattern`
......@@ -532,7 +533,25 @@ if [ "$2" != "sim" ] && [ "$2" != "python" ] && [ "$2" != "jdbc" ] && [ "$2" !=
echo "demo pass"
totalExamplePass=`expr $totalExamplePass + 1`
fi
echo "### run setconfig tests ###"
stopTaosd
cd ..
cd ..
cd scrpt/api
make > /dev/null
./clientcfgtest
if [ $? != "0" ]; then
echo "clientcfgtest failed"
totalExampleFailed=`expr $totalExampleFailed + 1`
else
echo "clientcfgtest pass"
totalExamplePass=`expr $totalExamplePass + 1`
fi
if [ "$totalExamplePass" -gt "0" ]; then
echo -e "\n${GREEN} ### Total $totalExamplePass examples succeed! ### ${NC}"
fi
......@@ -544,7 +563,13 @@ if [ "$2" != "sim" ] && [ "$2" != "python" ] && [ "$2" != "jdbc" ] && [ "$2" !=
if [ "${OS}" == "Linux" ]; then
dohavecore 1
fi
fi
exit $(($totalFailed + $totalPyFailed + $totalJDBCFailed + $totalUnitFailed + $totalExampleFailed))
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册