3ff473394c114afae6abe29750b6a006325a2123
[invirt/third/libt4.git] / rsm_tester.cc
1 //
2 // RSM test client
3 //
4
5 #include "rsm_protocol.h"
6 #include "rsmtest_client.h"
7 #include "rpc/rpc.h"
8 #include <arpa/inet.h>
9 #include <vector>
10 #include <stdlib.h>
11 #include <stdio.h>
12 #include <string>
13
14 char tprintf_thread_prefix = 't';
15
16 int
17 main(int argc, char *argv[])
18 {
19     if(argc != 4){
20         fprintf(stderr, "Usage: %s [host:]port [partition] arg\n", argv[0]);
21         exit(1);
22     }
23
24     rsmtest_client *lc = new rsmtest_client(argv[1]);
25     std::string command(argv[2]);
26     if (command == "partition") {
27         printf("net_repair returned %d\n", lc->net_repair(atoi(argv[3])));
28     } else if (command == "breakpoint") {
29         int b = atoi(argv[3]);
30         printf("breakpoint %d returned %d\n", b, lc->breakpoint(b));
31     } else {
32         fprintf(stderr, "Unknown command %s\n", argv[2]);
33     }
34     return 0;
35 }