From 2408ee6b254b5f67a6b50280dec6c66536abd1c1 Mon Sep 17 00:00:00 2001 From: Julius Bünger Date: Thu, 11 Oct 2018 14:48:02 +0200 Subject: RPS Tests: Test Subs --- src/rps/.gitignore | 9 +++++---- src/rps/Makefile.am | 32 ++++++++++++++++++-------------- src/rps/test_rps.c | 42 +++++++++++++++++++++++++++++++++++++++++- src/rps/test_rps.conf | 2 +- 4 files changed, 65 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/rps/.gitignore b/src/rps/.gitignore index cb14f5b09..9e78e2ca0 100644 --- a/src/rps/.gitignore +++ b/src/rps/.gitignore @@ -1,15 +1,16 @@ gnunet-service-rps gnunet-rps gnunet-rps-profiler -test_rps_malicious_1 -test_rps_malicious_2 -test_rps_malicious_3 +test_rps_single_req test_rps_req_cancel +test_rps_sub test_rps_seed_big test_rps_seed_request -test_rps_single_req test_service_rps_custommap test_service_rps_sampler_elem test_service_rps_view test_rps_churn test_service_rps_peers +test_rps_malicious_1 +test_rps_malicious_2 +test_rps_malicious_3 diff --git a/src/rps/Makefile.am b/src/rps/Makefile.am index e973bb7ca..8d2ddf7d7 100644 --- a/src/rps/Makefile.am +++ b/src/rps/Makefile.am @@ -79,14 +79,15 @@ check_PROGRAMS = \ test_service_rps_view \ test_service_rps_custommap \ test_service_rps_sampler_elem \ - test_rps_malicious_1 \ - test_rps_malicious_2 \ - test_rps_malicious_3 \ - test_rps_seed_request \ test_rps_single_req \ test_rps_req_cancel \ + test_rps_sub \ + test_rps_seed_request \ test_rps_seed_big \ - test_rps_churn + test_rps_churn \ + test_rps_malicious_1 \ + test_rps_malicious_2 \ + test_rps_malicious_3 endif rps_test_src = \ @@ -125,15 +126,6 @@ test_service_rps_sampler_elem_SOURCES = \ test_service_rps_sampler_elem.c test_service_rps_sampler_elem_LDADD = $(top_builddir)/src/util/libgnunetutil.la -test_rps_malicious_1_SOURCES = $(rps_test_src) -test_rps_malicious_1_LDADD = $(ld_rps_test_lib) - -test_rps_malicious_2_SOURCES = $(rps_test_src) -test_rps_malicious_2_LDADD = $(ld_rps_test_lib) - -test_rps_malicious_3_SOURCES = $(rps_test_src) -test_rps_malicious_3_LDADD = $(ld_rps_test_lib) - test_rps_single_req_SOURCES = $(rps_test_src) test_rps_single_req_LDADD = $(ld_rps_test_lib) @@ -143,12 +135,24 @@ test_rps_seed_request_LDADD = $(ld_rps_test_lib) test_rps_req_cancel_SOURCES = $(rps_test_src) test_rps_req_cancel_LDADD = $(ld_rps_test_lib) +test_rps_sub_SOURCES = $(rps_test_src) +test_rps_sub_LDADD = $(ld_rps_test_lib) + test_rps_seed_big_SOURCES = $(rps_test_src) test_rps_seed_big_LDADD = $(ld_rps_test_lib) test_rps_churn_SOURCES = $(rps_test_src) test_rps_churn_LDADD = $(ld_rps_test_lib) +test_rps_malicious_1_SOURCES = $(rps_test_src) +test_rps_malicious_1_LDADD = $(ld_rps_test_lib) + +test_rps_malicious_2_SOURCES = $(rps_test_src) +test_rps_malicious_2_LDADD = $(ld_rps_test_lib) + +test_rps_malicious_3_SOURCES = $(rps_test_src) +test_rps_malicious_3_LDADD = $(ld_rps_test_lib) + gnunet_rps_profiler_SOURCES = \ gnunet-service-rps_sampler_elem.h gnunet-service-rps_sampler_elem.c \ rps-sampler_common.h rps-sampler_common.c \ diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c index ba0371f38..cbd3ba845 100644 --- a/src/rps/test_rps.c +++ b/src/rps/test_rps.c @@ -1543,6 +1543,31 @@ churn_test_cb (struct RPSPeer *rps_peer) schedule_missing_requests (rps_peer); } +/*********************************** + * SUB +***********************************/ + +void sub_post (struct RPSPeer *rps_peer) +{ + GNUNET_RPS_sub_stop (rps_peer->rps_handle, "test"); +} + +static void +sub_stop_op (void *cls) +{ + struct GNUNET_RPS_Handle *h = cls; + + GNUNET_RPS_sub_stop (h, "test"); +} + +static void +sub_pre (struct RPSPeer *rps_peer, struct GNUNET_RPS_Handle *h) +{ + (void) rps_peer; + + GNUNET_RPS_sub_start (h, "test"); +} + /*********************************** * PROFILER ***********************************/ @@ -2873,7 +2898,22 @@ main (int argc, char *argv[]) cur_test_run.eval_cb = default_eval_cb; cur_test_run.have_churn = HAVE_NO_CHURN; cur_test_run.have_quick_quit = HAVE_NO_QUICK_QUIT; - timeout_s = 10; + timeout_s = 40; + } + + else if (strstr (argv[0], "_sub") != NULL) + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test subs\n"); + cur_test_run.name = "test-rps-sub"; + num_peers = 5; + //cur_test_run.init_peer = &default_init_peer; + cur_test_run.pre_test = &sub_pre; + cur_test_run.main_test = &single_req_cb; + //cur_test_run.reply_handle = default_reply_handle; + cur_test_run.post_test = &sub_post; + //cur_test_run.eval_cb = default_eval_cb; + cur_test_run.have_churn = HAVE_NO_CHURN; + cur_test_run.have_quick_quit = HAVE_QUICK_QUIT; } else if (strstr (argv[0], "profiler") != NULL) diff --git a/src/rps/test_rps.conf b/src/rps/test_rps.conf index 84e0e5049..c55930649 100644 --- a/src/rps/test_rps.conf +++ b/src/rps/test_rps.conf @@ -12,7 +12,7 @@ NOARMBIND = YES #OPTIONS=-l /tmp/rps_profiler_logs/rps-[]-%Y-%m-%d.log # This is the timeinterval between the rounds -ROUNDINTERVAL = 2 s +ROUNDINTERVAL = 1 s FILENAME_VALID_PEERS = $GNUNET_DATA_HOME/rps/valid_peers.txt # This is the 'estimate' in the beginning. -- cgit v1.2.3