提交 d147cf29 编写于 作者: Z zhaoyanggh

fix return

上级 2549b72b
......@@ -183,11 +183,12 @@ extern char configDir[];
fprintf(stderr, "PERF: " fmt, __VA_ARGS__); \
} while (0)
#define errorPrint(fmt, ...) \
do { \
fprintf(stderr, " \033[31m"); \
fprintf(stderr, "ERROR: " fmt, __VA_ARGS__); \
fprintf(stderr, " \033[0m"); \
#define errorPrint(fmt, ...) \
do { \
fprintf(stderr, "\033[31m"); \
fprintf(stderr, "%s(%d) ", __FILE__, __LINE__); \
fprintf(stderr, "ERROR: " fmt, __VA_ARGS__); \
fprintf(stderr, "\033[0m"); \
} while (0)
enum TEST_MODE {
......
......@@ -5534,26 +5534,17 @@ int insertTestProcess() {
// create database and super tables
char *cmdBuffer = calloc(1, BUFFER_SIZE);
assert(cmdBuffer);
code = createDatabasesAndStables(cmdBuffer);
if (code) {
errorPrint("%s() LN%d, createDatabasesAndStables() failed\n", __func__,
__LINE__);
if (createDatabasesAndStables(cmdBuffer)) {
goto end_insert_process;
}
// pretreatment
code = prepareSampleData();
if (code) {
errorPrint("%s() LN%d, prepareSampleData() failed\n", __func__,
__LINE__);
if (prepareSampleData()) {
goto end_insert_process;
}
if (g_args.iface != SML_IFACE && g_totalChildTables > 0) {
code = createChildTables();
if (code) {
errorPrint("%s() LN%d, createChildTables() failed\n", __func__,
__LINE__);
if (createChildTables()) {
goto end_insert_process;
}
}
......@@ -5566,14 +5557,9 @@ int insertTestProcess() {
SSuperTable *stbInfo = &g_Dbs.db[i].superTbls[j];
if (stbInfo && (stbInfo->insertRows > 0)) {
code = startMultiThreadInsertData(
g_Dbs.threadCount, g_Dbs.db[i].dbName,
g_Dbs.db[i].dbCfg.precision, stbInfo);
if (code) {
errorPrint(
"%s() LN%d, startMultiThreadInsertData failed "
"for db %d stb %" PRIu64 "\n",
__func__, __LINE__, i, j);
if (startMultiThreadInsertData(
g_Dbs.threadCount, g_Dbs.db[i].dbName,
g_Dbs.db[i].dbCfg.precision, stbInfo)) {
goto end_insert_process;
}
}
......@@ -5585,12 +5571,9 @@ int insertTestProcess() {
errorPrint("%s\n", "Schemaless insertion must include stable");
goto end_insert_process;
} else {
code = startMultiThreadInsertData(
g_Dbs.threadCount, g_Dbs.db[i].dbName,
g_Dbs.db[i].dbCfg.precision, NULL);
if (code) {
errorPrint("%s() LN%d, startMultiThreadInsertData failed\n",
__func__, __LINE__);
if (startMultiThreadInsertData(
g_Dbs.threadCount, g_Dbs.db[i].dbName,
g_Dbs.db[i].dbCfg.precision, NULL)) {
goto end_insert_process;
}
}
......@@ -5598,8 +5581,5 @@ int insertTestProcess() {
}
end_insert_process:
tmfree(cmdBuffer);
if (g_fpOfInsertResult) {
fclose(g_fpOfInsertResult);
}
return code;
}
\ No newline at end of file
......@@ -674,7 +674,7 @@ int getMetaFromInsertJsonFile(cJSON *root) {
} else if (!quorum) {
g_Dbs.db[i].dbCfg.quorum = 1;
} else {
printf("failed to read json, quorum input mistake");
errorPrint("%s", "failed to read json, quorum input mistake");
goto PARSE_OVER;
}
......@@ -1144,9 +1144,8 @@ int getMetaFromInsertJsonFile(cJSON *root) {
goto PARSE_OVER;
}
int retVal = getColumnAndTagTypeFromInsertJsonFile(
stbInfo, &g_Dbs.db[i].superTbls[j]);
if (false == retVal) {
if (getColumnAndTagTypeFromInsertJsonFile(
stbInfo, &g_Dbs.db[i].superTbls[j])) {
goto PARSE_OVER;
}
}
......@@ -1705,21 +1704,10 @@ int getInfoFromJsonFile(char *file) {
memset(&g_Dbs, 0, sizeof(SDbs));
g_Dbs.use_metric = g_args.use_metric;
code = getMetaFromInsertJsonFile(root);
if (code) {
errorPrint("%s() LN%d, getMetaFromInsertJsonFile() failed\n",
__func__, __LINE__);
goto PARSE_OVER;
}
} else if ((QUERY_TEST == g_args.test_mode) ||
(SUBSCRIBE_TEST == g_args.test_mode)) {
memset(&g_queryInfo, 0, sizeof(SQueryMetaInfo));
code = getMetaFromQueryJsonFile(root);
if (code) {
errorPrint("%s() LN%d, getMetaFromQueryJsonFile() failed\n",
__func__, __LINE__);
goto PARSE_OVER;
}
} else {
errorPrint("%s",
"input json file type error! please input correct file "
......
......@@ -66,26 +66,17 @@ SArguments g_args = {
};
int main(int argc, char *argv[]) {
int32_t code = parse_args(argc, argv, &g_args);
if (code) {
errorPrint("%s() LN%d, parse_args() failed\n", __func__, __LINE__);
if (parse_args(argc, argv, &g_args)) {
exit(EXIT_FAILURE);
}
debugPrint("meta file: %s\n", g_args.metaFile);
if (g_args.metaFile) {
g_totalChildTables = 0;
code = getInfoFromJsonFile(g_args.metaFile);
if (code) {
errorPrint("%s() LN%d, getInfoFromJsonFile(%s) failed\n", __func__,
__LINE__, g_args.metaFile);
if (getInfoFromJsonFile(g_args.metaFile)) {
exit(EXIT_FAILURE);
}
code = testMetaFile();
if (code) {
errorPrint("%s() LN%d, testMetaFile() failed\n", __func__,
__LINE__);
if (testMetaFile()) {
exit(EXIT_FAILURE);
}
} else {
......@@ -101,7 +92,6 @@ int main(int argc, char *argv[]) {
g_Dbs.db[0].dbName, g_Dbs.port);
querySqlFile(qtaos, g_args.sqlFile);
taos_close(qtaos);
} else {
testCmdLine();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册