| 214 | } |
| 215 | |
| 216 | int main(int argc, char* argv[]) { |
| 217 | // Parse gflags. We recommend you to use gflags as well. |
| 218 | GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); |
| 219 | Expose(); |
| 220 | |
| 221 | brpc::Channel channel; |
| 222 | brpc::ChannelOptions options; |
| 223 | options.protocol = FLAGS_protocol; |
| 224 | options.connection_type = FLAGS_connection_type; |
| 225 | options.timeout_ms = FLAGS_timeout_ms; |
| 226 | |
| 227 | if (channel.Init(FLAGS_cntl_server.c_str(), &options) != 0) { |
| 228 | LOG(ERROR) << "Fail to initialize channel"; |
| 229 | return -1; |
| 230 | } |
| 231 | test::ControlService_Stub cntl_stub(&channel); |
| 232 | |
| 233 | test::TestCaseSet case_set; |
| 234 | LoadCaseSet(&case_set, FLAGS_case_file); |
| 235 | |
| 236 | brpc::Controller cntl; |
| 237 | test::NotifyRequest cntl_req; |
| 238 | test::NotifyResponse cntl_rsp; |
| 239 | cntl_req.set_message("ResetCaseSet"); |
| 240 | cntl_stub.Notify(&cntl, &cntl_req, &cntl_rsp, NULL); |
| 241 | CHECK(!cntl.Failed()) << "Cntl Failed"; |
| 242 | for (int i = 0; i < case_set.test_case_size(); ++i) { |
| 243 | RunCase(cntl_stub, case_set.test_case(i)); |
| 244 | } |
| 245 | LOG(INFO) << "EchoClient is going to quit"; |
| 246 | return 0; |
| 247 | } |