• 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

0.0
/tools/shell/src/shellNettest.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 _GNU_SOURCE
17
#include "shellInt.h"
18

UNCOV
19
static void shellWorkAsClient() {
×
UNCOV
20
  SShellArgs *pArgs = &shell.args;
×
UNCOV
21
  SRpcInit    rpcInit = {0};
×
UNCOV
22
  SEpSet      epSet = {.inUse = 0, .numOfEps = 1};
×
UNCOV
23
  SRpcMsg     rpcRsp = {0};
×
UNCOV
24
  void       *clientRpc = NULL;
×
UNCOV
25
  char        pass[TSDB_PASSWORD_LEN + 1] = {0};
×
26

27
  taosEncryptPass_c((uint8_t *)("_pwd"), strlen("_pwd"), pass);
UNCOV
28
  rpcInit.label = "CHK";
×
UNCOV
29
  rpcInit.numOfThreads = 1;
×
UNCOV
30
  rpcInit.sessions = 16;
×
UNCOV
31
  rpcInit.connType = TAOS_CONN_CLIENT;
×
UNCOV
32
  rpcInit.idleTime = 3000;
×
UNCOV
33
  rpcInit.user = "_dnd";
×
UNCOV
34
  rpcInit.timeToGetConn = 500000;
×
35

UNCOV
36
  taosVersionStrToInt(td_version, &rpcInit.compatibilityVer);
×
UNCOV
37
  clientRpc = rpcOpen(&rpcInit);
×
UNCOV
38
  if (clientRpc == NULL) {
×
39
    printf("failed to init net test client since %s\r\n", terrstr());
×
40
    goto _OVER;
×
41
  }
42

UNCOV
43
  if (pArgs->port == 0) {
×
UNCOV
44
    pArgs->port = 6030;
×
45
  }
UNCOV
46
  if (pArgs->host == NULL) {
×
UNCOV
47
    pArgs->host = "localhost";
×
48
  }
UNCOV
49
  char fqdn[TSDB_FQDN_LEN] = {0};
×
UNCOV
50
  tstrncpy(fqdn, pArgs->host, TSDB_FQDN_LEN);
×
UNCOV
51
  strtok(fqdn, ":");
×
52

UNCOV
53
  printf("network test client is initialized, the server is %s:%u\r\n", fqdn, pArgs->port);
×
54

UNCOV
55
  tstrncpy(epSet.eps[0].fqdn, fqdn, TSDB_FQDN_LEN);
×
UNCOV
56
  epSet.eps[0].port = (uint16_t)pArgs->port;
×
57

UNCOV
58
  int32_t  totalSucc = 0;
×
UNCOV
59
  uint64_t startTime = taosGetTimestampUs();
×
60

UNCOV
61
  for (int32_t i = 0; i < pArgs->pktNum; ++i) {
×
UNCOV
62
    SRpcMsg rpcMsg = {.info.ahandle = (void *)0x9525, .info.notFreeAhandle = 1, .msgType = TDMT_DND_NET_TEST};
×
UNCOV
63
    rpcMsg.pCont = rpcMallocCont(pArgs->pktLen);
×
UNCOV
64
    rpcMsg.contLen = pArgs->pktLen;
×
65

UNCOV
66
    printf("request is sent, size:%d\r\n", rpcMsg.contLen);
×
UNCOV
67
    rpcSendRecv(clientRpc, &epSet, &rpcMsg, &rpcRsp);
×
UNCOV
68
    if (rpcRsp.code == 0 && rpcRsp.contLen == rpcMsg.contLen) {
×
UNCOV
69
      printf("response is received, size:%d\r\n", rpcMsg.contLen);
×
UNCOV
70
      if (rpcRsp.code == 0) totalSucc++;
×
71
    } else {
72
      printf("response not received since %s\r\n", tstrerror(rpcRsp.code));
×
73
    }
74

UNCOV
75
    rpcFreeCont(rpcRsp.pCont);
×
UNCOV
76
    rpcRsp.pCont = NULL;
×
77
  }
78

UNCOV
79
  uint64_t endTime = taosGetTimestampUs();
×
UNCOV
80
  uint64_t elT = endTime - startTime;
×
81

UNCOV
82
  printf("\r\ntotal succ:%5d/%d\tcost:%8.2lf ms\tspeed:%8.2lf MB/s\r\n", totalSucc, pArgs->pktNum, elT / 1000.0,
×
UNCOV
83
         pArgs->pktLen / (elT / 1000000.0) / 1024.0 / 1024.0 * totalSucc);
×
84

UNCOV
85
_OVER:
×
UNCOV
86
  if (clientRpc != NULL) {
×
UNCOV
87
    rpcClose(clientRpc);
×
88
  }
UNCOV
89
  if (rpcRsp.pCont != NULL) {
×
90
    rpcFreeCont(rpcRsp.pCont);
×
91
  }
UNCOV
92
}
×
93

94
static void shellProcessMsg(void *p, SRpcMsg *pRpc, SEpSet *pEpSet) {
×
95
  printf("request is received, size:%d\r\n", pRpc->contLen);
×
96
  fflush(stdout);
×
97
  SRpcMsg rsp = {.info = pRpc->info, .code = 0};
×
98
  rsp.pCont = rpcMallocCont(pRpc->contLen);
×
99
  if (rsp.pCont == NULL) {
×
100
    rsp.code = TSDB_CODE_OUT_OF_MEMORY;
×
101
  } else {
102
    rsp.contLen = pRpc->contLen;
×
103
  }
104
  rpcSendResponse(&rsp);
×
105
}
×
106

107
void shellNettestHandler(int32_t signum, void *sigInfo, void *context) { shellExit(); }
×
108

109
static void shellWorkAsServer() {
×
110
  SShellArgs *pArgs = &shell.args;
×
111

112
  if (pArgs->port == 0) {
×
113
    pArgs->port = 6030;
×
114
  }
115
  if (pArgs->host == NULL) {
×
116
    pArgs->host = "127.0.0.1";
×
117
  }
118

119
  SRpcInit rpcInit = {0};
×
120
  memcpy(rpcInit.localFqdn, pArgs->host, strlen(pArgs->host));
×
121
  rpcInit.localPort = pArgs->port;
×
122
  rpcInit.label = "CHK";
×
123
  rpcInit.numOfThreads = 2;
×
124
  rpcInit.cfp = (RpcCfp)shellProcessMsg;
×
125
  rpcInit.sessions = 10;
×
126
  rpcInit.connType = TAOS_CONN_SERVER;
×
127
  rpcInit.idleTime = 3000;
×
128

129
  taosVersionStrToInt(td_version, &rpcInit.compatibilityVer);
×
130

131
  void *serverRpc = rpcOpen(&rpcInit);
×
132
  if (serverRpc == NULL) {
×
133
    printf("failed to init net test server since %s\r\n", terrstr());
×
134
  } else {
135
    printf("network test server is initialized, %s:%u\r\n", pArgs->host, pArgs->port);
×
136
    taosSetSignal(SIGTERM, shellNettestHandler);
×
137
    while (1) taosMsleep(10);
×
138
  }
139
}
×
140

UNCOV
141
void shellTestNetWork() {
×
UNCOV
142
  (void)osDefaultInit();
×
UNCOV
143
  (void)rpcInit();
×
144

UNCOV
145
  if (strcmp(shell.args.netrole, "client") == 0) {
×
UNCOV
146
    shellWorkAsClient();
×
147
  }
148

UNCOV
149
  if (strcmp(shell.args.netrole, "server") == 0) {
×
150
    shellWorkAsServer();
×
151
  }
UNCOV
152
}
×
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