Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f95ff3bc
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f95ff3bc
编写于
9月 02, 2021
作者:
wmmhello
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'feature/TD-5992' of github.com:taosdata/TDengine into feature/TD-5992
上级
b4ab4d1a
8e6cc1cb
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
261 addition
and
1 deletion
+261
-1
tests/examples/c/-g
tests/examples/c/-g
+0
-0
tests/examples/c/clientcfgtest-taosd.c
tests/examples/c/clientcfgtest-taosd.c
+33
-0
tests/examples/c/clientcfgtest-wrongjson.c
tests/examples/c/clientcfgtest-wrongjson.c
+62
-0
tests/examples/c/clientcfgtest-wrongtype.c
tests/examples/c/clientcfgtest-wrongtype.c
+48
-0
tests/examples/c/clientcfgtest-wrongvalue.c
tests/examples/c/clientcfgtest-wrongvalue.c
+46
-0
tests/examples/c/clientcfgtest.c
tests/examples/c/clientcfgtest.c
+55
-0
tests/examples/c/makefile
tests/examples/c/makefile
+17
-1
未找到文件。
tests/examples/c/-g
0 → 100755
浏览文件 @
f95ff3bc
文件已添加
tests/examples/c/clientcfgtest-taosd.c
0 → 100644
浏览文件 @
f95ff3bc
#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 to wrong type
const
char
config1
[
128
]
=
"{
\"
cache
\"
:
\"
4
\"
}"
;
//input the parameter which want to be configured
taos_set_config
(
config1
);
//configure the parameter
SGlobalCfg
*
cfg1
;
cfg1
=
taosGetConfigOption
(
"cache"
);
//check the option result
if
(
cfg1
->
cfgStatus
==
3
)
//If cfgStatus is 3,it means configure is success
printf
(
"config cache to '4'success!
\n
"
);
else
printf
(
"config cache failure!
\n
"
);
return
0
;
}
tests/examples/c/clientcfgtest-wrongjson.c
0 → 100644
浏览文件 @
f95ff3bc
#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 with wrong JSON
//The result is failure
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
*
cfg1
;
cfg1
=
taosGetConfigOption
(
"firstEp"
);
//check the option result
if
(
cfg1
->
cfgStatus
==
3
)
//If cfgStatus is 3,it means configure is success
printf
(
"config firstEp 'BCC-2:6030'success!
\n
"
);
else
printf
(
"config firstEp failure!
\n
"
);
SGlobalCfg
*
cfg2
;
cfg2
=
taosGetConfigOption
(
"debugFlag"
);
//check the option result
if
(
cfg1
->
cfgStatus
==
3
)
//If cfgStatus is 3,it means configure is success
printf
(
"config debugFlag '135'success!
\n
"
);
else
printf
(
"config debugFlag failure!
\n
"
);
//case2:
//repair the JSON and try again
//The result is success
const
char
config2
[
128
]
=
"{
\"
firstEp
\"
:
\"
BCC-2:6030
\"
,
\"
debugFlag
\"
:
\"
135
\"
}"
;
//input the parameter which want to be configured
taos_set_config
(
config2
);
//configure the parameter
SGlobalCfg
*
cfg3
;
cfg3
=
taosGetConfigOption
(
"firstEp"
);
//check the option result
if
(
cfg3
->
cfgStatus
==
3
)
//If cfgStatus is 3,it means configure is success
printf
(
"config firstEp 'BCC-2:6030'success!
\n
"
);
else
printf
(
"config firstEp failure!
\n
"
);
SGlobalCfg
*
cfg4
;
cfg4
=
taosGetConfigOption
(
"debugFlag"
);
//check the option result
if
(
cfg4
->
cfgStatus
==
3
)
//If cfgStatus is 3,it means configure is success
printf
(
"config debugFlag '135'success!
\n
"
);
else
printf
(
"config debugFlag failure!
\n
"
);
return
0
;
}
tests/examples/c/clientcfgtest-wrongtype.c
0 → 100644
浏览文件 @
f95ff3bc
#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 to wrong type
//The result is failure
const
char
config1
[
128
]
=
"{
\"
debugFlag
\"
:
\"
9999999999999999999999999
\"
}"
;
//input the parameter which want to be configured
taos_set_config
(
config1
);
//configure the parameter
SGlobalCfg
*
cfg1
;
cfg1
=
taosGetConfigOption
(
"debugFlag"
);
//check the option result
if
(
cfg1
->
cfgStatus
==
3
)
//If cfgStatus is 3,it means configure is success
printf
(
"config debugFlag '9999999999999999999999999
\n
"
);
else
printf
(
"config debugFlag failure!
\n
"
);
//case2:
//Try again with right parameter
//The result is failure
const
char
config2
[
128
]
=
"{
\"
debugFlag
\"
:
\"
135
\"
}"
;
//input the parameter which want to be configured
taos_set_config
(
config2
);
//configure the parameter
SGlobalCfg
*
cfg2
;
cfg2
=
taosGetConfigOption
(
"debugFlag"
);
//check the option result
if
(
cfg2
->
cfgStatus
==
3
)
//If cfgStatus is 3,it means configure is success
printf
(
"config debugflag '135'success!
\n
"
);
else
printf
(
"config debugflag failure!
\n
"
);
return
0
;
}
tests/examples/c/clientcfgtest-wrongvalue.c
0 → 100644
浏览文件 @
f95ff3bc
#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 to wrong type
const
char
config1
[
128
]
=
"{
\"
rpcTimer
\"
:
\"
0
\"
}"
;
//input the parameter which want to be configured
taos_set_config
(
config1
);
//configure the parameter
SGlobalCfg
*
cfg1
;
cfg1
=
taosGetConfigOption
(
"rpcTimer"
);
//check the option result
if
(
cfg1
->
cfgStatus
==
3
)
//If cfgStatus is 3,it means configure is success
printf
(
"config rpcTimer to '0'success!
\n
"
);
else
printf
(
"config rpcTimer failure!
\n
"
);
//case2:
//Try again with right parameter
const
char
config2
[
128
]
=
"{
\"
rpcTimer
\"
:
\"
400
\"
}"
;
//input the parameter which want to be configured
taos_set_config
(
config2
);
//configure the parameter
SGlobalCfg
*
cfg2
;
cfg2
=
taosGetConfigOption
(
"rpcTimer"
);
//check the option result
if
(
cfg2
->
cfgStatus
==
3
)
//If cfgStatus is 3,it means configure is success
printf
(
"config rpcTimer '400'success!
\n
"
);
else
printf
(
"config rpcTimer failure!
\n
"
);
return
0
;
}
tests/examples/c/clientcfgtest.c
0 → 100644
浏览文件 @
f95ff3bc
#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
*
cfg1
;
cfg1
=
taosGetConfigOption
(
"firstEp"
);
//check the option result
if
(
cfg1
->
cfgStatus
==
3
)
//If cfgStatus is 3,it means configure is success
printf
(
"config firstEp 'BCC-2:6030'success!
\n
"
);
else
printf
(
"config firstEp failure!
\n
"
);
SGlobalCfg
*
cfg2
;
cfg2
=
taosGetConfigOption
(
"debugFlag"
);
//check the option result
if
(
cfg2
->
cfgStatus
==
3
)
//If cfgStatus is 3,it means configure is success
printf
(
"config debugFlag '135' success!
\n
"
);
else
printf
(
"config debugFlag failure!
\n
"
);
//case2:
//Test config only useful at the first time
//The result is failure
const
char
config2
[
128
]
=
"{
\"
fqdn
\"
:
\"
BCC-3
\"
}"
;
//input the parameter which want to be configured
taos_set_config
(
config2
);
//configure the parameter
SGlobalCfg
*
cfg3
;
cfg2
=
taosGetConfigOption
(
"fqdn"
);
//check the option result
if
(
cfg2
->
cfgStatus
==
3
)
//If cfgStatus is 3,it means configure is success
printf
(
"config fqdn to 'BCC-3'success!
\n
"
);
else
printf
(
"config fqdn failure!
\n
"
);
return
0
;
}
tests/examples/c/makefile
浏览文件 @
f95ff3bc
...
...
@@ -6,7 +6,11 @@ TARGET=exe
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
-Wno-unused-function
-D_M_X64
-I
/usr/local/taos/include
-std
=
gnu99
\
-I
/home/ubuntu/TDengine/src/os/inc
-I
/home/ubuntu/TDengine/src/inc
\
-I
/home/ubuntu/TDengine/src/util/inc
\
-I
/home/ubuntu/TDengine/src/common/inc
all
:
$(TARGET)
...
...
@@ -17,6 +21,12 @@ 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
:
rm
$(ROOT)
asyncdemo
...
...
@@ -26,3 +36,9 @@ 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
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录