From b578e5c13a5134b866b2407d1b57b96ff78fc15c Mon Sep 17 00:00:00 2001 From: jmjatlanta Date: Thu, 3 Aug 2017 14:35:06 -0500 Subject: [PATCH] Fixed tests --- core/null.c | 2 +- test/exchange/test_bitswap.h | 22 +++++++--------------- test/testit.c | 2 +- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/core/null.c b/core/null.c index 899d018..4675fca 100644 --- a/core/null.c +++ b/core/null.c @@ -206,7 +206,7 @@ void ipfs_null_connection (void *ptr) { free (connection_param); if (retVal != 0) { libp2p_logger_debug("null", "%s Freeing session context.\n", connection_param->local_node->identity->peer->id); - libp2p_session_context_free(session); + //libp2p_session_context_free(session); } return; } diff --git a/test/exchange/test_bitswap.h b/test/exchange/test_bitswap.h index 10d0ba4..d3693cf 100644 --- a/test/exchange/test_bitswap.h +++ b/test/exchange/test_bitswap.h @@ -265,12 +265,14 @@ int test_bitswap_retrieve_file_known_remote() { /*** * This assumes a remote server with the hello_world.txt file already in its database */ - char* remote_ip = "10.211.55.2"; int remote_port = 4001; - char* remote_peer_id = "QmZVoAZGFfinB7MQQiDzB84kWaDPQ95GLuXdemJFM2r9b4"; + // mac + // char* remote_peer_id = "QmZVoAZGFfinB7MQQiDzB84kWaDPQ95GLuXdemJFM2r9b4"; + // char* remote_ip = "10.211.55.2"; + // linux + char* remote_peer_id = "QmRKm1d9kSCRpMFtLYpfhhCQ3DKuSSPJa3qn9wWXfwnWnY"; + char* remote_ip = "10.211.55.4"; char* hello_world_hash = "QmTUFTVgkHT3Qdd9ospVjSLi2upd6VdkeNXZQH66cVmzja"; - pthread_t thread; - int thread_started = 0; /* libp2p_logger_add_class("dht_protocol"); @@ -306,15 +308,8 @@ int test_bitswap_retrieve_file_known_remote() { multiaddress_free(ma_peer1); ipfs_node_online_new(ipfs_path, &ipfs_node2); - // start the daemon in a separate thread - if (pthread_create(&thread, NULL, test_routing_daemon_start, (void*)ipfs_path) < 0) { - libp2p_logger_error("test_bitswap", "Unable to start thread 2\n"); - goto exit; - } - thread_started = 1; - if (!ipfs_cid_decode_hash_from_base58((unsigned char*)hello_world_hash, strlen(hello_world_hash), &cid)) - goto exit; + goto exit; // this does the heavy lifting... if (!ipfs_node2->exchange->GetBlock(ipfs_node2->exchange, cid, &result)) { @@ -329,9 +324,6 @@ int test_bitswap_retrieve_file_known_remote() { retVal = 1; exit: - ipfs_daemon_stop(); - if (thread_started) - pthread_join(thread, NULL); if (peer_id_1 != NULL) free(peer_id_1); if (peer_id_2 != NULL) diff --git a/test/testit.c b/test/testit.c index 02917cc..87c9524 100644 --- a/test/testit.c +++ b/test/testit.c @@ -162,7 +162,7 @@ char* get_test(int argc, char** argv, int arg_number) { ptr++; retVal = malloc(strlen(ptr) + 1); strcpy(retVal, ptr); - ptr = strchr(ptr, '\''); + ptr = strchr(retVal, '\''); if (ptr != NULL) ptr[0] = 0; }