Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
493ad1cc
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
493ad1cc
编写于
7月 09, 2020
作者:
P
Ping Xiao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-754: build taosd before jdbc tests
上级
21c77738
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
47 addition
and
151 deletion
+47
-151
src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/TDNode.java
...or/jdbc/src/main/java/com/taosdata/jdbc/utils/TDNode.java
+19
-18
src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/TDNodes.java
...r/jdbc/src/main/java/com/taosdata/jdbc/utils/TDNodes.java
+20
-33
src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/TDSimClient.java
...bc/src/main/java/com/taosdata/jdbc/utils/TDSimClient.java
+0
-91
src/connector/jdbc/src/test/java/com/taosdata/jdbc/BaseTest.java
...nector/jdbc/src/test/java/com/taosdata/jdbc/BaseTest.java
+8
-9
未找到文件。
src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/TDNode.java
浏览文件 @
493ad1cc
...
...
@@ -37,11 +37,13 @@ public class TDNode {
this
.
testCluster
=
testCluster
;
}
public
void
searchTaosd
(
File
dir
,
ArrayList
<
String
>
taosdPath
)
{
File
[]
fileList
=
dir
.
listFiles
();
if
(
fileList
!=
null
&&
fileList
.
length
!=
0
)
{
if
(
fileList
==
null
||
fileList
.
length
==
0
)
{
return
;
}
for
(
File
file
:
fileList
)
{
if
(
file
.
isFile
())
{
if
(
file
.
getName
().
equals
(
"taosd"
))
{
...
...
@@ -53,9 +55,6 @@ public class TDNode {
}
}
return
;
}
public
void
start
()
{
String
selfPath
=
System
.
getProperty
(
"user.dir"
);
String
binPath
=
""
;
...
...
@@ -98,10 +97,10 @@ public class TDNode {
String
cmd
=
""
;
if
(
this
.
valgrind
==
0
)
{
cmd
=
"nohup "
+
binPath
+
" > /dev/null 2>&1 & "
;
cmd
=
"nohup "
+
binPath
+
"
-c "
+
cfgDir
+
"
> /dev/null 2>&1 & "
;
System
.
out
.
println
(
"start taosd cmd: "
+
cmd
);
}
else
{
String
valgrindCmdline
=
"valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes"
;
String
valgrindCmdline
=
"valgrind --tool=memcheck --leak-check=full --show-reac
∏
hable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes"
;
cmd
=
"nohup "
+
valgrindCmdline
+
" "
+
binPath
+
" -c "
+
this
.
cfgDir
+
" 2>&1 & "
;
}
...
...
@@ -172,7 +171,9 @@ public class TDNode {
public
void
setCfgConfig
(
String
option
,
String
value
)
{
try
{
String
cmd
=
"echo "
+
option
+
" "
+
value
+
" >> "
+
this
.
cfgPath
;
Runtime
.
getRuntime
().
exec
(
cmd
).
waitFor
();
String
[]
cmdLine
=
{
"sh"
,
"-c"
,
cmd
};
Process
ps
=
Runtime
.
getRuntime
().
exec
(
cmdLine
);
ps
.
waitFor
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -229,7 +230,7 @@ public class TDNode {
}
setCfgConfig
(
"dataDir"
,
this
.
dataDir
);
setCfgConfig
(
"logDir"
,
this
.
logDir
);
setCfgConfig
(
"numOfLogLines"
,
"100000000"
);
setCfgConfig
(
"numOfLogLines"
,
"1000000
/
00"
);
setCfgConfig
(
"mnodeEqualVnodeNum"
,
"0"
);
setCfgConfig
(
"walLevel"
,
"1"
);
setCfgConfig
(
"statusInterval"
,
"1"
);
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/TDNodes.java
浏览文件 @
493ad1cc
...
...
@@ -3,34 +3,29 @@ package com.taosdata.jdbc.utils;
import
java.io.File
;
import
java.util.*
;
public
class
TDNodes
{
private
ArrayList
<
TDNode
>
tdNodes
;
private
boolean
simDeployed
;
private
boolean
testCluster
;
private
int
valgrind
;
private
String
path
;
public
TDNodes
()
{
tdNodes
=
new
ArrayList
<>();
for
(
int
i
=
1
;
i
<
11
;
i
++)
{
tdNodes
.
add
(
new
TDNode
(
i
));
}
this
.
simDeployed
=
false
;
path
=
""
;
}
public
TDNodes
(
String
path
)
{
public
void
setPath
(
String
path
)
{
try
{
String
psCmd
=
"ps -ef|grep -w taosd| grep -v grep | awk '{print $2}'"
;
Process
ps
=
Runtime
.
getRuntime
().
exec
(
psCmd
);
ps
.
wait
();
ps
.
wait
For
();
String
killCmd
=
"kill -9 "
+
ps
.
pid
();
Runtime
.
getRuntime
().
exec
(
killCmd
).
waitFor
();
psCmd
=
"ps -ef|grep -w valgrind.bin| grep -v grep | awk '{print $2}'"
;
ps
=
Runtime
.
getRuntime
().
exec
(
psCmd
);
ps
.
wait
();
ps
.
wait
For
();
killCmd
=
"kill -9 "
+
ps
.
pid
();
Runtime
.
getRuntime
().
exec
(
killCmd
).
waitFor
();
...
...
@@ -42,7 +37,7 @@ public class TDNodes {
binPath
=
file
.
getCanonicalPath
();
System
.
out
.
println
(
"binPath real path: "
+
binPath
);
if
(!
path
.
isEmpty
())
{
if
(
path
.
isEmpty
())
{
file
=
new
File
(
path
+
"/../../"
);
path
=
file
.
getCanonicalPath
();
}
...
...
@@ -63,10 +58,6 @@ public class TDNodes {
this
.
valgrind
=
valgrind
;
}
public
void
setPath
(
String
path
)
{
this
.
path
=
path
;
}
public
void
check
(
int
index
)
{
if
(
index
<
1
||
index
>
10
)
{
System
.
out
.
println
(
"index: "
+
index
+
" should on a scale of [1, 10]"
);
...
...
@@ -75,22 +66,18 @@ public class TDNodes {
}
public
void
deploy
(
int
index
)
{
System
.
out
.
println
(
"======Start deploying tsim====="
);
TDSimClient
sim
=
new
TDSimClient
();
sim
.
setPath
(
path
);
System
.
out
.
println
(
"======path: "
+
path
+
"====="
);
sim
.
setTestCluster
(
this
.
testCluster
);
if
(
this
.
simDeployed
==
false
)
{
sim
.
deploy
();
this
.
simDeployed
=
true
;
}
try
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)
+
"/../../../"
);
String
projectRealPath
=
file
.
getCanonicalPath
();
check
(
index
);
tdNodes
.
get
(
index
-
1
).
setTestCluster
(
this
.
testCluster
);
tdNodes
.
get
(
index
-
1
).
setValgrind
(
valgrind
);
tdNodes
.
get
(
index
-
1
).
setPath
(
System
.
getProperty
(
"user.dir"
)
);
tdNodes
.
get
(
index
-
1
).
setPath
(
projectRealPath
);
tdNodes
.
get
(
index
-
1
).
deploy
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
System
.
out
.
println
(
"deploy Test Exception"
);
}
}
public
void
cfg
(
int
index
,
String
option
,
String
value
)
{
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/TDSimClient.java
已删除
100644 → 0
浏览文件 @
21c77738
package
com.taosdata.jdbc.utils
;
public
class
TDSimClient
{
private
boolean
testCluster
;
private
String
path
;
private
String
cfgDir
;
private
String
logDir
;
private
String
cfgPath
;
public
TDSimClient
()
{
testCluster
=
false
;
}
public
void
setTestCluster
(
boolean
testCluster
)
{
this
.
testCluster
=
testCluster
;
}
public
void
setPath
(
String
path
)
{
this
.
path
=
path
;
}
public
void
setCfgConfig
(
String
option
,
String
value
)
{
String
cmd
=
"echo "
+
option
+
" "
+
value
+
" >> "
+
this
.
cfgPath
;
System
.
out
.
println
(
"set cfg cmd "
+
cmd
);
try
{
Process
ps
=
Runtime
.
getRuntime
().
exec
(
cmd
);
System
.
out
.
println
(
"cfg command result: "
+
ps
.
waitFor
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
public
void
deploy
()
{
this
.
logDir
=
this
.
path
+
"/sim/psim/log"
;
System
.
out
.
println
(
"======logDir: "
+
logDir
+
"====="
);
this
.
cfgDir
=
this
.
path
+
"/sim/psim/cfg"
;
System
.
out
.
println
(
"======cfgDir: "
+
cfgDir
+
"====="
);
this
.
cfgPath
=
this
.
path
+
"/sim/psim/cfg/taos.cfg"
;
System
.
out
.
println
(
"======cfgPath: "
+
cfgPath
+
"====="
);
try
{
String
cmd
=
"rm -rf "
+
this
.
logDir
;
System
.
out
.
println
(
"cmd: = "
+
cmd
);
Process
ps
=
Runtime
.
getRuntime
().
exec
(
cmd
);
System
.
out
.
println
(
"return value "
+
ps
.
waitFor
());
System
.
out
.
println
(
Runtime
.
getRuntime
().
exec
(
cmd
).
waitFor
());
cmd
=
"rm -rf "
+
this
.
cfgDir
;
Runtime
.
getRuntime
().
exec
(
cmd
).
waitFor
();
System
.
out
.
println
(
cmd
+
" result: "
+
Runtime
.
getRuntime
().
exec
(
cmd
).
waitFor
());
cmd
=
"mkdir -p "
+
this
.
logDir
;
Runtime
.
getRuntime
().
exec
(
cmd
).
waitFor
();
System
.
out
.
println
(
cmd
+
" result: "
+
Runtime
.
getRuntime
().
exec
(
cmd
).
waitFor
());
cmd
=
"mkdir -p "
+
this
.
cfgDir
;
System
.
out
.
println
(
cmd
+
" result: "
+
Runtime
.
getRuntime
().
exec
(
cmd
).
waitFor
());
cmd
=
"touch "
+
this
.
cfgPath
;
System
.
out
.
println
(
cmd
+
" result: "
+
Runtime
.
getRuntime
().
exec
(
cmd
).
waitFor
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
if
(
this
.
testCluster
)
{
setCfgConfig
(
"masterIp"
,
"192.168.0.1"
);
setCfgConfig
(
"secondIp"
,
"192.168.0.2"
);
}
setCfgConfig
(
"logDir"
,
this
.
logDir
);
setCfgConfig
(
"numOfLogLines"
,
"100000000"
);
setCfgConfig
(
"numOfThreadsPerCore"
,
"2.0"
);
setCfgConfig
(
"locale"
,
"en_US.UTF-8"
);
setCfgConfig
(
"charset"
,
"UTF-8"
);
setCfgConfig
(
"asyncLog"
,
"0"
);
setCfgConfig
(
"anyIp"
,
"0"
);
setCfgConfig
(
"sdbDebugFlag"
,
"135"
);
setCfgConfig
(
"rpcDebugFlag"
,
"135"
);
setCfgConfig
(
"tmrDebugFlag"
,
"131"
);
setCfgConfig
(
"cDebugFlag"
,
"135"
);
setCfgConfig
(
"udebugFlag"
,
"135"
);
setCfgConfig
(
"jnidebugFlag"
,
"135"
);
setCfgConfig
(
"qdebugFlag"
,
"135"
);
}
}
\ No newline at end of file
src/connector/jdbc/src/test/java/com/taosdata/jdbc/BaseTest.java
浏览文件 @
493ad1cc
package
com.taosdata.jdbc
;
import
java.io.BufferedReader
;
import
java.io.File
;
import
java.io.InputStreamReader
;
import
com.taosdata.jdbc.utils.TDNodes
;
import
org.junit.AfterClass
;
...
...
@@ -14,14 +11,15 @@ public class BaseTest {
private
static
boolean
testCluster
=
false
;
private
static
String
deployPath
=
System
.
getProperty
(
"user.dir"
);
private
static
int
valgrind
=
0
;
private
static
TDNodes
tdNodes
=
new
TDNodes
();
@BeforeClass
public
static
void
set
upEnv
()
{
public
static
void
set
UpEvn
()
{
try
{
File
file
=
new
File
(
deployPath
+
"/../../../"
);
String
rootPath
=
file
.
getCanonicalPath
();
TDNodes
tdNodes
=
new
TDNodes
();
tdNodes
.
setPath
(
rootPath
);
tdNodes
.
setTestCluster
(
testCluster
);
tdNodes
.
setValgrid
(
valgrind
);
...
...
@@ -31,11 +29,12 @@ public class BaseTest {
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
System
.
out
.
println
(
"Base Test Exception"
);
}
}
@AfterClass
public
static
void
clea
r
UpEnv
()
{
public
static
void
clea
n
UpEnv
()
{
tdNodes
.
stop
(
1
);
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录