| 192 | } |
| 193 | |
| 194 | int main(int argc, char* argv[]) |
| 195 | { |
| 196 | int ch, n = 1, conn_timeout = 10, rw_timeout = 10, dbnum = 0; |
| 197 | int max_threads = 10; |
| 198 | acl::string addr("127.0.0.1:6379"), cmd, passwd; |
| 199 | |
| 200 | while ((ch = getopt(argc, argv, "hs:n:C:I:c:a:p:d:")) > 0) |
| 201 | { |
| 202 | switch (ch) |
| 203 | { |
| 204 | case 'h': |
| 205 | usage(argv[0]); |
| 206 | return 0; |
| 207 | case 's': |
| 208 | addr = optarg; |
| 209 | break; |
| 210 | case 'p': |
| 211 | passwd = optarg; |
| 212 | break; |
| 213 | case 'd': |
| 214 | dbnum = atoi(optarg); |
| 215 | break; |
| 216 | case 'n': |
| 217 | n = atoi(optarg); |
| 218 | break; |
| 219 | case 'C': |
| 220 | conn_timeout = atoi(optarg); |
| 221 | break; |
| 222 | case 'I': |
| 223 | rw_timeout = atoi(optarg); |
| 224 | break; |
| 225 | case 'c': |
| 226 | max_threads = atoi(optarg); |
| 227 | break; |
| 228 | case 'a': |
| 229 | cmd = optarg; |
| 230 | break; |
| 231 | default: |
| 232 | break; |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | acl::acl_cpp_init(); |
| 237 | |
| 238 | acl::redis_client_pool pool(addr.c_str(), max_threads); |
| 239 | pool.set_timeout(conn_timeout, rw_timeout); |
| 240 | if (!passwd.empty()) |
| 241 | pool.set_password(passwd); |
| 242 | if (dbnum > 0) |
| 243 | pool.set_db(dbnum); |
| 244 | |
| 245 | std::vector<test_thread*> threads; |
| 246 | for (int i = 0; i < max_threads; i++) |
| 247 | { |
| 248 | test_thread* thread = new test_thread(pool, cmd.c_str(), n); |
| 249 | threads.push_back(thread); |
| 250 | thread->set_detachable(false); |
| 251 | thread->start(); |
nothing calls this directly
no test coverage detected
searching dependent graphs…