| 179 | } |
| 180 | |
| 181 | int main(int argc, char* argv[]) |
| 182 | { |
| 183 | int ch, n = 1, conn_timeout = 10, rw_timeout = 10, dbnum = 0; |
| 184 | acl::string addr("127.0.0.1:6379"), command, passwd; |
| 185 | |
| 186 | while ((ch = getopt(argc, argv, "hs:n:C:T:a:p:d:H:")) > 0) |
| 187 | { |
| 188 | switch (ch) |
| 189 | { |
| 190 | case 'h': |
| 191 | usage(argv[0]); |
| 192 | return 0; |
| 193 | case 'H': |
| 194 | hash_slot(optarg); |
| 195 | return 0; |
| 196 | case 's': |
| 197 | addr = optarg; |
| 198 | break; |
| 199 | case 'n': |
| 200 | n = atoi(optarg); |
| 201 | break; |
| 202 | case 'C': |
| 203 | conn_timeout = atoi(optarg); |
| 204 | break; |
| 205 | case 'T': |
| 206 | rw_timeout = atoi(optarg); |
| 207 | break; |
| 208 | case 'a': |
| 209 | command = optarg; |
| 210 | break; |
| 211 | case 'p': |
| 212 | passwd = optarg; |
| 213 | break; |
| 214 | case 'd': |
| 215 | dbnum = atoi(optarg); |
| 216 | break; |
| 217 | default: |
| 218 | break; |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | acl::acl_cpp_init(); |
| 223 | acl::log::stdout_open(true); |
| 224 | |
| 225 | acl::redis_client client(addr.c_str(), conn_timeout, rw_timeout); |
| 226 | client.set_password(passwd); |
| 227 | if (dbnum > 0) |
| 228 | client.set_db(dbnum); |
| 229 | |
| 230 | acl::redis cmd(&client); |
| 231 | |
| 232 | bool ret; |
| 233 | |
| 234 | if (command == "set") |
| 235 | ret = test_set(cmd, n); |
| 236 | else if (command == "get") |
| 237 | ret = test_get(cmd, n); |
| 238 | else if (command == "del") |
nothing calls this directly
no test coverage detected
searching dependent graphs…