Skip to content

Commit ae67100

Browse files
authored
Fix version bug when packaging (vesoft-inc#893)
* Fix version bug when packaging * Fix test cases which maybe fail
1 parent 8a1f078 commit ae67100

File tree

4 files changed

+69
-33
lines changed

4 files changed

+69
-33
lines changed

package/package.sh

+49-21
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ package_one=ON
1919
strip_enable="FALSE"
2020
usage="Usage: ${0} -v <version> -n <ON/OFF> -s <TRUE/FALSE> -b <BRANCH> -g <ON/OFF>"
2121
project_dir="$(cd "$(dirname "$0")" && pwd)/.."
22-
build_dir=${project_dir}/build
22+
modules_dir=${project_dir}/modules
23+
storage_dir=${modules_dir}/storage
2324
enablesanitizer="OFF"
2425
static_sanitizer="OFF"
2526
build_type="Release"
2627
branch="master"
28+
jobs=$(nproc)
2729

2830
while getopts v:n:s:b:d:t:g: opt;
2931
do
@@ -79,24 +81,35 @@ fi
7981

8082
echo "current version is [ $version ], strip enable is [$strip_enable], enablesanitizer is [$enablesanitizer], static_sanitizer is [$static_sanitizer]"
8183

82-
# args: <version>
83-
function build {
84-
version=$1
85-
san=$2
86-
ssan=$3
87-
build_type=$4
88-
branch=$5
89-
modules_dir=${project_dir}/modules
90-
if [[ -d $build_dir ]]; then
91-
rm -rf ${build_dir}/*
92-
else
93-
mkdir ${build_dir}
84+
function _build_storage {
85+
if [ ! -d ${storage_dir} ]; then
86+
git clone --single-branch --branch ${branch} https://github.com/vesoft-inc/nebula-storage.git ${storage_dir}
9487
fi
9588

96-
mkdir -p ${build_dir}
89+
rm -rf ${storage_dir}/build && mkdir -p ${storage_dir}/build
90+
cmake -DCMAKE_BUILD_TYPE=${build_type} \
91+
-DNEBULA_BUILD_VERSION=${version} \
92+
-DENABLE_ASAN=${san} \
93+
-DENABLE_UBSAN=${san} \
94+
-DENABLE_STATIC_ASAN=${ssan} \
95+
-DENABLE_STATIC_UBSAN=${ssan} \
96+
-DCMAKE_INSTALL_PREFIX=/usr/local/nebula \
97+
-DNEBULA_COMMON_REPO_TAG=${branch} \
98+
-DENABLE_TESTING=OFF \
99+
-DENABLE_PACK_ONE=${package_one} \
100+
-S ${storage_dir} \
101+
-B ${storage_dir}/build
97102

98-
pushd ${build_dir}
103+
if !( cmake --build ${storage_dir}/build -j ${jobs} ); then
104+
echo ">>> build nebula storage failed <<<"
105+
exit -1
106+
fi
107+
echo ">>> build nebula storage successfully <<<"
108+
}
99109

110+
function _build_graph {
111+
build_dir=${project_dir}/build
112+
rm -rf ${build_dir} && mkdir -p ${build_dir}
100113
cmake -DCMAKE_BUILD_TYPE=${build_type} \
101114
-DNEBULA_BUILD_VERSION=${version} \
102115
-DENABLE_ASAN=${san} \
@@ -105,18 +118,31 @@ function build {
105118
-DENABLE_STATIC_UBSAN=${ssan} \
106119
-DCMAKE_INSTALL_PREFIX=/usr/local/nebula \
107120
-DNEBULA_COMMON_REPO_TAG=${branch} \
108-
-DNEBULA_STORAGE_REPO_TAG=${branch} \
109121
-DENABLE_TESTING=OFF \
110-
-DENABLE_BUILD_STORAGE=${build_storage} \
122+
-DENABLE_BUILD_STORAGE=OFF \
111123
-DENABLE_PACK_ONE=${package_one} \
112-
$project_dir
124+
-S ${project_dir} \
125+
-B ${build_dir}
113126

114-
if !( make -j$(nproc) ); then
115-
echo ">>> build nebula failed <<<"
127+
if !( cmake --build ${build_dir} -j ${jobs} ); then
128+
echo ">>> build nebula graph failed <<<"
116129
exit -1
117130
fi
131+
echo ">>> build nebula graph successfully <<<"
132+
}
118133

119-
popd
134+
# args: <version>
135+
function build {
136+
version=$1
137+
san=$2
138+
ssan=$3
139+
build_type=$4
140+
branch=$5
141+
142+
if [[ "$build_storage" == "ON" ]]; then
143+
_build_storage
144+
fi
145+
_build_graph
120146
}
121147

122148
# args: <strip_enable>
@@ -134,6 +160,8 @@ function package {
134160
-DENABLE_PACK_ONE=${package_one} \
135161
-DCMAKE_INSTALL_PREFIX=/usr/local/nebula \
136162
-DENABLE_PACKAGE_STORAGE=${build_storage} \
163+
-DNEBULA_STORAGE_SOURCE_DIR=${storage_dir} \
164+
-DNEBULA_STORAGE_BINARY_DIR=${storage_dir}/build \
137165
${project_dir}/package/
138166

139167
strip_enable=$1

src/executor/query/GetVerticesExecutor.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,8 @@ folly::Future<Status> GetVerticesExecutor::getVertices() {
6161
}
6262

6363
DataSet GetVerticesExecutor::buildRequestDataSet(const GetVertices* gv) {
64-
nebula::DataSet vertices({kVid});
6564
if (gv == nullptr) {
66-
return vertices;
65+
return nebula::DataSet({kVid});
6766
}
6867
// Accept Table such as | $a | $b | $c |... as input which one column indicate src
6968
auto valueIter = ectx_->getResult(gv->inputVar()).iter();

tests/README.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ We also provide a parameter named `address` to allow these tests to connect to t
6161
$ pytest --address="192.168.0.1:9669" -m 'not skip' .
6262
```
6363

64+
You can use following commands to only rerun the test cases if they failed:
65+
66+
```shell
67+
$ pytest --last-failed --gherkin-terminal-reporter --gherkin-terminal-reporter-expanded .
68+
```
69+
70+
`gherkin-terminal-reporter` options will print the pytest report prettily.
71+
72+
6473
### Stop nebula servers
6574

6675
Following command will stop the nebula servers started in above steps:
@@ -83,7 +92,7 @@ $ make clean
8392

8493
## How to add test case
8594

86-
You can find all nebula test cases in [these feature files](tck/features) and some openCypher cases in [other files](tck/openCypher/features). Some references about [TCK](https://github.com/opencypher/openCypher/tree/master/tck) may be what you need.
95+
You can find all nebula test cases in [tck/features](tck/features) and some openCypher cases in [tck/openCypher/features](tck/openCypher/features). Some references about [TCK](https://github.com/opencypher/openCypher/tree/master/tck) may be what you need.
8796

8897
The test cases are organized in feature files and described in gherkin language. The structure of feature file is like following example:
8998

tests/tck/features/mutate/InsertWithTimeType.feature

+9-9
Original file line numberDiff line numberDiff line change
@@ -25,36 +25,36 @@ Feature: Insert with time-dependent types
2525
INSERT VERTEX TAG_TIMESTAMP(a) VALUES "TEST_VERTEX":("2000.0.0 10:0:0")
2626
"""
2727
Then a ExecutionError should be raised at runtime:Storage Error: The data type does not meet the requirements. Use the correct type of data.
28+
When try to execute query:
29+
"""
30+
INSERT VERTEX TAG_TIME(a) VALUES "TEST_VERTEX":(NULL)
31+
"""
32+
Then the execution should be successful
2833
When executing query:
2934
"""
3035
INSERT VERTEX TAG_TIME(a) VALUES "TEST_VERTEX":("10:0:0")
3136
"""
3237
Then a ExecutionError should be raised at runtime:Storage Error: The data type does not meet the requirements. Use the correct type of data.
33-
When executing query:
38+
When try to execute query:
3439
"""
35-
INSERT VERTEX TAG_TIME(a) VALUES "TEST_VERTEX":(NULL)
40+
INSERT VERTEX TAG_DATE(a) VALUES "TEST_VERTEX":(NULL)
3641
"""
3742
Then the execution should be successful
3843
When executing query:
3944
"""
4045
INSERT VERTEX TAG_DATE(a) VALUES "TEST_VERTEX":("2000.0.0")
4146
"""
4247
Then a ExecutionError should be raised at runtime:Storage Error: The data type does not meet the requirements. Use the correct type of data.
43-
When executing query:
48+
When try to execute query:
4449
"""
45-
INSERT VERTEX TAG_DATE(a) VALUES "TEST_VERTEX":(NULL)
50+
INSERT VERTEX TAG_DATETIME(a) VALUES "TEST_VERTEX":(NULL)
4651
"""
4752
Then the execution should be successful
4853
When executing query:
4954
"""
5055
INSERT VERTEX TAG_DATETIME(a) VALUES "TEST_VERTEX":("2000.0.0")
5156
"""
5257
Then a ExecutionError should be raised at runtime:Storage Error: The data type does not meet the requirements. Use the correct type of data.
53-
When executing query:
54-
"""
55-
INSERT VERTEX TAG_DATETIME(a) VALUES "TEST_VERTEX":(NULL)
56-
"""
57-
Then the execution should be successful
5858
And drop the used space
5959

6060
Scenario: Basic CRUD for timestamp type

0 commit comments

Comments
 (0)