Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
112ee168
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
112ee168
编写于
4月 22, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into feature/mpeer
上级
1260d409
31a90129
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
179 addition
and
81 deletion
+179
-81
.travis.yml
.travis.yml
+33
-15
src/query/tests/astTest.cpp
src/query/tests/astTest.cpp
+31
-31
src/util/inc/tskiplist.h
src/util/inc/tskiplist.h
+2
-0
src/util/src/tskiplist.c
src/util/src/tskiplist.c
+22
-4
src/util/tests/CMakeLists.txt
src/util/tests/CMakeLists.txt
+1
-1
tests/pytest/simpletest.sh
tests/pytest/simpletest.sh
+3
-1
tests/pytest/test.py
tests/pytest/test.py
+38
-5
tests/pytest/util/dnodes.py
tests/pytest/util/dnodes.py
+30
-6
tests/pytest/util/log.py
tests/pytest/util/log.py
+1
-1
tests/test-all.sh
tests/test-all.sh
+18
-17
未找到文件。
.travis.yml
浏览文件 @
112ee168
...
@@ -24,10 +24,11 @@ matrix:
...
@@ -24,10 +24,11 @@ matrix:
-
python-setuptools
-
python-setuptools
-
python3-pip
-
python3-pip
-
python3-setuptools
-
python3-setuptools
-
valgrind
before_install
:
before_install
:
-
sudo apt update -y -qq
-
sudo apt update -y -qq
-
sudo apt install -y net-tools python-pip python-setuptools python3-pip python3-setuptools
-
sudo apt install -y net-tools python-pip python-setuptools python3-pip python3-setuptools
valgrind
before_script
:
before_script
:
-
cd ${TRAVIS_BUILD_DIR}
-
cd ${TRAVIS_BUILD_DIR}
...
@@ -43,16 +44,32 @@ matrix:
...
@@ -43,16 +44,32 @@ matrix:
case $TRAVIS_OS_NAME in
case $TRAVIS_OS_NAME in
linux)
linux)
cd ${TRAVIS_BUILD_DIR}/debug
cd ${TRAVIS_BUILD_DIR}/debug
sudo make install ||
exit
$?
sudo make install ||
travis_terminate
$?
pip install --user ${TRAVIS_BUILD_DIR}/src/connector/python/linux/python2/
pip install --user ${TRAVIS_BUILD_DIR}/src/connector/python/linux/python2/
pip3 install --user ${TRAVIS_BUILD_DIR}/src/connector/python/linux/python3/
pip3 install --user ${TRAVIS_BUILD_DIR}/src/connector/python/linux/python3/
cd ${TRAVIS_BUILD_DIR}/tests
cd ${TRAVIS_BUILD_DIR}/tests
bash ./test-all.sh
./test-all.sh || travis_terminate $?
if [ "$?" -ne "0" ]; then
cd ${TRAVIS_BUILD_DIR}/tests/pytest
exit $?
./simpletest.sh -g 2>&1 | tee mem-error-out.txt
sleep 1
# Color setting
RED='\033[0;31m'
GREEN='\033[1;32m'
GREEN_DARK='\033[0;32m'
GREEN_UNDERLINE='\033[4;32m'
NC='\033[0m'
memError=`grep -m 1 'ERROR SUMMARY' mem-error-out.txt | awk '{print $4}'`
if [ -n "$memError" ]; then
if [ "$memError" -gt 23 ]; then
echo -e "${RED} ## Memory errors number valgrind reports is $memError. More than our threshold! ## ${NC} "
travis_terminate $memError
fi
fi
fi
;;
;;
...
@@ -74,12 +91,12 @@ matrix:
...
@@ -74,12 +91,12 @@ matrix:
# GitHub project metadata
# GitHub project metadata
# ** specific to your project **
# ** specific to your project **
project
:
project
:
name
:
sangshuduo/
TDengine
name
:
TDengine
version
:
2.x
version
:
2.x
description
:
sangshuduo
/TDengine
description
:
taosdata
/TDengine
# Where email notification of build analysis results will be sent
# Where email notification of build analysis results will be sent
notification_email
:
s
angshuduo@gmail
.com
notification_email
:
s
dsang@taosdata
.com
# Commands to prepare for build_command
# Commands to prepare for build_command
# ** likely specific to your build **
# ** likely specific to your build **
...
@@ -87,7 +104,7 @@ matrix:
...
@@ -87,7 +104,7 @@ matrix:
# The command that will be added as an argument to "cov-build" to compile your project for analysis,
# The command that will be added as an argument to "cov-build" to compile your project for analysis,
# ** likely specific to your build **
# ** likely specific to your build **
build_command
:
cmake --build .
build_command
:
make
# Pattern to match selecting branches that will run analysis. We recommend leaving this set to 'coverity_scan'.
# Pattern to match selecting branches that will run analysis. We recommend leaving this set to 'coverity_scan'.
# Take care in resource usage, and consider the build frequency allowances per
# Take care in resource usage, and consider the build frequency allowances per
...
@@ -132,22 +149,25 @@ matrix:
...
@@ -132,22 +149,25 @@ matrix:
case $TRAVIS_OS_NAME in
case $TRAVIS_OS_NAME in
linux)
linux)
cd ${TRAVIS_BUILD_DIR}/debug
cd ${TRAVIS_BUILD_DIR}/debug
sudo make install ||
exit
$?
sudo make install ||
travis_terminate
$?
pip install --user ${TRAVIS_BUILD_DIR}/src/connector/python/linux/python2/
pip install --user ${TRAVIS_BUILD_DIR}/src/connector/python/linux/python2/
pip3 install --user ${TRAVIS_BUILD_DIR}/src/connector/python/linux/python3/
pip3 install --user ${TRAVIS_BUILD_DIR}/src/connector/python/linux/python3/
cd ${TRAVIS_BUILD_DIR}/tests
cd ${TRAVIS_BUILD_DIR}/tests
bash
./test-all.sh
./test-all.sh
if [ "$?" -ne "0" ]; then
if [ "$?" -ne "0" ]; then
exit
$?
travis_terminate
$?
fi
fi
sudo pkill taosd
sleep 1
cd ${TRAVIS_BUILD_DIR}
cd ${TRAVIS_BUILD_DIR}
lcov -d . --capture --rc lcov_branch_coverage=1 -o coverage.info
lcov -d . --capture --rc lcov_branch_coverage=1 -o coverage.info
lcov -l --rc lcov_branch_coverage=1 coverage.info ||
exit
$?
lcov -l --rc lcov_branch_coverage=1 coverage.info ||
travis_terminate
$?
gem install coveralls-lcov
gem install coveralls-lcov
...
@@ -163,7 +183,6 @@ matrix:
...
@@ -163,7 +183,6 @@ matrix:
echo -e "${GREEN} ## Uploaded to Coveralls.io! ## ${NC}"
echo -e "${GREEN} ## Uploaded to Coveralls.io! ## ${NC}"
else
else
echo -e "${RED} ## Coveralls.io not collect coverage report! ## ${NC} "
echo -e "${RED} ## Coveralls.io not collect coverage report! ## ${NC} "
exit $?
fi
fi
bash <(curl -s https://codecov.io/bash) -y .codecov.yml -f coverage.info
bash <(curl -s https://codecov.io/bash) -y .codecov.yml -f coverage.info
...
@@ -171,7 +190,6 @@ matrix:
...
@@ -171,7 +190,6 @@ matrix:
echo -e "${GREEN} ## Uploaded to Codecov! ## ${NC} "
echo -e "${GREEN} ## Uploaded to Codecov! ## ${NC} "
else
else
echo -e "${RED} ## Codecov did not collect coverage report! ## ${NC} "
echo -e "${RED} ## Codecov did not collect coverage report! ## ${NC} "
exit $?
fi
fi
;;
;;
...
...
src/query/tests/astTest.cpp
浏览文件 @
112ee168
...
@@ -21,21 +21,21 @@ static void initSchema(SSchema *pSchema, int32_t numOfCols);
...
@@ -21,21 +21,21 @@ static void initSchema(SSchema *pSchema, int32_t numOfCols);
static
void
initSchema_binary
(
SSchema
*
schema
,
int32_t
numOfCols
);
static
void
initSchema_binary
(
SSchema
*
schema
,
int32_t
numOfCols
);
static
t
SkipList
*
createSkipList
(
SSchema
*
pSchema
,
int32_t
numOfTags
);
static
S
SkipList
*
createSkipList
(
SSchema
*
pSchema
,
int32_t
numOfTags
);
static
t
SkipList
*
createSkipList_binary
(
SSchema
*
pSchema
,
int32_t
numOfTags
);
static
S
SkipList
*
createSkipList_binary
(
SSchema
*
pSchema
,
int32_t
numOfTags
);
static
void
testQueryStr
(
SSchema
*
schema
,
int32_t
numOfCols
,
char
*
sql
,
t
SkipList
*
pSkipList
,
ResultObj
*
expectedVal
);
static
void
testQueryStr
(
SSchema
*
schema
,
int32_t
numOfCols
,
char
*
sql
,
S
SkipList
*
pSkipList
,
ResultObj
*
expectedVal
);
static
void
dropMeter
(
t
SkipList
*
pSkipList
);
static
void
dropMeter
(
S
SkipList
*
pSkipList
);
static
void
Right2LeftTest
(
SSchema
*
schema
,
int32_t
numOfCols
,
t
SkipList
*
pSkipList
);
static
void
Right2LeftTest
(
SSchema
*
schema
,
int32_t
numOfCols
,
S
SkipList
*
pSkipList
);
static
void
Left2RightTest
(
SSchema
*
schema
,
int32_t
numOfCols
,
t
SkipList
*
pSkipList
);
static
void
Left2RightTest
(
SSchema
*
schema
,
int32_t
numOfCols
,
S
SkipList
*
pSkipList
);
static
void
IllegalExprTest
(
SSchema
*
schema
,
int32_t
numOfCols
,
t
SkipList
*
pSkipList
);
static
void
IllegalExprTest
(
SSchema
*
schema
,
int32_t
numOfCols
,
S
SkipList
*
pSkipList
);
static
void
Left2RightTest_binary
(
SSchema
*
schema
,
int32_t
numOfCols
,
t
SkipList
*
pSkipList
);
static
void
Left2RightTest_binary
(
SSchema
*
schema
,
int32_t
numOfCols
,
S
SkipList
*
pSkipList
);
static
void
Right2LeftTest_binary
(
SSchema
*
schema
,
int32_t
numOfCols
,
t
SkipList
*
pSkipList
);
static
void
Right2LeftTest_binary
(
SSchema
*
schema
,
int32_t
numOfCols
,
S
SkipList
*
pSkipList
);
void
setValue
(
ResultObj
*
pResult
,
int32_t
num
,
char
**
val
)
{
void
setValue
(
ResultObj
*
pResult
,
int32_t
num
,
char
**
val
)
{
pResult
->
numOfResult
=
num
;
pResult
->
numOfResult
=
num
;
...
@@ -112,7 +112,7 @@ static void initSchema(SSchema *schema, int32_t numOfCols) {
...
@@ -112,7 +112,7 @@ static void initSchema(SSchema *schema, int32_t numOfCols) {
strcpy
(
schema
[
7
].
name
,
"h"
);
strcpy
(
schema
[
7
].
name
,
"h"
);
}
}
// static void addOneNode(SSchema *pSchema, int32_t tagsLen,
t
SkipList *pSkipList,
// static void addOneNode(SSchema *pSchema, int32_t tagsLen,
S
SkipList *pSkipList,
// char *meterId, int32_t a, double b, char *c, int64_t d, int16_t e, int8_t f, float g,
// char *meterId, int32_t a, double b, char *c, int64_t d, int16_t e, int8_t f, float g,
// bool h, int32_t numOfTags) {
// bool h, int32_t numOfTags) {
// STabObj *pMeter = calloc(1, sizeof(STabObj));
// STabObj *pMeter = calloc(1, sizeof(STabObj));
...
@@ -146,11 +146,11 @@ static void initSchema(SSchema *schema, int32_t numOfCols) {
...
@@ -146,11 +146,11 @@ static void initSchema(SSchema *schema, int32_t numOfCols) {
// offset += pSchema[6].bytes;
// offset += pSchema[6].bytes;
// *(int8_t *) (tags + offset) = h ? 1 : 0;
// *(int8_t *) (tags + offset) = h ? 1 : 0;
//
//
//
tSkipListKey pKey = t
SkipListCreateKey(pSchema[0].type, tags, pSchema[0].bytes);
//
SSkipListKey pKey = S
SkipListCreateKey(pSchema[0].type, tags, pSchema[0].bytes);
//
t
SkipListPut(pSkipList, pMeter, &pKey, 1);
//
S
SkipListPut(pSkipList, pMeter, &pKey, 1);
//}
//}
//
//
// static void addOneNode_binary(SSchema *pSchema, int32_t tagsLen,
t
SkipList *pSkipList,
// static void addOneNode_binary(SSchema *pSchema, int32_t tagsLen,
S
SkipList *pSkipList,
// char *meterId, int32_t a, double b, char *c, int64_t d, int16_t e, int8_t f, float g,
// char *meterId, int32_t a, double b, char *c, int64_t d, int16_t e, int8_t f, float g,
// bool h, int32_t numOfTags) {
// bool h, int32_t numOfTags) {
// STabObj *pMeter = calloc(1, sizeof(STabObj));
// STabObj *pMeter = calloc(1, sizeof(STabObj));
...
@@ -183,16 +183,16 @@ static void initSchema(SSchema *schema, int32_t numOfCols) {
...
@@ -183,16 +183,16 @@ static void initSchema(SSchema *schema, int32_t numOfCols) {
// offset += pSchema[6].bytes;
// offset += pSchema[6].bytes;
// *(int8_t *) (tags + offset) = h ? 1 : 0;
// *(int8_t *) (tags + offset) = h ? 1 : 0;
//
//
//
tSkipListKey pKey = t
SkipListCreateKey(pSchema[0].type, tags, pSchema[0].bytes);
//
SSkipListKey pKey = S
SkipListCreateKey(pSchema[0].type, tags, pSchema[0].bytes);
//
t
SkipListPut(pSkipList, pMeter, &pKey, 1);
//
S
SkipListPut(pSkipList, pMeter, &pKey, 1);
//
t
SkipListDestroyKey(&pKey);
//
S
SkipListDestroyKey(&pKey);
//}
//}
// static void dropMeter(
t
SkipList *pSkipList) {
// static void dropMeter(
S
SkipList *pSkipList) {
//
t
SkipListNode **pRes = NULL;
//
S
SkipListNode **pRes = NULL;
// int32_t num =
t
SkipListIterateList(pSkipList, &pRes, NULL, NULL);
// int32_t num =
S
SkipListIterateList(pSkipList, &pRes, NULL, NULL);
// for (int32_t i = 0; i < num; ++i) {
// for (int32_t i = 0; i < num; ++i) {
//
t
SkipListNode *pNode = pRes[i];
//
S
SkipListNode *pNode = pRes[i];
// STabObj *pMeter = (STabObj *) pNode->pData;
// STabObj *pMeter = (STabObj *) pNode->pData;
// free(pMeter->pTagData);
// free(pMeter->pTagData);
// free(pMeter);
// free(pMeter);
...
@@ -201,13 +201,13 @@ static void initSchema(SSchema *schema, int32_t numOfCols) {
...
@@ -201,13 +201,13 @@ static void initSchema(SSchema *schema, int32_t numOfCols) {
// free(pRes);
// free(pRes);
//}
//}
// static
t
SkipList *createSkipList(SSchema *pSchema, int32_t numOfTags) {
// static
S
SkipList *createSkipList(SSchema *pSchema, int32_t numOfTags) {
// int32_t tagsLen = 0;
// int32_t tagsLen = 0;
// for (int32_t i = 0; i < numOfTags; ++i) {
// for (int32_t i = 0; i < numOfTags; ++i) {
// tagsLen += pSchema[i].bytes;
// tagsLen += pSchema[i].bytes;
// }
// }
//
//
//
tSkipList *pSkipList = t
SkipListCreate(10, pSchema[0].type, 4);
//
SSkipList *pSkipList = S
SkipListCreate(10, pSchema[0].type, 4);
//
//
// addOneNode(pSchema, tagsLen, pSkipList, "tm0\0", 0, 10.5, "abc", 1000, -10000, -20, 1.0, true, 8);
// addOneNode(pSchema, tagsLen, pSkipList, "tm0\0", 0, 10.5, "abc", 1000, -10000, -20, 1.0, true, 8);
// addOneNode(pSchema, tagsLen, pSkipList, "tm1\0", 1, 20.5, "def", 1100, -10500, -30, 2.0, false, 8);
// addOneNode(pSchema, tagsLen, pSkipList, "tm1\0", 1, 20.5, "def", 1100, -10500, -30, 2.0, false, 8);
...
@@ -220,13 +220,13 @@ static void initSchema(SSchema *schema, int32_t numOfCols) {
...
@@ -220,13 +220,13 @@ static void initSchema(SSchema *schema, int32_t numOfCols) {
// return pSkipList;
// return pSkipList;
//}
//}
//
//
// static
t
SkipList *createSkipList_binary(SSchema *pSchema, int32_t numOfTags) {
// static
S
SkipList *createSkipList_binary(SSchema *pSchema, int32_t numOfTags) {
// int32_t tagsLen = 0;
// int32_t tagsLen = 0;
// for (int32_t i = 0; i < numOfTags; ++i) {
// for (int32_t i = 0; i < numOfTags; ++i) {
// tagsLen += pSchema[i].bytes;
// tagsLen += pSchema[i].bytes;
// }
// }
//
//
//
tSkipList *pSkipList = t
SkipListCreate(10, pSchema[0].type, 4);
//
SSkipList *pSkipList = S
SkipListCreate(10, pSchema[0].type, 4);
//
//
// addOneNode_binary(pSchema, tagsLen, pSkipList, "tm0\0", 0, 10.5, "abc", 1000, -10000, -20, 1.0, true, 8);
// addOneNode_binary(pSchema, tagsLen, pSkipList, "tm0\0", 0, 10.5, "abc", 1000, -10000, -20, 1.0, true, 8);
// addOneNode_binary(pSchema, tagsLen, pSkipList, "tm1\0", 1, 20.5, "def", 1100, -10500, -30, 2.0, false, 8);
// addOneNode_binary(pSchema, tagsLen, pSkipList, "tm1\0", 1, 20.5, "def", 1100, -10500, -30, 2.0, false, 8);
...
@@ -239,7 +239,7 @@ static void initSchema(SSchema *schema, int32_t numOfCols) {
...
@@ -239,7 +239,7 @@ static void initSchema(SSchema *schema, int32_t numOfCols) {
// return pSkipList;
// return pSkipList;
//}
//}
static
void
testQueryStr
(
SSchema
*
schema
,
int32_t
numOfCols
,
char
*
sql
,
t
SkipList
*
pSkipList
,
ResultObj
*
pResult
)
{
static
void
testQueryStr
(
SSchema
*
schema
,
int32_t
numOfCols
,
char
*
sql
,
S
SkipList
*
pSkipList
,
ResultObj
*
pResult
)
{
tExprNode
*
pExpr
=
NULL
;
tExprNode
*
pExpr
=
NULL
;
tSQLBinaryExprFromString
(
&
pExpr
,
schema
,
numOfCols
,
sql
,
strlen
(
sql
));
tSQLBinaryExprFromString
(
&
pExpr
,
schema
,
numOfCols
,
sql
,
strlen
(
sql
));
...
@@ -255,7 +255,7 @@ static void testQueryStr(SSchema *schema, int32_t numOfCols, char *sql, tSkipLis
...
@@ -255,7 +255,7 @@ static void testQueryStr(SSchema *schema, int32_t numOfCols, char *sql, tSkipLis
printf
(
"expr is: %s
\n
"
,
str
);
printf
(
"expr is: %s
\n
"
,
str
);
SArray
*
result
=
NULL
;
SArray
*
result
=
NULL
;
// tExprTreeTraverse(pExpr, pSkipList, result,
t
SkipListNodeFilterCallback, &result);
// tExprTreeTraverse(pExpr, pSkipList, result,
S
SkipListNodeFilterCallback, &result);
// printf("the result is:%lld\n", result.num);
// printf("the result is:%lld\n", result.num);
//
//
// bool findResult = false;
// bool findResult = false;
...
@@ -277,7 +277,7 @@ static void testQueryStr(SSchema *schema, int32_t numOfCols, char *sql, tSkipLis
...
@@ -277,7 +277,7 @@ static void testQueryStr(SSchema *schema, int32_t numOfCols, char *sql, tSkipLis
tExprTreeDestroy
(
&
pExpr
,
NULL
);
tExprTreeDestroy
(
&
pExpr
,
NULL
);
}
}
static
void
Left2RightTest
(
SSchema
*
schema
,
int32_t
numOfCols
,
t
SkipList
*
pSkipList
)
{
static
void
Left2RightTest
(
SSchema
*
schema
,
int32_t
numOfCols
,
S
SkipList
*
pSkipList
)
{
char
str
[
256
]
=
{
0
};
char
str
[
256
]
=
{
0
};
char
*
t0
[
1
]
=
{
"tm0"
};
char
*
t0
[
1
]
=
{
"tm0"
};
...
@@ -342,7 +342,7 @@ static void Left2RightTest(SSchema *schema, int32_t numOfCols, tSkipList *pSkipL
...
@@ -342,7 +342,7 @@ static void Left2RightTest(SSchema *schema, int32_t numOfCols, tSkipList *pSkipL
testQueryStr
(
schema
,
numOfCols
,
"f > -65"
,
pSkipList
,
&
res
);
testQueryStr
(
schema
,
numOfCols
,
"f > -65"
,
pSkipList
,
&
res
);
}
}
void
Right2LeftTest
(
SSchema
*
schema
,
int32_t
numOfCols
,
t
SkipList
*
pSkipList
)
{
void
Right2LeftTest
(
SSchema
*
schema
,
int32_t
numOfCols
,
S
SkipList
*
pSkipList
)
{
ResultObj
res
=
{
1
,
{
"tm1"
}};
ResultObj
res
=
{
1
,
{
"tm1"
}};
testQueryStr
(
schema
,
numOfCols
,
"((1=a))"
,
pSkipList
,
&
res
);
testQueryStr
(
schema
,
numOfCols
,
"((1=a))"
,
pSkipList
,
&
res
);
...
@@ -359,7 +359,7 @@ void Right2LeftTest(SSchema *schema, int32_t numOfCols, tSkipList *pSkipList) {
...
@@ -359,7 +359,7 @@ void Right2LeftTest(SSchema *schema, int32_t numOfCols, tSkipList *pSkipList) {
testQueryStr
(
schema
,
numOfCols
,
"0=h"
,
pSkipList
,
&
res
);
testQueryStr
(
schema
,
numOfCols
,
"0=h"
,
pSkipList
,
&
res
);
}
}
static
void
IllegalExprTest
(
SSchema
*
schema
,
int32_t
numOfCols
,
t
SkipList
*
pSkipList
)
{
static
void
IllegalExprTest
(
SSchema
*
schema
,
int32_t
numOfCols
,
S
SkipList
*
pSkipList
)
{
testQueryStr
(
schema
,
numOfCols
,
"h="
,
pSkipList
,
NULL
);
testQueryStr
(
schema
,
numOfCols
,
"h="
,
pSkipList
,
NULL
);
testQueryStr
(
schema
,
numOfCols
,
"h<"
,
pSkipList
,
NULL
);
testQueryStr
(
schema
,
numOfCols
,
"h<"
,
pSkipList
,
NULL
);
testQueryStr
(
schema
,
numOfCols
,
"a=1 and "
,
pSkipList
,
NULL
);
testQueryStr
(
schema
,
numOfCols
,
"a=1 and "
,
pSkipList
,
NULL
);
...
@@ -374,7 +374,7 @@ static void IllegalExprTest(SSchema *schema, int32_t numOfCols, tSkipList *pSkip
...
@@ -374,7 +374,7 @@ static void IllegalExprTest(SSchema *schema, int32_t numOfCols, tSkipList *pSkip
testQueryStr
(
schema
,
numOfCols
,
"a=1 and "
,
pSkipList
,
NULL
);
testQueryStr
(
schema
,
numOfCols
,
"a=1 and "
,
pSkipList
,
NULL
);
}
}
static
void
Left2RightTest_binary
(
SSchema
*
schema
,
int32_t
numOfCols
,
t
SkipList
*
pSkipList
)
{
static
void
Left2RightTest_binary
(
SSchema
*
schema
,
int32_t
numOfCols
,
S
SkipList
*
pSkipList
)
{
char
str
[
256
]
=
{
0
};
char
str
[
256
]
=
{
0
};
char
*
sql
=
NULL
;
char
*
sql
=
NULL
;
...
@@ -432,7 +432,7 @@ static void Left2RightTest_binary(SSchema *schema, int32_t numOfCols, tSkipList
...
@@ -432,7 +432,7 @@ static void Left2RightTest_binary(SSchema *schema, int32_t numOfCols, tSkipList
testQueryStr
(
schema
,
numOfCols
,
sql
,
pSkipList
,
&
res
);
testQueryStr
(
schema
,
numOfCols
,
sql
,
pSkipList
,
&
res
);
}
}
static
void
Right2LeftTest_binary
(
SSchema
*
schema
,
int32_t
numOfCols
,
t
SkipList
*
pSkipList
)
{
static
void
Right2LeftTest_binary
(
SSchema
*
schema
,
int32_t
numOfCols
,
S
SkipList
*
pSkipList
)
{
char
str
[
256
]
=
{
0
};
char
str
[
256
]
=
{
0
};
char
*
sql
=
NULL
;
char
*
sql
=
NULL
;
...
...
src/util/inc/tskiplist.h
浏览文件 @
112ee168
...
@@ -50,6 +50,8 @@ typedef struct SSkipListNode {
...
@@ -50,6 +50,8 @@ typedef struct SSkipListNode {
#define SL_GET_NODE_DATA(n) ((char *)(n) + SL_NODE_HEADER_SIZE((n)->level))
#define SL_GET_NODE_DATA(n) ((char *)(n) + SL_NODE_HEADER_SIZE((n)->level))
#define SL_GET_NODE_KEY(s, n) ((s)->keyFn(SL_GET_NODE_DATA(n)))
#define SL_GET_NODE_KEY(s, n) ((s)->keyFn(SL_GET_NODE_DATA(n)))
#define SL_GET_SL_MIN_KEY(s) (SL_GET_NODE_KEY((s), SL_GET_FORWARD_POINTER((s)->pHead, 0)))
#define SL_GET_NODE_LEVEL(n) *(uint8_t *)((n))
#define SL_GET_NODE_LEVEL(n) *(uint8_t *)((n))
/*
/*
...
...
src/util/src/tskiplist.c
浏览文件 @
112ee168
...
@@ -71,7 +71,8 @@ memset(pNode, 0, SL_NODE_HEADER_SIZE(_l));\
...
@@ -71,7 +71,8 @@ memset(pNode, 0, SL_NODE_HEADER_SIZE(_l));\
} while(0)
} while(0)
static
void
tSkipListDoInsert
(
SSkipList
*
pSkipList
,
SSkipListNode
**
forward
,
SSkipListNode
*
pNode
);
static
void
tSkipListDoInsert
(
SSkipList
*
pSkipList
,
SSkipListNode
**
forward
,
SSkipListNode
*
pNode
);
static
SSkipListNode
*
tSkipListDoAppend
(
SSkipList
*
pSkipList
,
SSkipListNode
*
pNode
);
static
SSkipListNode
*
tSkipListPushBack
(
SSkipList
*
pSkipList
,
SSkipListNode
*
pNode
);
static
SSkipListNode
*
tSkipListPushFront
(
SSkipList
*
pSkipList
,
SSkipListNode
*
pNode
);
static
SSkipListIterator
*
doCreateSkipListIterator
(
SSkipList
*
pSkipList
,
int32_t
order
);
static
SSkipListIterator
*
doCreateSkipListIterator
(
SSkipList
*
pSkipList
,
int32_t
order
);
static
bool
initForwardBackwardPtr
(
SSkipList
*
pSkipList
)
{
static
bool
initForwardBackwardPtr
(
SSkipList
*
pSkipList
)
{
...
@@ -207,10 +208,17 @@ SSkipListNode *tSkipListPut(SSkipList *pSkipList, SSkipListNode *pNode) {
...
@@ -207,10 +208,17 @@ SSkipListNode *tSkipListPut(SSkipList *pSkipList, SSkipListNode *pNode) {
pthread_rwlock_wrlock
(
pSkipList
->
lock
);
pthread_rwlock_wrlock
(
pSkipList
->
lock
);
}
}
//
the new key is greater than the last key of skiplist append it at last position
//
if the new key is greater than the maximum key of skip list, push back this node at the end of skip list
char
*
newDatakey
=
SL_GET_NODE_KEY
(
pSkipList
,
pNode
);
char
*
newDatakey
=
SL_GET_NODE_KEY
(
pSkipList
,
pNode
);
if
(
pSkipList
->
size
==
0
||
pSkipList
->
comparFn
(
pSkipList
->
lastKey
,
newDatakey
)
<
0
)
{
if
(
pSkipList
->
size
==
0
||
pSkipList
->
comparFn
(
pSkipList
->
lastKey
,
newDatakey
)
<
0
)
{
return
tSkipListDoAppend
(
pSkipList
,
pNode
);
return
tSkipListPushBack
(
pSkipList
,
pNode
);
}
// if the new key is less than the minimum key of skip list, push front this node at the front of skip list
assert
(
pSkipList
->
size
>
0
);
char
*
minKey
=
SL_GET_SL_MIN_KEY
(
pSkipList
);
if
(
pSkipList
->
comparFn
(
newDatakey
,
minKey
)
<
0
)
{
return
tSkipListPushFront
(
pSkipList
,
pNode
);
}
}
// find the appropriated position to insert data
// find the appropriated position to insert data
...
@@ -269,7 +277,17 @@ void tSkipListDoInsert(SSkipList *pSkipList, SSkipListNode **forward, SSkipListN
...
@@ -269,7 +277,17 @@ void tSkipListDoInsert(SSkipList *pSkipList, SSkipListNode **forward, SSkipListN
}
}
}
}
SSkipListNode
*
tSkipListDoAppend
(
SSkipList
*
pSkipList
,
SSkipListNode
*
pNode
)
{
SSkipListNode
*
tSkipListPushFront
(
SSkipList
*
pSkipList
,
SSkipListNode
*
pNode
)
{
SSkipListNode
*
forward
[
MAX_SKIP_LIST_LEVEL
]
=
{
0
};
for
(
int32_t
i
=
0
;
i
<
pSkipList
->
level
;
++
i
)
{
forward
[
i
]
=
pSkipList
->
pHead
;
}
tSkipListDoInsert
(
pSkipList
,
forward
,
pNode
);
return
pNode
;
}
SSkipListNode
*
tSkipListPushBack
(
SSkipList
*
pSkipList
,
SSkipListNode
*
pNode
)
{
// do clear pointer area
// do clear pointer area
DO_MEMSET_PTR_AREA
(
pNode
);
DO_MEMSET_PTR_AREA
(
pNode
);
...
...
src/util/tests/CMakeLists.txt
浏览文件 @
112ee168
...
@@ -11,5 +11,5 @@ IF (HEADER_GTEST_INCLUDE_DIR AND LIB_GTEST_STATIC_DIR)
...
@@ -11,5 +11,5 @@ IF (HEADER_GTEST_INCLUDE_DIR AND LIB_GTEST_STATIC_DIR)
AUX_SOURCE_DIRECTORY
(
${
CMAKE_CURRENT_SOURCE_DIR
}
SOURCE_LIST
)
AUX_SOURCE_DIRECTORY
(
${
CMAKE_CURRENT_SOURCE_DIR
}
SOURCE_LIST
)
ADD_EXECUTABLE
(
utilTest
${
SOURCE_LIST
}
)
ADD_EXECUTABLE
(
utilTest
${
SOURCE_LIST
}
)
TARGET_LINK_LIBRARIES
(
utilTest tutil gtest pthread
)
TARGET_LINK_LIBRARIES
(
utilTest tutil
common
gtest pthread
)
ENDIF
()
ENDIF
()
\ No newline at end of file
tests/pytest/simpletest.sh
浏览文件 @
112ee168
sudo
python ./test.py
-f
insert/basic.py
#!/bin/bash
python2 ./test.py
-f
insert/basic.py
$1
python2 ./test.py
-s
$1
tests/pytest/test.py
浏览文件 @
112ee168
...
@@ -15,6 +15,9 @@
...
@@ -15,6 +15,9 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
sys
import
sys
import
getopt
import
getopt
import
subprocess
from
distutils.log
import
warn
as
printf
from
util.log
import
*
from
util.log
import
*
from
util.dnodes
import
*
from
util.dnodes
import
*
from
util.cases
import
*
from
util.cases
import
*
...
@@ -29,8 +32,10 @@ if __name__ == "__main__":
...
@@ -29,8 +32,10 @@ if __name__ == "__main__":
deployPath
=
""
deployPath
=
""
masterIp
=
""
masterIp
=
""
testCluster
=
False
testCluster
=
False
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'f:p:m:sch'
,
[
valgrind
=
0
'file='
,
'path='
,
'master'
,
'stop'
,
'cluster'
,
'help'
])
stop
=
0
opts
,
args
=
getopt
.
gnu_getopt
(
sys
.
argv
[
1
:],
'f:p:m:scgh'
,
[
'file='
,
'path='
,
'master'
,
'stop'
,
'cluster'
,
'valgrind'
,
'help'
])
for
key
,
value
in
opts
:
for
key
,
value
in
opts
:
if
key
in
[
'-h'
,
'--help'
]:
if
key
in
[
'-h'
,
'--help'
]:
tdLog
.
printNoPrefix
(
tdLog
.
printNoPrefix
(
...
@@ -41,21 +46,49 @@ if __name__ == "__main__":
...
@@ -41,21 +46,49 @@ if __name__ == "__main__":
tdLog
.
printNoPrefix
(
'-c Test Cluster Flag'
)
tdLog
.
printNoPrefix
(
'-c Test Cluster Flag'
)
tdLog
.
printNoPrefix
(
'-s stop All dnodes'
)
tdLog
.
printNoPrefix
(
'-s stop All dnodes'
)
sys
.
exit
(
0
)
sys
.
exit
(
0
)
if
key
in
[
'-f'
,
'--file'
]:
if
key
in
[
'-f'
,
'--file'
]:
fileName
=
value
fileName
=
value
if
key
in
[
'-p'
,
'--path'
]:
if
key
in
[
'-p'
,
'--path'
]:
deployPath
=
value
deployPath
=
value
if
key
in
[
'-m'
,
'--master'
]:
if
key
in
[
'-m'
,
'--master'
]:
masterIp
=
value
masterIp
=
value
if
key
in
[
'-c'
,
'--cluster'
]:
if
key
in
[
'-c'
,
'--cluster'
]:
testCluster
=
True
testCluster
=
True
if
key
in
[
'-g'
,
'--valgrind'
]:
valgrind
=
1
if
key
in
[
'-s'
,
'--stop'
]:
if
key
in
[
'-s'
,
'--stop'
]:
cmd
=
"ps -ef|grep -w taosd | grep 'taosd' | grep -v grep | awk '{print $2}' && pkill -9 taosd"
stop
=
1
os
.
system
(
cmd
)
tdLog
.
exit
(
'stop All dnodes'
)
if
(
stop
!=
0
):
if
(
valgrind
==
0
):
toBeKilled
=
"taosd"
else
:
toBeKilled
=
"valgrind.bin"
killCmd
=
"ps -ef|grep -w %s| grep -v grep | awk '{print $2}' | xargs kill -HUP "
%
toBeKilled
os
.
system
(
killCmd
)
time
.
sleep
(
1
)
psCmd
=
"ps -ef|grep -w %s| grep -v grep | awk '{print $2}'"
%
toBeKilled
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
)
while
(
processID
):
os
.
system
(
killCmd
)
time
.
sleep
(
1
)
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
)
tdLog
.
exit
(
'stop All dnodes'
)
if
masterIp
==
""
:
if
masterIp
==
""
:
tdDnodes
.
init
(
deployPath
)
tdDnodes
.
init
(
deployPath
)
tdDnodes
.
setValgrind
(
valgrind
)
if
testCluster
:
if
testCluster
:
tdLog
.
notice
(
"Procedures for testing cluster"
)
tdLog
.
notice
(
"Procedures for testing cluster"
)
if
fileName
==
"all"
:
if
fileName
==
"all"
:
...
...
tests/pytest/util/dnodes.py
浏览文件 @
112ee168
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
import
sys
import
sys
import
os
import
os
import
os.path
import
os.path
import
subprocess
from
util.log
import
*
from
util.log
import
*
...
@@ -29,6 +30,9 @@ class TDSimClient:
...
@@ -29,6 +30,9 @@ class TDSimClient:
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
def
setValgrind
(
self
,
value
):
self
.
valgrind
=
value
def
deploy
(
self
):
def
deploy
(
self
):
self
.
logDir
=
"%s/sim/psim/log"
%
(
self
.
path
,)
self
.
logDir
=
"%s/sim/psim/log"
%
(
self
.
path
,)
self
.
cfgDir
=
"%s/sim/psim/cfg"
%
(
self
.
path
)
self
.
cfgDir
=
"%s/sim/psim/cfg"
%
(
self
.
path
)
...
@@ -78,10 +82,14 @@ class TDDnode:
...
@@ -78,10 +82,14 @@ class TDDnode:
self
.
index
=
index
self
.
index
=
index
self
.
running
=
0
self
.
running
=
0
self
.
deployed
=
0
self
.
deployed
=
0
self
.
valgrind
=
0
def
init
(
self
,
path
):
def
init
(
self
,
path
):
self
.
path
=
path
self
.
path
=
path
def
setValgrind
(
self
,
value
):
self
.
valgrind
=
value
def
deploy
(
self
):
def
deploy
(
self
):
self
.
logDir
=
"%s/sim/dnode%d/log"
%
(
self
.
path
,
self
.
index
)
self
.
logDir
=
"%s/sim/dnode%d/log"
%
(
self
.
path
,
self
.
index
)
self
.
dataDir
=
"%s/sim/dnode%d/data"
%
(
self
.
path
,
self
.
index
)
self
.
dataDir
=
"%s/sim/dnode%d/data"
%
(
self
.
path
,
self
.
index
)
...
@@ -164,9 +172,18 @@ class TDDnode:
...
@@ -164,9 +172,18 @@ class TDDnode:
if
self
.
deployed
==
0
:
if
self
.
deployed
==
0
:
tdLog
.
exit
(
"dnode:%d is not deployed"
%
(
self
.
index
))
tdLog
.
exit
(
"dnode:%d is not deployed"
%
(
self
.
index
))
cmd
=
"nohup %staosd -c %s > /dev/null 2>&1 & "
%
(
binPath
,
self
.
cfgDir
)
if
self
.
valgrind
==
0
:
print
(
cmd
)
cmd
=
"nohup %staosd -c %s > /dev/null 2>&1 & "
%
(
binPath
,
self
.
cfgDir
)
else
:
valgrindCmdline
=
"valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes"
cmd
=
"nohup %s %staosd -c %s 2>&1 & "
%
(
valgrindCmdline
,
binPath
,
self
.
cfgDir
)
print
(
cmd
)
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
self
.
running
=
1
self
.
running
=
1
...
@@ -275,8 +292,12 @@ class TDDnodes:
...
@@ -275,8 +292,12 @@ class TDDnodes:
self
.
sim
.
init
(
self
.
path
)
self
.
sim
.
init
(
self
.
path
)
self
.
sim
.
deploy
()
self
.
sim
.
deploy
()
def
setValgrind
(
self
,
value
):
self
.
valgrind
=
value
def
deploy
(
self
,
index
):
def
deploy
(
self
,
index
):
self
.
check
(
index
)
self
.
check
(
index
)
self
.
dnodes
[
index
-
1
].
setValgrind
(
self
.
valgrind
)
self
.
dnodes
[
index
-
1
].
deploy
()
self
.
dnodes
[
index
-
1
].
deploy
()
def
cfg
(
self
,
index
,
option
,
value
):
def
cfg
(
self
,
index
,
option
,
value
):
...
@@ -312,11 +333,14 @@ class TDDnodes:
...
@@ -312,11 +333,14 @@ class TDDnodes:
for
i
in
range
(
len
(
self
.
dnodes
)):
for
i
in
range
(
len
(
self
.
dnodes
)):
self
.
dnodes
[
i
].
stop
()
self
.
dnodes
[
i
].
stop
()
cmd
=
"sudo systemctl stop taosd"
psCmd
=
"ps -ef | grep -w taosd | grep 'root' | grep -v grep | awk '{print $2}'"
os
.
system
(
cmd
)
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
)
if
processID
:
cmd
=
"sudo systemctl stop taosd"
os
.
system
(
cmd
)
# if os.system(cmd) != 0 :
# if os.system(cmd) != 0 :
# tdLog.exit(cmd)
# tdLog.exit(cmd)
cmd
=
"ps -ef | grep -w taosd | grep 'dnode' | grep -v grep | awk '{print $2}' &&
sudo
pkill -sigkill taosd"
cmd
=
"ps -ef | grep -w taosd | grep 'dnode' | grep -v grep | awk '{print $2}' && pkill -sigkill taosd"
os
.
system
(
cmd
)
os
.
system
(
cmd
)
# if os.system(cmd) != 0 :
# if os.system(cmd) != 0 :
# tdLog.exit(cmd)
# tdLog.exit(cmd)
...
...
tests/pytest/util/log.py
浏览文件 @
112ee168
...
@@ -42,7 +42,7 @@ class TDLog:
...
@@ -42,7 +42,7 @@ class TDLog:
printf
(
"
\033
[1;31m%s %s
\033
[0m"
%
(
datetime
.
datetime
.
now
(),
err
))
printf
(
"
\033
[1;31m%s %s
\033
[0m"
%
(
datetime
.
datetime
.
now
(),
err
))
sys
.
exit
(
1
)
sys
.
exit
(
1
)
def
print
f
NoPrefix
(
self
,
info
):
def
printNoPrefix
(
self
,
info
):
printf
(
"
\033
[1;36m%s
\033
[0m"
%
(
info
))
printf
(
"
\033
[1;36m%s
\033
[0m"
%
(
info
))
...
...
tests/test-all.sh
浏览文件 @
112ee168
...
@@ -8,32 +8,33 @@ GREEN_UNDERLINE='\033[4;32m'
...
@@ -8,32 +8,33 @@ GREEN_UNDERLINE='\033[4;32m'
NC
=
'\033[0m'
NC
=
'\033[0m'
cd
script
cd
script
sudo
./test.sh 2>&1 |
grep
'success\|failed
'
|
tee
out.txt
./test.sh
-f
basicSuite.sim 2>&1 |
grep
'success\|failed\|fault
'
|
tee
out.txt
total_success
=
`
grep
success out.txt |
wc
-l
`
totalSuccess
=
`
grep
success out.txt |
wc
-l
`
totalBasic
=
`
grep
success out.txt |
grep
Suite |
wc
-l
`
if
[
"
$total
_s
uccess
"
-gt
"0"
]
;
then
if
[
"
$total
S
uccess
"
-gt
"0"
]
;
then
total
_success
=
`
expr
$total_success
- 1
`
total
Success
=
`
expr
$totalSuccess
-
$totalBasic
`
echo
-e
"
${
GREEN
}
### Total
$total
_s
uccess
TSIM case(s) succeed! ###
${
NC
}
"
echo
-e
"
${
GREEN
}
### Total
$total
S
uccess
TSIM case(s) succeed! ###
${
NC
}
"
fi
fi
total
_failed
=
`
grep
failed
out.txt |
wc
-l
`
total
Failed
=
`
grep
'failed\|fault'
out.txt |
wc
-l
`
if
[
"
$total
_f
ailed
"
-ne
"0"
]
;
then
if
[
"
$total
F
ailed
"
-ne
"0"
]
;
then
echo
-e
"
${
RED
}
### Total
$total
_f
ailed
TSIM case(s) failed! ###
${
NC
}
"
echo
-e
"
${
RED
}
### Total
$total
F
ailed
TSIM case(s) failed! ###
${
NC
}
"
exit
$total
_f
ailed
exit
$total
F
ailed
fi
fi
cd
../pytest
cd
../pytest
sudo
./simpletest.sh 2>&1 |
grep
'successfully executed\|failed'
|
tee
pytest-out.txt
./simpletest.sh 2>&1 |
grep
'successfully executed\|failed'
|
tee
pytest-out.txt
total
_py_s
uccess
=
`
grep
'successfully executed'
pytest-out.txt |
wc
-l
`
total
PyS
uccess
=
`
grep
'successfully executed'
pytest-out.txt |
wc
-l
`
if
[
"
$total
_py_s
uccess
"
-gt
"0"
]
;
then
if
[
"
$total
PyS
uccess
"
-gt
"0"
]
;
then
echo
-e
"
${
GREEN
}
### Total
$total
_py_s
uccess
python case(s) succeed! ###
${
NC
}
"
echo
-e
"
${
GREEN
}
### Total
$total
PyS
uccess
python case(s) succeed! ###
${
NC
}
"
fi
fi
total
_py_f
ailed
=
`
grep
'failed'
pytest-out.txt |
wc
-l
`
total
PyF
ailed
=
`
grep
'failed'
pytest-out.txt |
wc
-l
`
if
[
"
$total
_py_f
ailed
"
-ne
"0"
]
;
then
if
[
"
$total
PyF
ailed
"
-ne
"0"
]
;
then
echo
-e
"
${
RED
}
### Total
$total
_py_f
ailed
python case(s) failed! ###
${
NC
}
"
echo
-e
"
${
RED
}
### Total
$total
PyF
ailed
python case(s) failed! ###
${
NC
}
"
exit
$total
_py_f
ailed
exit
$total
PyF
ailed
fi
fi
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录