You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

251 lines
6.0 KiB

  1. --- a/test/test_block.cc
  2. +++ b/test/test_block.cc
  3. @@ -24,9 +24,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE
  4. #include <sstream>
  5. #include <stdexcept>
  6. -int main(int, char**) {
  7. +int main(int argc, char** argv) {
  8. + char addr127001[]="127.0.0.1";
  9. + char *srvaddr;
  10. + if (argc<2)
  11. + srvaddr=addr127001;
  12. + else
  13. + srvaddr=argv[1];
  14. +
  15. try {
  16. - ipfs::Client client("localhost", 5001);
  17. + ipfs::Client client(srvaddr, 5001);
  18. /** [ipfs::Client::BlockPut] */
  19. ipfs::Json block;
  20. --- a/test/test_config.cc
  21. +++ b/test/test_config.cc
  22. @@ -23,9 +23,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE
  23. #include <iostream>
  24. #include <stdexcept>
  25. -int main(int, char**) {
  26. +int main(int argc, char** argv) {
  27. + char addr127001[]="127.0.0.1";
  28. + char *srvaddr;
  29. + if (argc<2)
  30. + srvaddr=addr127001;
  31. + else
  32. + srvaddr=argv[1];
  33. +
  34. try {
  35. - ipfs::Client client("localhost", 5001);
  36. + ipfs::Client client(srvaddr, 5001);
  37. /** [ipfs::Client::ConfigSet] */
  38. client.ConfigSet("Datastore.StorageMax", "20GB");
  39. --- a/test/test_dht.cc
  40. +++ b/test/test_dht.cc
  41. @@ -23,9 +23,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE
  42. #include <iostream>
  43. #include <stdexcept>
  44. -int main(int, char**) {
  45. +int main(int argc, char** argv) {
  46. + char addr127001[]="127.0.0.1";
  47. + char *srvaddr;
  48. + if (argc<2)
  49. + srvaddr=addr127001;
  50. + else
  51. + srvaddr=argv[1];
  52. +
  53. try {
  54. - ipfs::Client client("localhost", 5001);
  55. + ipfs::Client client(srvaddr, 5001);
  56. ipfs::Json add_result;
  57. client.FilesAdd(
  58. --- a/test/test_error.cc
  59. +++ b/test/test_error.cc
  60. @@ -35,16 +35,23 @@ extern std::string replace_body;
  61. }
  62. } // namespace ipfs
  63. -int main(int, char**) {
  64. +int main(int argc, char** argv) {
  65. + char addr127001[]="127.0.0.1";
  66. + char *srvaddr;
  67. + if (argc<2)
  68. + srvaddr=addr127001;
  69. + else
  70. + srvaddr=argv[1];
  71. +
  72. try {
  73. - ipfs::Client client_cant_connect("localhost", 57);
  74. + ipfs::Client client_cant_connect(srvaddr, 57);
  75. ipfs::test::must_fail("client.Version()", [&client_cant_connect]() {
  76. ipfs::Json version;
  77. client_cant_connect.Version(&version);
  78. });
  79. - ipfs::Client client("localhost", 5001);
  80. + ipfs::Client client(srvaddr, 5001);
  81. std::string object_id;
  82. client.ObjectNew(&object_id);
  83. --- a/test/test_files.cc
  84. +++ b/test/test_files.cc
  85. @@ -24,10 +24,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE
  86. #include <sstream>
  87. #include <stdexcept>
  88. -int main(int, char**) {
  89. +int main(int argc, char** argv) {
  90. + char addr127001[]="127.0.0.1";
  91. + char *srvaddr;
  92. + if (argc<2)
  93. + srvaddr=addr127001;
  94. + else
  95. + srvaddr=argv[1];
  96. +
  97. try {
  98. // Try Files API tests with time-out setting of 20 seconds
  99. - ipfs::Client client("localhost", 5001, "20s");
  100. + ipfs::Client client(srvaddr, 5001, "20s");
  101. /** [ipfs::Client::FilesGet] */
  102. std::stringstream contents;
  103. --- a/test/test_generic.cc
  104. +++ b/test/test_generic.cc
  105. @@ -24,11 +24,18 @@ CONNECTION WITH THE SOFTWARE OR THE USE
  106. #include <stdexcept>
  107. #include <utility>
  108. -int main(int, char**) {
  109. +int main(int argc, char** argv) {
  110. + char addr127001[]="127.0.0.1";
  111. + char *srvaddr;
  112. + if (argc<2)
  113. + srvaddr=addr127001;
  114. + else
  115. + srvaddr=argv[1];
  116. +
  117. try {
  118. // Test client constructor
  119. /** [ipfs::Client::Client] */
  120. - ipfs::Client client("localhost", 5001);
  121. + ipfs::Client client(srvaddr, 5001);
  122. /** [ipfs::Client::Client] */
  123. // Test client constructor with additional parameters
  124. @@ -38,7 +45,7 @@ int main(int, char**) {
  125. ipfs::Client clientA(client);
  126. clientA = client;
  127. ipfs::Client clientB(std::move(clientA));
  128. - ipfs::Client clientC("localhost", 5001);
  129. + ipfs::Client clientC(srvaddr, 5001);
  130. clientC = std::move(clientB);
  131. #pragma GCC diagnostic push
  132. --- a/test/test_key.cc
  133. +++ b/test/test_key.cc
  134. @@ -26,9 +26,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE
  135. using Json = nlohmann::json;
  136. -int main(int, char**) {
  137. +int main(int argc, char** argv) {
  138. + char addr127001[]="127.0.0.1";
  139. + char *srvaddr;
  140. + if (argc<2)
  141. + srvaddr=addr127001;
  142. + else
  143. + srvaddr=argv[1];
  144. +
  145. try {
  146. - ipfs::Client client("localhost", 5001);
  147. + ipfs::Client client(srvaddr, 5001);
  148. /** [ipfs::Client::KeyGen] */
  149. std::string key_id;
  150. --- a/test/test_name.cc
  151. +++ b/test/test_name.cc
  152. @@ -24,9 +24,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE
  153. #include <sstream>
  154. #include <stdexcept>
  155. -int main(int, char**) {
  156. +int main(int argc, char** argv) {
  157. + char addr127001[]="127.0.0.1";
  158. + char *srvaddr;
  159. + if (argc<2)
  160. + srvaddr=addr127001;
  161. + else
  162. + srvaddr=argv[1];
  163. +
  164. try {
  165. - ipfs::Client client("localhost", 5001);
  166. + ipfs::Client client(srvaddr, 5001);
  167. // We need a key here, so as not to clobber the "self" key.
  168. std::string key_id;
  169. --- a/test/test_object.cc
  170. +++ b/test/test_object.cc
  171. @@ -24,9 +24,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE
  172. #include <stdexcept>
  173. #include <string>
  174. -int main(int, char**) {
  175. +int main(int argc, char** argv) {
  176. + char addr127001[]="127.0.0.1";
  177. + char *srvaddr;
  178. + if (argc<2)
  179. + srvaddr=addr127001;
  180. + else
  181. + srvaddr=argv[1];
  182. +
  183. try {
  184. - ipfs::Client client("localhost", 5001);
  185. + ipfs::Client client(srvaddr, 5001);
  186. /** [ipfs::Client::ObjectNew] */
  187. std::string object_id;
  188. --- a/test/test_pin.cc
  189. +++ b/test/test_pin.cc
  190. @@ -23,9 +23,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE
  191. #include <stdexcept>
  192. #include <string>
  193. -int main(int, char**) {
  194. +int main(int argc, char** argv) {
  195. + char addr127001[]="127.0.0.1";
  196. + char *srvaddr;
  197. + if (argc<2)
  198. + srvaddr=addr127001;
  199. + else
  200. + srvaddr=argv[1];
  201. +
  202. try {
  203. - ipfs::Client client("localhost", 5001);
  204. + ipfs::Client client(srvaddr, 5001);
  205. std::string object_id;
  206. --- a/test/test_swarm.cc
  207. +++ b/test/test_swarm.cc
  208. @@ -23,9 +23,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE
  209. #include <stdexcept>
  210. #include <string>
  211. -int main(int, char**) {
  212. +int main(int argc, char** argv) {
  213. + char addr127001[]="127.0.0.1";
  214. + char *srvaddr;
  215. + if (argc<2)
  216. + srvaddr=addr127001;
  217. + else
  218. + srvaddr=argv[1];
  219. +
  220. try {
  221. - ipfs::Client client("localhost", 5001);
  222. + ipfs::Client client(srvaddr, 5001);
  223. /** [ipfs::Client::SwarmAddrs] */
  224. ipfs::Json addresses;