ci: c language samples ci add environmental cleanup label
This commit is contained in:
parent
ab1935643c
commit
7f7534f0c5
|
@ -39,19 +39,8 @@ static int DemoCreateDB() {
|
|||
return -1;
|
||||
}
|
||||
|
||||
// drop database if exists
|
||||
TAOS_RES *result = taos_query(taos, "DROP DATABASE IF EXISTS power");
|
||||
code = taos_errno(result);
|
||||
if (code != 0) {
|
||||
fprintf(stderr, "Failed to drop database power, ErrCode: 0x%x, ErrMessage: %s.\n", code, taos_errstr(result));
|
||||
taos_close(taos);
|
||||
taos_cleanup();
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(result);
|
||||
|
||||
// create database
|
||||
result = taos_query(taos, "CREATE DATABASE IF NOT EXISTS power");
|
||||
TAOS_RES *result = taos_query(taos, "CREATE DATABASE IF NOT EXISTS power");
|
||||
code = taos_errno(result);
|
||||
if (code != 0) {
|
||||
fprintf(stderr, "Failed to create database power, ErrCode: 0x%x, ErrMessage: %s.\n", code, taos_errstr(result));
|
||||
|
|
|
@ -38,19 +38,8 @@ static int DemoSmlInsert() {
|
|||
return -1;
|
||||
}
|
||||
|
||||
// drop database if exists
|
||||
TAOS_RES *result = taos_query(taos, "DROP DATABASE IF EXISTS power");
|
||||
code = taos_errno(result);
|
||||
if (code != 0) {
|
||||
fprintf(stderr, "Failed to drop database power, ErrCode: 0x%x, ErrMessage: %s.\n", code, taos_errstr(result));
|
||||
taos_close(taos);
|
||||
taos_cleanup();
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(result);
|
||||
|
||||
// create database
|
||||
result = taos_query(taos, "CREATE DATABASE IF NOT EXISTS power");
|
||||
TAOS_RES *result = taos_query(taos, "CREATE DATABASE IF NOT EXISTS power");
|
||||
code = taos_errno(result);
|
||||
if (code != 0) {
|
||||
fprintf(stderr, "Failed to create database power, ErrCode: 0x%x, ErrMessage: %s.\n", code, taos_errstr(result));
|
||||
|
|
|
@ -25,16 +25,34 @@ declare -a TEST_EXES=(
|
|||
"docs_sml_insert_demo"
|
||||
)
|
||||
|
||||
declare -a NEED_CLEAN=(
|
||||
"true"
|
||||
"false"
|
||||
"false"
|
||||
"false"
|
||||
"false"
|
||||
"false"
|
||||
"false"
|
||||
"true"
|
||||
)
|
||||
|
||||
totalCases=0
|
||||
totalFailed=0
|
||||
totalSuccess=0
|
||||
|
||||
for TEST_EXE in "${TEST_EXES[@]}"; do
|
||||
for i in "${!TEST_EXES[@]}"; do
|
||||
TEST_EXE="${TEST_EXES[$i]}"
|
||||
NEED_CLEAN_FLAG="${NEED_CLEAN[$i]}"
|
||||
|
||||
if [ "$NEED_CLEAN_FLAG" = "true" ]; then
|
||||
echo "Cleaning database before executing $TEST_EXE..."
|
||||
taos -s "drop database if exists power" >> $LOG_FILE 2>&1
|
||||
fi
|
||||
|
||||
echo "Executing $TEST_EXE..."
|
||||
$TEST_PATH/$TEST_EXE >> $LOG_FILE 2>&1
|
||||
|
||||
RESULT=$?
|
||||
|
||||
|
||||
if [ "$RESULT" -eq 0 ]; then
|
||||
totalSuccess=$((totalSuccess + 1))
|
||||
echo "[$GREEN OK $NC] $TEST_EXE executed successfully."
|
||||
|
|
Loading…
Reference in New Issue