• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

taosdata / TDengine / #3720

26 Mar 2025 06:20AM UTC coverage: 30.242% (-31.7%) from 61.936%
#3720

push

travis-ci

web-flow
feat(taosBenchmark): supports decimal data type (#30456)

* feat: taosBenchmark supports decimal data type

* build: decimal script not use pytest.sh

* fix: fix typo for decimal script

* test: insertBasic.py debug

71234 of 313946 branches covered (22.69%)

Branch coverage included in aggregate %.

38 of 423 new or added lines in 8 files covered. (8.98%)

120240 existing lines in 447 files now uncovered.

118188 of 312400 relevant lines covered (37.83%)

1450220.33 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

19.1
/tools/shell/src/shellUtil.c
1
/*
2
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
3
 *
4
 * This program is free software: you can use, redistribute, and/or modify
5
 * it under the terms of the GNU Affero General Public License, version 3
6
 * or later ("AGPL"), as published by the Free Software Foundation.
7
 *
8
 * This program is distributed in the hope that it will be useful, but WITHOUT
9
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
 * FITNESS FOR A PARTICULAR PURPOSE.
11
 *
12
 * You should have received a copy of the GNU Affero General Public License
13
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14
 */
15

16
#define _BSD_SOURCE
17
#define _GNU_SOURCE
18
#define _XOPEN_SOURCE
19
#define _DEFAULT_SOURCE
20

21
#include "shellInt.h"
22

23
bool shellRegexMatch(const char *s, const char *reg, int32_t cflags) {
208✔
24
  regex_t regex = {0};
208✔
25
  char    msgbuf[100] = {0};
208✔
26

27
  /* Compile regular expression */
28
  if (regcomp(&regex, reg, cflags) != 0) {
208!
29
    fprintf(stderr, "Fail to compile regex");
×
30
    shellExit();
×
31
  }
32

33
  /* Execute regular expression */
34
  int32_t reti = regexec(&regex, s, 0, NULL, 0);
208✔
35
  if (!reti) {
208✔
36
    regfree(&regex);
8✔
37
    return true;
8✔
38
  } else if (reti == REG_NOMATCH) {
200!
39
    regfree(&regex);
200✔
40
    return false;
200✔
41
  } else {
42
    regerror(reti, &regex, msgbuf, sizeof(msgbuf));
×
43
    fprintf(stderr, "Regex match failed: %s\r\n", msgbuf);
×
44
    regfree(&regex);
×
45
    shellExit();
×
46
  }
47

48
  return false;
×
49
}
50

51
int32_t shellCheckIntSize() {
25✔
52
  if (sizeof(int8_t) != 1) {
53
    printf("int8 size is %d(!= 1)\r\n", (int)sizeof(int8_t));
54
    return -1;
55
  }
56
  if (sizeof(int16_t) != 2) {
57
    printf("int16 size is %d(!= 2)\r\n", (int)sizeof(int16_t));
58
    return -1;
59
  }
60
  if (sizeof(int32_t) != 4) {
61
    printf("int32 size is %d(!= 4)\r\n", (int)sizeof(int32_t));
62
    return -1;
63
  }
64
  if (sizeof(int64_t) != 8) {
65
    printf("int64 size is %d(!= 8)\r\n", (int)sizeof(int64_t));
66
    return -1;
67
  }
68
  return 0;
25✔
69
}
70

71
void shellPrintVersion() { printf("%s\r\n", shell.info.programVersion); }
×
72

UNCOV
73
void shellGenerateAuth() {
×
UNCOV
74
  char secretEncrypt[TSDB_PASSWORD_LEN + 1] = {0};
×
UNCOV
75
  taosEncryptPass_c((uint8_t *)shell.args.password, strlen(shell.args.password), secretEncrypt);
×
UNCOV
76
  printf("%s\r\n", secretEncrypt);
×
UNCOV
77
  fflush(stdout);
×
UNCOV
78
}
×
79

UNCOV
80
void shellDumpConfig() {
×
UNCOV
81
  (void)osDefaultInit();
×
82

UNCOV
83
  if (taosInitCfg(configDirShell, NULL, NULL, NULL, NULL, 1) != 0) {
×
84
    fprintf(stderr, "failed to load cfg since %s [0x%08X]\n", terrstr(), terrno);
×
85
    return;
×
86
  }
87

UNCOV
88
  cfgDumpCfg(taosGetCfg(), 1, true);
×
89

UNCOV
90
  fflush(stdout);
×
91
}
92

UNCOV
93
void shellCheckServerStatus() {
×
94
  TSDB_SERVER_STATUS code;
95

96
  do {
×
UNCOV
97
    char details[1024] = {0};
×
UNCOV
98
    code = taos_check_server_status(shell.args.host, shell.args.port, details, 1024);
×
UNCOV
99
    switch (code) {
×
UNCOV
100
      case TSDB_SRV_STATUS_UNAVAILABLE:
×
UNCOV
101
        printf("0: unavailable\r\n");
×
UNCOV
102
        break;
×
103
      case TSDB_SRV_STATUS_NETWORK_OK:
×
104
        printf("1: network ok\r\n");
×
105
        break;
×
UNCOV
106
      case TSDB_SRV_STATUS_SERVICE_OK:
×
UNCOV
107
        printf("2: service ok\r\n");
×
UNCOV
108
        break;
×
109
      case TSDB_SRV_STATUS_SERVICE_DEGRADED:
×
110
        printf("3: service degraded\r\n");
×
111
        break;
×
112
      case TSDB_SRV_STATUS_EXTING:
×
113
        printf("4: exiting\r\n");
×
114
        break;
×
115
    }
UNCOV
116
    if (strlen(details) != 0) {
×
117
      printf("%s\r\n\r\n", details);
×
118
    }
UNCOV
119
    fflush(stdout);
×
UNCOV
120
    if (code == TSDB_SRV_STATUS_NETWORK_OK && shell.args.is_startup) {
×
121
      taosMsleep(1000);
×
122
    } else {
123
      break;
124
    }
125
  } while (1);
UNCOV
126
}
×
127

UNCOV
128
void shellExit() {
×
UNCOV
129
  if (shell.conn != NULL) {
×
UNCOV
130
    taos_close(shell.conn);
×
UNCOV
131
    shell.conn = NULL;
×
132
  }
UNCOV
133
  shell.exit = true;
×
UNCOV
134
  taos_cleanup();
×
UNCOV
135
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc