--- a/test/test_block.cc +++ b/test/test_block.cc @@ -24,9 +24,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE #include #include -int main(int, char**) { +int main(int argc, char** argv) { + char addr127001[]="127.0.0.1"; + char *srvaddr; + if (argc<2) + srvaddr=addr127001; + else + srvaddr=argv[1]; + try { - ipfs::Client client("localhost", 5001); + ipfs::Client client(srvaddr, 5001); /** [ipfs::Client::BlockPut] */ ipfs::Json block; --- a/test/test_config.cc +++ b/test/test_config.cc @@ -23,9 +23,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE #include #include -int main(int, char**) { +int main(int argc, char** argv) { + char addr127001[]="127.0.0.1"; + char *srvaddr; + if (argc<2) + srvaddr=addr127001; + else + srvaddr=argv[1]; + try { - ipfs::Client client("localhost", 5001); + ipfs::Client client(srvaddr, 5001); /** [ipfs::Client::ConfigSet] */ client.ConfigSet("Datastore.StorageMax", "20GB"); --- a/test/test_dht.cc +++ b/test/test_dht.cc @@ -23,9 +23,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE #include #include -int main(int, char**) { +int main(int argc, char** argv) { + char addr127001[]="127.0.0.1"; + char *srvaddr; + if (argc<2) + srvaddr=addr127001; + else + srvaddr=argv[1]; + try { - ipfs::Client client("localhost", 5001); + ipfs::Client client(srvaddr, 5001); ipfs::Json add_result; client.FilesAdd( --- a/test/test_error.cc +++ b/test/test_error.cc @@ -35,16 +35,23 @@ extern std::string replace_body; } } // namespace ipfs -int main(int, char**) { +int main(int argc, char** argv) { + char addr127001[]="127.0.0.1"; + char *srvaddr; + if (argc<2) + srvaddr=addr127001; + else + srvaddr=argv[1]; + try { - ipfs::Client client_cant_connect("localhost", 57); + ipfs::Client client_cant_connect(srvaddr, 57); ipfs::test::must_fail("client.Version()", [&client_cant_connect]() { ipfs::Json version; client_cant_connect.Version(&version); }); - ipfs::Client client("localhost", 5001); + ipfs::Client client(srvaddr, 5001); std::string object_id; client.ObjectNew(&object_id); --- a/test/test_files.cc +++ b/test/test_files.cc @@ -24,10 +24,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE #include #include -int main(int, char**) { +int main(int argc, char** argv) { + char addr127001[]="127.0.0.1"; + char *srvaddr; + if (argc<2) + srvaddr=addr127001; + else + srvaddr=argv[1]; + try { // Try Files API tests with time-out setting of 20 seconds - ipfs::Client client("localhost", 5001, "20s"); + ipfs::Client client(srvaddr, 5001, "20s"); /** [ipfs::Client::FilesGet] */ std::stringstream contents; --- a/test/test_generic.cc +++ b/test/test_generic.cc @@ -24,11 +24,18 @@ CONNECTION WITH THE SOFTWARE OR THE USE #include #include -int main(int, char**) { +int main(int argc, char** argv) { + char addr127001[]="127.0.0.1"; + char *srvaddr; + if (argc<2) + srvaddr=addr127001; + else + srvaddr=argv[1]; + try { // Test client constructor /** [ipfs::Client::Client] */ - ipfs::Client client("localhost", 5001); + ipfs::Client client(srvaddr, 5001); /** [ipfs::Client::Client] */ // Test client constructor with additional parameters @@ -38,7 +45,7 @@ int main(int, char**) { ipfs::Client clientA(client); clientA = client; ipfs::Client clientB(std::move(clientA)); - ipfs::Client clientC("localhost", 5001); + ipfs::Client clientC(srvaddr, 5001); clientC = std::move(clientB); #pragma GCC diagnostic push --- a/test/test_key.cc +++ b/test/test_key.cc @@ -26,9 +26,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE using Json = nlohmann::json; -int main(int, char**) { +int main(int argc, char** argv) { + char addr127001[]="127.0.0.1"; + char *srvaddr; + if (argc<2) + srvaddr=addr127001; + else + srvaddr=argv[1]; + try { - ipfs::Client client("localhost", 5001); + ipfs::Client client(srvaddr, 5001); /** [ipfs::Client::KeyGen] */ std::string key_id; --- a/test/test_name.cc +++ b/test/test_name.cc @@ -24,9 +24,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE #include #include -int main(int, char**) { +int main(int argc, char** argv) { + char addr127001[]="127.0.0.1"; + char *srvaddr; + if (argc<2) + srvaddr=addr127001; + else + srvaddr=argv[1]; + try { - ipfs::Client client("localhost", 5001); + ipfs::Client client(srvaddr, 5001); // We need a key here, so as not to clobber the "self" key. std::string key_id; --- a/test/test_object.cc +++ b/test/test_object.cc @@ -24,9 +24,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE #include #include -int main(int, char**) { +int main(int argc, char** argv) { + char addr127001[]="127.0.0.1"; + char *srvaddr; + if (argc<2) + srvaddr=addr127001; + else + srvaddr=argv[1]; + try { - ipfs::Client client("localhost", 5001); + ipfs::Client client(srvaddr, 5001); /** [ipfs::Client::ObjectNew] */ std::string object_id; --- a/test/test_pin.cc +++ b/test/test_pin.cc @@ -23,9 +23,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE #include #include -int main(int, char**) { +int main(int argc, char** argv) { + char addr127001[]="127.0.0.1"; + char *srvaddr; + if (argc<2) + srvaddr=addr127001; + else + srvaddr=argv[1]; + try { - ipfs::Client client("localhost", 5001); + ipfs::Client client(srvaddr, 5001); std::string object_id; --- a/test/test_swarm.cc +++ b/test/test_swarm.cc @@ -23,9 +23,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE #include #include -int main(int, char**) { +int main(int argc, char** argv) { + char addr127001[]="127.0.0.1"; + char *srvaddr; + if (argc<2) + srvaddr=addr127001; + else + srvaddr=argv[1]; + try { - ipfs::Client client("localhost", 5001); + ipfs::Client client(srvaddr, 5001); /** [ipfs::Client::SwarmAddrs] */ ipfs::Json addresses;